# -*- coding:utf-8 -*-
import subprocess
import xml.dom.minidom
ST_MISSING = "missing"
ST_MODIFIED = "modified"
ST_UNVERSIONED = "unversioned"
cmds = {ST_MISSING :"svn del \"{}\"",ST_UNVERSIONED:"svn add \"{}\""}
def runCmd(command):
ret = subprocess.run(command,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE,timeout=1)
return ret
def svnCommit():
ret = runCmd("svn status --xml")
DOMTree = xml.dom.minidom.parseString(ret.stdout)
collection = DOMTree.documentElement
es = collection.getElementsByTagName("entry")
for entry in es:
statusNode = entry.getElementsByTagName("wc-status")[0]
filePath = entry.getAttribute("path")
status=statusNode.getAttribute("item")
# print(filePath + " = " + status)
if status in cmds:
cmd = cmds[status].format(filePath)
print(cmd)
runCmd(cmd)
runCmd("svn commit -m \"auto commit by python\" ")
svnCommit()
通过python获取svn状态
_Bruce2023-10-28 21:56
相关推荐
唐装鼠6 小时前
Nginx + Gunicorn + Python Web 应用 架构(Claude)梦想三三6 小时前
【PYthon词频统计与文本向量化】苏宁易购评论分析实战biter down7 小时前
9:JSONSchema日晨难再7 小时前
C语言&Python&Bash&Tcl:全局变量和局部变量麻雀飞吧7 小时前
期货量化主连和具体合约怎么切:天勤 KQ.m 与 KQ.i 用法先吃饱再说7 小时前
Python List 切片与 LLM Prompt 设计:从数据结构到接口调用一只专注api接口开发的技术猿7 小时前
OpenClaw 对接淘宝商品 API,低成本实现全天候选品监控|附可运行 Python 实操代码xingpanvip7 小时前
星盘接口开发文档:马盘次限盘接口指南FBI HackerHarry浩7 小时前
第二阶段Day07【Python生成器、yield关键字、property、正则表达式】梦想不只是梦与想7 小时前
Python 中的 4 种作用域