cloning subrepos doesnt set default in hgrc

Matt Mackall mpm at selenic.com
Thu Dec 10 19:52:16 CST 2009


On Thu, 2009-12-10 at 20:37 +0000, Johannes Totz wrote:
> Hi!
> 
> Cloning a repo that has subrepos does not set the default path inside
> the subrepo's hgrc.
> It would be nice if it did though! E.g. set its value to what is
> specified in .hgsub as its URL.
> 
> Is there any reason why this might be a bad idea?

Nope. Try this:

diff -r 359c56728257 mercurial/subrepo.py
--- a/mercurial/subrepo.py	Thu Dec 10 17:01:21 2009 -0600
+++ b/mercurial/subrepo.py	Thu Dec 10 19:48:39 2009 -0600
@@ -175,6 +175,9 @@
         else:
             util.makedirs(root)
             self._repo = hg.repository(r.ui, root, create=True)
+            f = file(os.path.join(root, '.hg', 'hgrc'), 'w')
+            f.write('[paths]\ndefault = %s\n' % state[0])
+            f.close()
         self._repo._subparent = r
         self._repo._subsource = state[0]


-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial mailing list