Issue2026

Title cloning subrepos doesnt set default in hgrc
Priority bug Status testing
Superseder Nosy List SaintGermain, danchr, pmezard, tonfa
Assigned To Topics subrepositories

Created on 2010-02-06.13:55:45 by SaintGermain, last changed 2010-02-07.15:47:31 by pmezard.

Files
File name Uploaded Type Edit Remove
subrepo.patch SaintGermain, 2010-02-06.13:55:45 text/x-diff
Messages
msg11638 (view) Author: pmezard Date: 2010-02-07.15:47:30
In http://hg.intevation.org/mercurial/crew/rev/e1401c74572f
msg11620 (view) Author: SaintGermain Date: 2010-02-06.15:03:28
Ok I've tried with the tip instead of 1.4.3 and it somehow works better, but
still some bug.

New Test Case:
mkdir mercurial mercurial2
cd mercurial
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"
cd ..
hg clone mercurial/main mercurial2/main
cat mercurial2/main/nested_absolute/.hg/hgrc
mercurial2/main/nested_relative/.hg/hgrc

I got as result:
[paths]
default = /tmp/nested_absolute
[paths]
default = ../nested_relative

The relative subrepos defaut path is not correctly set (should be
../mercurial/nested_relative or /tmp/mercurial/nested_relative). And somehow
I don't think that this is logical to reference the absolute URL in the
originial repo instead of referencing the working copy.

I will make another patch (on the tip this time !) and send it to the devel
mailing-list
msg11618 (view) Author: SaintGermain Date: 2010-02-06.13:55:45
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.
History
Date User Action Args
2010-02-07 15:47:31pmezardsetstatus: chatting -> testing
nosy: + pmezard
messages: + msg11638
2010-02-06 18:35:58tonfasetstatus: testing -> chatting
nosy: tonfa, danchr, SaintGermain
2010-02-06 18:35:34tonfasetnosy: + tonfa
2010-02-06 15:03:29SaintGermainsetnosy: danchr, SaintGermain
messages: + msg11620
2010-02-06 14:46:47danchrsetnosy: + danchr
2010-02-06 13:55:45SaintGermaincreate