diff mercurial/hg.py @ 17938:fd903f89e42b

share: always set default path to work with subrepos (issue3518) set the default path in any case because creating subrepo looks this up. Subrepos are cloned, not shared.
author simon@laptop-tosh
date Sat, 27 Oct 2012 12:38:59 +0200
parents 7f5dab94e48c
children 4d1671b39168
line wrap: on
line diff
--- a/mercurial/hg.py	Sat Nov 03 10:40:36 2012 +0100
+++ b/mercurial/hg.py	Sat Oct 27 12:38:59 2012 +0200
@@ -171,11 +171,14 @@
     r = repository(ui, root)
 
     default = srcrepo.ui.config('paths', 'default')
-    if default:
-        fp = r.opener("hgrc", "w", text=True)
-        fp.write("[paths]\n")
-        fp.write("default = %s\n" % default)
-        fp.close()
+    if not default:
+        # set default to source for being able to clone subrepos
+        default = os.path.abspath(util.urllocalpath(origsource))
+    fp = r.opener("hgrc", "w", text=True)
+    fp.write("[paths]\n")
+    fp.write("default = %s\n" % default)
+    fp.close()
+    r.ui.setconfig('paths', 'default', default)
 
     if update:
         r.ui.status(_("updating working directory\n"))