简体   繁体   English

使用subprocess.Popen从Torvise SVN检出文件

[英]Checkout files from tortoise svn using subprocess.Popen

I was using this command to check out the file using Tortise svn 我正在使用此命令使用Tortise svn检出文件

work = "F:\Test"
exe = "C:\\Program Files\\TortoiseSVN\\bin\\TortoiseProc.exe"
argu = ("/command:checkout /url:https://Test/help /path:" + str(work))
proc1 = subprocess.Popen([exe, argu])

Once I run the this command I can able to see the path in the Checkout directory field in checkout window. 一旦运行此命令,我就可以在checkout窗口的Checkout目录字段中看到路径。

F:\Test"\help

But if I use ("/command:checkout /url:https://Test/help /path:F:\\Test") this command then I can able to see following path in the Checkout directory field in checkout window. 但是,如果我使用(“ / command:checkout / url:https:// Test / help / path:F:\\ Test”)这个命令,那么我可以在checkout窗口的Checkout目录字段中看到以下路径。

F:\Test\help

Please let me know do we need to provide the complete path in the path variable 请让我知道我们是否需要在path变量中提供完整的路径

First, make sure you use escaped backslashes, either 首先,请确保使用转义的反斜杠

 work = "F:\\Test"

or (python raw strings) 或(python原始字符串)

 work = r"F:\Test"

Then, try to follow the Popen documentation, i quote: 然后,尝试遵循Popen文档,我引用:

The shell argument (which defaults to False) specifies whether to use the shell as the program to execute. shell参数(默认为False)指定是否将shell用作要执行的程序。 It is recommended to pass args as a sequence if shell is False and as a string if shell is True. 如果shell为False,建议将args作为序列传递,如果shell为True,则建议将字符串作为字符串传递。

which would look like this: 看起来像这样:

proc1 = subprocess.Popen([exe, '/command:checkout', '/url:https://Test/help', '/path:' + str(work)])

HTH, I hope i interpreted your question correctly HTH,希望我能正确解释您的问题

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

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