# -*- 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
相关推荐
SkylerHu15 分钟前
tornado+gunicorn部署设置max_body_size独行soc1 小时前
2025年渗透测试面试题总结-234(题目+回答)木头左1 小时前
年化波动率匹配原则在ETF网格区间选择中的应用清空mega1 小时前
从零开始搭建 flask 博客实验(3)程序员小远2 小时前
7个常见的Jmeter压测问题红尘炼丹客2 小时前
《DeepSeek-OCR: Contexts Optical Compression》速览☼←安于亥时→❦2 小时前
Playwright 安装与使用大佬,救命!!!2 小时前
python实现象棋棉猴2 小时前
《pygame中Sprite类实现多帧动画》注-通过多张序列帧显示动画2-2