python svn模块_使用Python实现一键批量更新SVN/Git模块的脚本
現在我們開發的過程中,大都是模塊化的工作方式,咱們的工程源碼結構就是N個模塊,N個SVN/Git地址,如果需要更新就得手動一個個的操作,弄起來實在太麻煩了,之前我都是寫批處理來實現批量更新的,現在來使用Python來實現一把,這里僅僅實現一下svn的批量更新模塊的方法了,這里寫的是在Windows環境下的使用哦,具體代碼如下:# Autor: 5bug
# WebSite: http://www.5bug.wang
# 吾八哥網技術交流QQ群: 643829693
import os
import sys
#列出當前目錄下所有一級文件夾
def dirpathlist(lpath, outlist):
filelist = os.listdir(lpath)
for f in filelist:
filename = os.path.join(lpath, f)
if os.path.isdir(filename):
outlist.append(filename)
return outlist
#執行SVN更新
def svnupdate(path):
cmd = 'TortoiseProc.exe /command:update /path:"{}" /closeonend:0'.format(path)
os.system(cmd)
if __name__ == '__main__':
outlist = dirpathlist(sys.path[0], [])
for f in outlist:
print('更新 {}'.format(f))
svnupdate(f)
如果是git,把相應的命令行換成git的命令即可。
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的python svn模块_使用Python实现一键批量更新SVN/Git模块的脚本的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 小甲鱼python课后答案40讲_小甲鱼
- 下一篇: python opencv源码_caff