Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

login callback and _log_to_commit path parsing #19

Open
wants to merge 1 commit into from

1 participant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 12, 2011
  1. @MattAgile
This page is out of date. Refresh to see the latest.
Showing with 21 additions and 5 deletions.
  1. +21 −5 pyvcs/backends/subversion.py
View
26 pyvcs/backends/subversion.py
@@ -1,6 +1,7 @@
from datetime import datetime, timedelta
from tempfile import NamedTemporaryFile
from time import mktime
+from urlparse import urlparse
import os
import pysvn
@@ -11,15 +12,30 @@
from pyvcs.utils import generate_unified_diff
class Repository(BaseRepository):
- def __init__(self, *args, **kwargs):
+ def _login_callback(self, realm, username, may_save):
+ retcode = True
+ username = self.username
+ password = self.password
+ save = self.savepassword
+ return retcode, username, password, save
+
+ def __init__(self, username=None, password=None, savepassword=False, *args, **kwargs):
+ self.username = username
+ self.password = password
+ self.savepassword = savepassword
super(Repository, self).__init__(*args, **kwargs)
-
self._repo = pysvn.Client(self.path.rstrip(os.path.sep))
+ self._repo.callback_get_login = self._login_callback
def _log_to_commit(self, log):
- info = self._repo.info(self.path)
- base, url = info['repos'], info['url']
- at = url[len(base):]
+ try:
+ info = self._repo.info(self.path)
+ base, url = info['repos'], info['url']
+ at = url[len(base):]
+ except pysvn.ClientError:
+ url = urlparse(self.path)
+ at = url.path
+
commit_files = [cp_dict['path'][len(at)+1:] for cp_dict in log['changed_paths']]
def get_diff():
Something went wrong with that request. Please try again.