[PATCH 4 of 4] subrepo: fix hgrc paths section during subrepo pulling
Edouard Gomez
ed.gomez at free.fr
Thu Mar 11 18:47:57 CST 2010
# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1268353415 -3600
# Node ID eb43e05100d4945e4677e9ec8e5cfbbe59f9968b
# Parent 3b1ab4933c540cd909f0e0b5823a5972e42b653f
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 -r 3b1ab4933c54 -r eb43e05100d4 mercurial/subrepo.py
--- a/mercurial/subrepo.py Fri Mar 12 01:23:35 2010 +0100
+++ b/mercurial/subrepo.py Fri Mar 12 01:23:35 2010 +0100
@@ -181,17 +181,20 @@
self._state = state
r = ctx._repo
root = r.wjoin(path)
+ newrepo = False
if os.path.exists(os.path.join(root, '.hg')):
self._repo = hg.repository(r.ui, root)
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' % os.path.join(
- _abssource(ctx._repo), path))
- f.close()
+ newrepo = True
self._repo._subparent = r
self._repo._subsource = state[0]
+ if newrepo:
+ f = file(os.path.join(root, '.hg', 'hgrc'), 'w')
+ f.write('[paths]\ndefault = %s\ndefault-push = %s' %
+ (_abssource(self._repo), _abssource(self._repo, True)))
+ f.close()
def dirty(self):
r = self._state[1]
More information about the Mercurial-devel
mailing list