0
내 svn 서버에 액세스하려면 pysvn 1.7.5를 사용합니다. 하나의 파일을 svn 서버에서 로컬 디스크로 복사하려면 pysvn 기능이 구현되어 있지 않습니다. 하지만 https로 연결하면 디렉터리에서 홀 체크 아웃을하지 않고 단일 파일을 복사 할 수 있습니다. 난 내 로컬 디스크에 레트로 브라우저에서 파일을 드래그하면 수정본의 pysvn 파일 복사 기능
def fetch_svn_file(self, file_url, local_path):
local_path = local_path.replace('\\', '/')
# Set up a HTTPS request with username/password authentication
try:
# create a password manager
password_mgr = HTTPPasswordMgrWithDefaultRealm()
# Add the username and password.
password_mgr.add_password(None, 'https://www.xyz.com', self.default_user, self.default_passwd)
opener = build_opener(HTTPBasicAuthHandler(password_mgr))
remote_file = opener.open(file_url)
content = remote_file.read()
try:
local_file = open(local_path,"w")
local_file.write(content)
local_file.close()
except IOError:
return -1
except URLError, e:
print 'URLError: "%s"' % e
return -2
return 0
같은 방법 거북이
은 그것을 할, 그러나 거북이는 다른 버전에서 하나의 파일이 복사 할 수 있습니다. 이제 누구나 pysvn이나 간단한 파이썬 코드에서 이것을 어떻게 실현할 수 있을까요? 이 기능이 거북이에 의해 구현된다면 pysvn에서도 가능해야합니다 ... 동일한 개발자 팀이기 때문에 가능합니다.