diff hgsubversion/wrappers.py @ 463:c82d5a9acecf

Unify svn credentials handling as config entries It has 2 benefits: - It generalizes the use of hgsubversion.username/password initiated in push/pull. - Command line options are no longer need to create SubversionRepo, so we can move this out of command handling code.
author Patrick Mezard <pmezard@gmail.com>
date Sat, 18 Jul 2009 20:44:33 -0500
parents db3a53a2cd76
children 0f7095f53ca3
line wrap: on
line diff
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -53,7 +53,7 @@ def incoming(orig, ui, repo, source='def
     if 'subversion' not in other.capabilities:
         return orig(ui, repo, source, **opts)
 
-    user, passwd = util.getuserpass(opts)
+    user, passwd = util.getuserpass(ui)
     svn = svnwrap.SubversionRepo(other.svnurl, user, passwd)
     meta = svnmeta.SVNMeta(repo)
 
@@ -119,8 +119,7 @@ def push(repo, dest, force, revs):
     # split of #rev; TODO: implement --rev/#rev support
     svnurl, revs, checkout = hg.parseurl(svnurl, revs)
     # TODO: do credentials specified in the URL still work?
-    user = repo.ui.config('hgsubversion', 'username')
-    passwd = repo.ui.config('hgsubversion', 'password')
+    user, passwd = util.getuserpass(ui)
     svn = svnwrap.SubversionRepo(svnurl, user, passwd)
     meta = svnmeta.SVNMeta(repo, svn.uuid)
 
@@ -231,8 +230,7 @@ def pull(repo, source, heads=[], force=F
         repo.ui.note('fetching stupidly...\n')
 
     # TODO: do credentials specified in the URL still work?
-    user = repo.ui.config('hgsubversion', 'username')
-    passwd = repo.ui.config('hgsubversion', 'password')
+    user, passwd = util.getuserpass(repo.ui)
     svn = svnwrap.SubversionRepo(svn_url, user, passwd)
     meta = svnmeta.SVNMeta(repo, svn.uuid, svn.subdir)