Mercurial > public > mercurial-scm > hg-stable
diff hgext/transplant.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 | a6c64211acdb |
children | e51d4aedace9 |
line wrap: on
line diff
--- a/hgext/transplant.py Fri Jul 06 14:12:42 2012 -0500 +++ b/hgext/transplant.py Fri Jul 13 21:46:53 2012 +0200 @@ -139,7 +139,7 @@ continue if pulls: if source != repo: - repo.pull(source, heads=pulls) + repo.pull(source.peer(), heads=pulls) merge.update(repo, pulls[-1], False, False, None) p1, p2 = repo.dirstate.parents() pulls = [] @@ -203,7 +203,7 @@ os.unlink(patchfile) tr.close() if pulls: - repo.pull(source, heads=pulls) + repo.pull(source.peer(), heads=pulls) merge.update(repo, pulls[-1], False, False, None) finally: self.saveseries(revmap, merges) @@ -614,9 +614,9 @@ sourcerepo = opts.get('source') if sourcerepo: - source = hg.peer(ui, opts, ui.expandpath(sourcerepo)) - branches = map(source.lookup, opts.get('branch', ())) - source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, source, + peer = hg.peer(ui, opts, ui.expandpath(sourcerepo)) + branches = map(peer.lookup, opts.get('branch', ())) + source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, peer, onlyheads=branches, force=True) else: source = repo