Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login callback and _log_to_commit path parsing #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 21 additions & 5 deletions pyvcs/backends/subversion.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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():
Expand Down