subrepo: fix hgrc paths section during subrepo pulling stable
authorEdouard Gomez <ed.gomez@free.fr>
Sun, 14 Mar 2010 00:28:10 +0100
branchstable
changeset 10697 c90d923fff64
parent 10695 b4b16e90712f
child 10698 e930017f9e2a
subrepo: fix hgrc paths section during subrepo pulling There are two bugs in current subrepo ctor: - hgrc paths were using parent repo (ctx._repo) instead of self._repo - it was joined with local extract path, not its source repo path Fixed both bugs using _abssource on self once it is fully initialized. It gets the job done perfectly for pull and push urls.
mercurial/subrepo.py
tests/test-subrepo.out
--- a/mercurial/subrepo.py	Tue Mar 09 12:09:57 2010 +0100
+++ b/mercurial/subrepo.py	Sun Mar 14 00:28:10 2010 +0100
@@ -193,8 +193,11 @@
                 fp.write('%s = %s\n' % (key, value))
                 self._repo.ui.setconfig('paths', key, value)
 
-            defpath = os.path.join(_abssource(ctx._repo), path)
+            defpath = _abssource(self._repo)
+            defpushpath = _abssource(self._repo, True)
             addpathconfig('default', defpath)
+            if defpath != defpushpath:
+                addpathconfig('default-push', defpushpath)
             fp.close()
 
     def dirty(self):
--- a/tests/test-subrepo.out	Tue Mar 09 12:09:57 2010 +0100
+++ b/tests/test-subrepo.out	Sun Mar 14 00:28:10 2010 +0100
@@ -263,6 +263,6 @@
 updating to branch default
 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 [paths]
-default = $HGTMP/test-subrepo/sub/mercurial/main/nested_absolute
+default = $HGTMP/test-subrepo/sub/mercurial/nested_absolute
 [paths]
-default = $HGTMP/test-subrepo/sub/mercurial/main/nested_relative
+default = $HGTMP/test-subrepo/sub/mercurial/main/../nested_relative