# HG changeset patch # User Benoit Boissinot # Date 1268495092 -3600 # Node ID b7e528212828b38c788cf8363282c9b70d7650c1 # Parent 4c50a90b90fc912ab007555a6b93fb87baa0ca11# Parent 9602fc4e6914c9cf272c0b1b0173b410ca9282f4 merge with stable diff -r 9602fc4e6914 -r b7e528212828 mercurial/subrepo.py --- a/mercurial/subrepo.py Sat Mar 13 16:19:28 2010 +0100 +++ b/mercurial/subrepo.py Sat Mar 13 16:44:52 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