简体   繁体   English

使用Python脚本提交多个SVN存储库?

[英]Commit multiple SVN repositories using a Python script?

I've been doing a lot of script-powered mass-updates to dozens of project folders at once, lately. 最近,我一次对许多项目文件夹进行了很多脚本驱动的批量更新。 Unfortunately, my pointy-haired boss insists that each folder be committed to TortoiseSVN separately after one of these bulk edits - he wants every folder to have a different revision number. 不幸的是,我的尖头老板坚持要求在对这些文件夹进行一次批量编辑之后,将每个文件夹分别提交给TortoiseSVN-他希望每个文件夹都具有不同的修订号。 Me being the automation fiend that I am, turned to scripting to try to solve this problem for me. 我是自动化的恶魔,我转向脚本尝试为我解决此问题。 This is what I'm trying: 这是我正在尝试的:

import subprocess
import glob

for filepath in glob.glob("C:\eForms\*"):
    if ".svn" not in filepath:
        subprocess.call(['svn commit',filepath, '--message "<commit message here>"'], shell=True)

When I try to run it, I get The filename, directory name, or volume label syntax is incorrect. 尝试运行它时,我得到The filename, directory name, or volume label syntax is incorrect. Any ideas? 有任何想法吗?

EDIT: Think I solved that issue. 编辑:认为我解决了这个问题。 I tweaked the syntax, so now the call line reads subprocess.call(["svn", "commit",('"',filepath,'"'), '-m "<commit message>"'], shell=True) 我调整了语法,因此现在调用行读取subprocess.call(["svn", "commit",('"',filepath,'"'), '-m "<commit message>"'], shell=True)

Now I'm getting the error svn: E020024: Error resolving case of '"<filepath>"' 现在,我得到错误svn: E020024: Error resolving case of '"<filepath>"'

EDIT2: And pulling the quotes off the filepath solved that. EDIT2:从文件路径中引号解决了这一问题。 All working now! 现在都在工作!

调用函数的正确语法竟然是

subprocess.call(["svn", "commit", filepath, '-m "<commit message here>"'], shell = True)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM