Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/subrepo.py @ 17191:5884812686f7
peer: introduce peer methods to prepare for peer classes
This introduces a peer method into all repository classes, which currently
simply returns self. It also changes hg.repository so it now raises an
exception if the supplied paths does not resolve to a localrepo or descendant.
Finally, all call sites are changed to use the peer and local methods as
appropriate, where peer is used whenever the code is dealing with a remote
repository (even if it's on local disk).
author | Sune Foldager <cryo@cyanite.org> |
---|---|
date | Fri, 13 Jul 2012 21:46:53 +0200 |
parents | f7152a0d90df |
children | e7cfe3587ea4 cb12d3ce5607 |
comparison
equal
deleted
inserted
replaced
17190:d99d0b559084 | 17191:5884812686f7 |
---|---|
501 if len(self._repo) == 0: | 501 if len(self._repo) == 0: |
502 self._repo.ui.status(_('cloning subrepo %s from %s\n') | 502 self._repo.ui.status(_('cloning subrepo %s from %s\n') |
503 % (subrelpath(self), srcurl)) | 503 % (subrelpath(self), srcurl)) |
504 parentrepo = self._repo._subparent | 504 parentrepo = self._repo._subparent |
505 shutil.rmtree(self._repo.path) | 505 shutil.rmtree(self._repo.path) |
506 other, self._repo = hg.clone(self._repo._subparent.ui, {}, | 506 other, cloned = hg.clone(self._repo._subparent.ui, {}, |
507 other, self._repo.root, | 507 other, self._repo.root, |
508 update=False) | 508 update=False) |
509 self._repo = cloned.local() | |
509 self._initrepo(parentrepo, source, create=True) | 510 self._initrepo(parentrepo, source, create=True) |
510 else: | 511 else: |
511 self._repo.ui.status(_('pulling subrepo %s from %s\n') | 512 self._repo.ui.status(_('pulling subrepo %s from %s\n') |
512 % (subrelpath(self), srcurl)) | 513 % (subrelpath(self), srcurl)) |
513 self._repo.pull(other) | 514 self._repo.pull(other) |