问题:当使用 pysvn.Client 更新分支 (http://svn.exemple.com/root/workspace/branch) 时,它请求 svn root(http://svn.exemple.com/root),并收到值得ClientError(403 禁止)。
它发生在 linux-2.6(redhat-5.6-Final) 上,当我在 Windows 7 上测试时,代码运行良好。
像这样的代码:
def _initClient(self):
self._client = pysvn.Client()
self._client.exception_style = 1
self._client.set_default_username(self.configObj.SVN_USER)
self._client.set_default_password(self.configObj.SVN_PASSWD)
try:
self.cur_revision_number = self._client.info(self._workcopy)["revision"].number
except pysvn.ClientError:
self.cur_revision_number = self._client.checkout(self.configObj.SVN_SERVER,self._workcopy).number
def update(self, pathname=None, **kwargs):
'''
Update workcopy
Extra kwargs are:
recurse=True,
revision=version("head"),
ignore_externals=False,
depth=depth
'''
if not pathname:
path = self._workcopy
elif os.path.isabs(pathname):
path = pathname
if self._workcopy not in path:
raise ValueError("Unkown workcopy \"%s\"" % pathname)
else:
path = os.path.join(self._workcopy, pathname)
self.cur_revision_number = self._client.update(
path, **kwargs
)[-1].number