# HG changeset patch # User Edouard Gomez # Date 2010-03-13 23:28:10 # Node ID c90d923fff6490ce29baf4939a6fea70d1932a1d # Parent b4b16e90712fc93a9601f4cb9dea05abc0ef7de2 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. diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -193,8 +193,11 @@ class hgsubrepo(object): 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): diff --git a/tests/test-subrepo.out b/tests/test-subrepo.out --- a/tests/test-subrepo.out +++ b/tests/test-subrepo.out @@ -263,6 +263,6 @@ committing subrepository nested_absolute 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