changeset 777:60948939555d

clone: pass on the repository instance rather than the string given Previously, cloning a Mercurial repository that required authentication would prompt for authentication twice. This is because hgclonewrapper() first created a repository instance, but didn't pass it on. hg.close() would then create another instance, and since Mercurial doesn't cache authentication credentials across instances, this would cause a second credential prompt. This change could have unfortunate side effects in case of other extensions wanting to modify the source passed to clone. This seems like a somewhat unlikely scenario. I'll think about a possible way to avoid all this hackery...
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Tue, 14 Dec 2010 12:09:27 +0100
parents f025d00bfc4a
children 184d25bc1c0b d38226a190ad
files hgsubversion/wrappers.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -439,7 +439,9 @@ def clone(orig, ui, source, dest=None, *
                 data['branches'] = branches
                 ui.setconfig('hgsubversion', 'branch', branches[-1])
 
-        data['srcrepo'], data['dstrepo'] = orig(ui, origsource, dest, **opts)
+        # NOTE: this breaks on Mercurial 1.6, where passing a repository
+        # object to hg.clone() will abort. Mercurial 1.6.1 fixed it.
+        data['srcrepo'], data['dstrepo'] = orig(ui, srcrepo, dest, **opts)
 
     for opt, (section, name) in optionmap.iteritems():
         if opt in opts and opts[opt]: