Mercurial > hgsubversion
changeset 265:9f0738587f94
Re-re-refix username support, add a comment so maybe I remember this time.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Mon, 13 Apr 2009 21:12:33 -0500 |
parents | 112d57bb736e |
children | a5f20358f737 |
files | svncommands.py util.py utility_commands.py wrappers.py |
diffstat | 4 files changed, 13 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/svncommands.py +++ b/svncommands.py @@ -19,8 +19,7 @@ def incoming(ui, svn_url, hg_repo_path, svn_url = util.normalize_url(svn_url) initializing_repo = False - user = opts.get('username', hgutil.getuser()) - passwd = opts.get('password', '') + user, passwd = util.getuserpass(opts) svn = svnwrap.SubversionRepo(svn_url, user, passwd) author_host = "@%s" % svn.uuid tag_locations = tag_locations.split(',') @@ -68,8 +67,7 @@ def rebuildmeta(ui, repo, hg_repo_path, raise hgutil.Abort('You must pass the svn URI used to create this repo.') uuid = None url = args[0].rstrip('/') - user = opts.get('username', hgutil.getuser()) - passwd = opts.get('password', '') + user, passwd = util.getuserpass(opts) svn = svnwrap.SubversionRepo(url, user, passwd) subdir = svn.subdir svnmetadir = os.path.join(repo.path, 'svn')
--- a/util.py +++ b/util.py @@ -6,6 +6,14 @@ from mercurial import node from mercurial import util as hgutil +def getuserpass(opts): + # DO NOT default the user to hg's getuser(). If you provide + # *any* default username to Subversion, it won't use any remembered + # username for the desired realm, breaking OS X Keychain support, + # GNOME keyring support, and all similar tools. + return opts.get('username', None), opts.get('password', '') + + def version(ui): """Guess the version of hgsubversion. """
--- a/utility_commands.py +++ b/utility_commands.py @@ -36,8 +36,7 @@ def genignore(ui, repo, hg_repo_path, fo url = hge.url if url[-1] == '/': url = url[:-1] - user = opts.get('username', hgutil.getuser()) - passwd = opts.get('passwd', '') + user, passwd = util.getuserpass(opts) svn = svnwrap.SubversionRepo(url, user, passwd) dirs = [''] + [d[0] for d in svn.list_files(branchpath, r) if d[1] == 'd'] for dir in dirs:
--- a/wrappers.py +++ b/wrappers.py @@ -98,9 +98,7 @@ def push(orig, ui, repo, dest=None, *arg raise hgutil.Abort('wrong subversion url!') svn_commit_hashes = dict(zip(hge.revmap.itervalues(), hge.revmap.iterkeys())) - user = opts.get('username', hgutil.getuser()) - passwd = opts.get('password', '') - + user, passwd = util.getuserpass(opts) # Strategy: # 1. Find all outgoing commits from this head if len(repo.parents()) != 1: @@ -250,8 +248,7 @@ def pull(orig, ui, repo, source="default ' of SWIG.\n') have_replay = False initializing_repo = False - user = opts.get('username', hgutil.getuser()) - passwd = opts.get('password', '') + user, passwd = util.getuserpass(opts) svn = svnwrap.SubversionRepo(svn_url, user, passwd) author_host = "@%s" % svn.uuid tag_locations = ['tags', ]