# -*- 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
相关推荐
乔巴先生241 小时前
LLMCompiler:基于LangGraph的并行化Agent架构高效实现张子夜 iiii2 小时前
实战项目-----Python+OpenCV 实现对视频的椒盐噪声注入与实时平滑还原”困鲲鲲3 小时前
Flask 核心基础:从 路由装饰器 到 __name__ 变量 的底层逻辑解析njxiejing4 小时前
Python NumPy安装、导入与入门Rhys..4 小时前
Python&Flask 使用 DBUtils 创建通用连接池Just_Paranoid4 小时前
【Python Tkinter】图形用户界面(GUI)开发及打包EXE指南小宁爱Python4 小时前
Django 基础入门:命令、结构与核心配置全解析闲人编程5 小时前
Flask 前后端分离架构实现支付宝电脑网站支付功能996终结者5 小时前
同类软件对比(四):Jupyter vs PyCharm vs VS Code:Python开发工具终极选择指南果壳~6 小时前
【Python】爬虫html提取内容基础,bs4