# -*- 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
相关推荐
seeyoutlb10 小时前
微服务全局日志处理ada7_10 小时前
LeetCode(python)——148.排序链表岁月宁静11 小时前
LangChain + LangGraph 实战:构建生产级多模态 WorkflowAgent 的完整指南第二只羽毛12 小时前
主题爬虫采集主题新闻信息plmm烟酒僧12 小时前
TensorRT 推理 YOLO Demo 分享 (Python)天才测试猿12 小时前
Postman中变量的使用详解帕巴啦13 小时前
Arcgis计算面要素的面积、周长、宽度、长度及最大直径AI小云13 小时前
【数据操作与可视化】Matplotlib绘图-生成其他图表类型MediaTea13 小时前
Python 第三方库:plotnine(类 ggplot 的 Python 数据可视化库)路边草随风13 小时前
python 调用 spring ai sse mcp