# -*- 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
相关推荐
布语world5 分钟前
某东pc滑块分析m0_6464299719 分钟前
Python pytest 单元测试基础DeepVisionary34 分钟前
从1秒多压到0.39秒,Gemini 4 Live靠先应声再干活,把语音延迟降了3倍Web3&Basketball37 分钟前
Playwright实战:27B网页智能体评测3步zc.z41 分钟前
RAG (一):从底层原理、Naive RAG 到企业级项目开发与面试实战王者鳜錸1 小时前
【中英】-Android离线语音听写-讯飞 AIKit源码实现BK贝壳4 小时前
浮点值也能挂进混合数组:bool-hybrid-array 的 FloatHybridArray 构造、下标与追加本机实测钱栈up13 小时前
长安汽车把海外年销钉在100万辆,2030年要翻到200万——出海从故事变成基建富贵儿99813 小时前
NL2SQL 实践手记 03:让模型决定下一步——把 Workflow 改造成 SQL Agent九蝶科技14 小时前
运费分摊的二开实现:BigDecimal 精确分摊 + 尾差补齐 + 暂估调整