使用Python脚本执行SVN命令

时间:2017-01-11 19:32:52

标签: python python-2.7 svn

我想使用Python执行以下SVN命令:

svn log -v --xml --stop-on-copy --no-auth-cache --trust-server-cert --non-interactive --username <user> --password <password> <repo>

我试过这种方式:

cmd = 'svn log -v --xml --stop-on-copy --no-auth-cache --trust-server-cert --non-interactive --username <user> --password <password> <repo>'
args = shlex.split(cmd)
pro = subprocess.Popen(
    args,
    shell=True,
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE)
output, err = pro.communicate()

如果我执行SVN,它会返回一个XML。 如果我执行Python,则输出和错误是空白的。

有什么想法吗?

0 个答案:

没有答案