我能够使用“pysvn”模块编写脚本来检出SVN问题的代码,但只是想知道是否有任何我没有pysvn吗?因为pysvn是我必须单独安装在Linux和Windows上的第三方库,而这两者都是我不想要的。请帮我在我没有安装任何第三方模块代码另一种方式 -如何提供用户名和密码,同时使用python脚本从SVN检出代码而无需第三方模块
import pysvn,os,shutil
def getLogin(realm, username, may_save):
svn_user = '<my-username>'
svn_pass = '<my-password>'
return True, svn_user, svn_pass, False
def ssl_server_trust_prompt(trust_dict):
return (True # server is trusted
,trust_dict["failures"]
,True) # save the answer so that the callback is not called again
def checkOut(svn_url,dest_dir):
if os.path.isdir(dest_dir):
shutil.rmtree(dest_dir)
os.mkdir(dest_dir)
client = pysvn.Client()
client.callback_ssl_server_trust_prompt = ssl_server_trust_prompt
client.callback_get_login = getLogin
client.checkout(svn_url,dest_dir)
else:
os.mkdir(dest_dir)
client = pysvn.Client()
client.callback_ssl_server_trust_prompt = ssl_server_trust_prompt
client.callback_get_login = getLogin
client.checkout(svn_url,dest_dir)
print "Checking out the code hang on...\n"
checkOut('<svn-repo>','ABC')
print "checked out the code \n"
print "Checking out the code hang on...\n"
checkOut('<svn-repo>','XYZ')
print "checked out the code\n"
print "Checking out the code hang on...\n"
checkOut('<svn-repo>','MNP')
print "checked out the code \n”
份额片段。 – ArunDhaJ
其中一个我试过像这样import os os.system('svn co https:// svn-path')。在这里它总是弹出密码窗口。我在ubuntu上运行这个 – user2564083
其他我以同样的方式尝试子进程。请帮助 – user2564083