# HG changeset patch # User Benoit Boissinot # Date 2010-03-13 16:02:41 # Node ID 97022cef0a20808431c368af2d384c07d36879c0 # Parent 05856e6825219b6316b8e99a8052c8bd35f2a69a # Parent 181cbb23572ee71f27d4238ab71c60f25a87516b merge with stable diff --git a/contrib/mercurial.spec b/contrib/mercurial.spec --- a/contrib/mercurial.spec +++ b/contrib/mercurial.spec @@ -67,7 +67,7 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -%doc CONTRIBUTORS COPYING doc/README doc/hg*.txt doc/hg*.html doc/ja *.cgi contrib/*.fcgi +%doc CONTRIBUTORS COPYING doc/README doc/hg*.txt doc/hg*.html *.cgi contrib/*.fcgi %doc %attr(644,root,root) %{_mandir}/man?/hg* %doc %attr(644,root,root) contrib/*.svg contrib/sample.hgrc %{_sysconfdir}/bash_completion.d/mercurial.sh diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -131,7 +131,7 @@ def _abssource(repo, push=False): source = repo._subsource if source.startswith('/') or '://' in source: return source - parent = _abssource(repo._subparent) + parent = _abssource(repo._subparent, push) if '://' in parent: if parent[-1] == '/': parent = parent[:-1] @@ -177,24 +177,32 @@ class hgsubrepo(object): self._state = state r = ctx._repo root = r.wjoin(path) - if os.path.exists(os.path.join(root, '.hg')): - self._repo = hg.repository(r.ui, root) - else: + create = False + if not os.path.exists(os.path.join(root, '.hg')): + create = True 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() + self._repo = hg.repository(r.ui, root, create=create) self._repo._subparent = r self._repo._subsource = state[0] + if create: + fp = self._repo.opener("hgrc", "w", text=True) + fp.write('[paths]\n') + + def addpathconfig(key, value): + fp.write('%s = %s\n' % (key, value)) + self._repo.ui.setconfig('paths', key, value) + + defpath = os.path.join(_abssource(ctx._repo), path) + addpathconfig('default', defpath) + fp.close() + def dirty(self): r = self._state[1] if r == '': return True w = self._repo[None] - if w.p1() != self._repo[r]: # version checked out changed + if w.p1() != self._repo[r]: # version checked out change return True return w.dirty() # working directory changed diff --git a/tests/test-extension b/tests/test-extension --- a/tests/test-extension +++ b/tests/test-extension @@ -168,12 +168,13 @@ echo > hgext/__init__.py cat > hgext/broken.py < /dev/null -PYTHONPATH="$TMPPYTHONPATH" -export PYTHONPATH +cat > path.py < /dev/null exit 0