# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1292324967 -3600 # Node ID 60948939555dbe16336519115dfd244698fb2182 # Parent f025d00bfc4a3d88ca3b18b75fad15d5f51cdfae 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... diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py --- 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]: