Mercurial > hg
changeset 10670:97022cef0a20
merge with stable
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sat, 13 Mar 2010 17:02:41 +0100 |
parents | 05856e682521 (current diff) 181cbb23572e (diff) |
children | 001ffc2b3d22 |
files | mercurial/subrepo.py |
diffstat | 3 files changed, 27 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/mercurial.spec Fri Mar 12 01:23:35 2010 +0100 +++ b/contrib/mercurial.spec Sat Mar 13 17:02:41 2010 +0100 @@ -67,7 +67,7 @@ %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
--- a/mercurial/subrepo.py Fri Mar 12 01:23:35 2010 +0100 +++ b/mercurial/subrepo.py Sat Mar 13 17:02:41 2010 +0100 @@ -131,7 +131,7 @@ 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 @@ 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
--- a/tests/test-extension Fri Mar 12 01:23:35 2010 +0100 +++ b/tests/test-extension Sat Mar 13 17:02:41 2010 +0100 @@ -168,12 +168,13 @@ cat > hgext/broken.py <<EOF "broken extension' EOF -TMPPYTHONPATH="$PYTHONPATH" -PYTHONPATH="`pwd`:$PYTHONPATH" -export PYTHONPATH -hg help broken -hg help foo > /dev/null -PYTHONPATH="$TMPPYTHONPATH" -export PYTHONPATH +cat > path.py <<EOF +import os, sys +sys.path.insert(0, os.environ['HGEXTPATH']) +EOF +HGEXTPATH=`pwd` +export HGEXTPATH +hg --config extensions.path=./path.py help broken +hg --config extensions.path=./path.py help foo > /dev/null exit 0