[issue2026] cloning subrepos doesnt set default in hgrc

SaintGermain bugs at mercurial.selenic.com
Sat Feb 6 07:55:45 CST 2010


New submission from SaintGermain <saintger at gmail.com>:

Following discussion:
http://www.selenic.com/pipermail/mercurial/2009-December/029274.html

It seems that the current solution in 1.4.3 doesn't work.

Test Case:
cd /tmp
hg init /tmp/nested_absolute
echo test > /tmp/nested_absolute/foo
hg -R /tmp/nested_absolute add
hg -R /tmp/nested_absolute ci -mtest
hg init nested_relative
echo test2 > nested_relative/foo2
hg -R nested_relative add
hg -R nested_relative ci -mtest2
hg init main
echo nested_relative = ../nested_relative > main/.hgsub
echo nested_absolute = /tmp/nested_absolute >> main/.hgsub
hg -R main add
hg -R main ci -m "add subrepos"
hg clone main main2
cat main2/nested_absolute/.hg/hgrc main2/nested_relative/.hg/hgrc

I got as results:
[paths]
default = 
[paths]
default =

With this patch on version 1.4.3:
--- subrepo.py.old	2010-02-06 00:07:55.000000000 +0100
+++ subrepo.py	2010-02-06 14:28:36.000000000 +0100
@@ -161,7 +161,8 @@
             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.write('[paths]\ndefault = %s\n' % os.path.join(
+                _abssource(ctx._repo),path))
             f.close()
         self._repo._subparent = r
         self._repo._subsource = state[0]

I got as results:
[paths]
default = /tmp/main/nested_absolute
[paths]
default = /tmp/main/nested_relative

It seems logical for me that hgrc from main2 make reference to working
directories of main1 instead of referencing the absolute URL in main/.hgsub.

----------
files: subrepo.patch
messages: 11618
nosy: SaintGermain
priority: bug
status: testing
title: cloning subrepos doesnt set default in hgrc
topic: subrepositories

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2026>
____________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subrepo.patch
Type: text/x-diff
Size: 554 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100206/ad9b492c/attachment.patch>


More information about the Mercurial-devel mailing list