##// END OF EJS Templates
hg: change various repository() users to use peer() where appropriate...
Matt Mackall -
r14556:517e1d88 default
parent child Browse files
Show More
@@ -112,7 +112,7 b' class mercurial_sink(converter_sink):'
112 self.after()
112 self.after()
113 for pbranch, heads in missings.iteritems():
113 for pbranch, heads in missings.iteritems():
114 pbranchpath = os.path.join(self.path, pbranch)
114 pbranchpath = os.path.join(self.path, pbranch)
115 prepo = hg.repository(self.ui, pbranchpath)
115 prepo = hg.peer(self.ui, {}, pbranchpath)
116 self.ui.note(_('pulling from %s into %s\n') % (pbranch, branch))
116 self.ui.note(_('pulling from %s into %s\n') % (pbranch, branch))
117 self.repo.pull(prepo, [prepo.lookup(h) for h in heads])
117 self.repo.pull(prepo, [prepo.lookup(h) for h in heads])
118 self.before()
118 self.before()
@@ -63,8 +63,7 b" def fetch(ui, repo, source='default', **"
63 raise util.Abort(_('multiple heads in this branch '
63 raise util.Abort(_('multiple heads in this branch '
64 '(use "hg heads ." and "hg merge" to merge)'))
64 '(use "hg heads ." and "hg merge" to merge)'))
65
65
66 other = hg.repository(hg.remoteui(repo, opts),
66 other = hg.peer(repo, opts, ui.expandpath(source))
67 ui.expandpath(source))
68 ui.status(_('pulling from %s\n') %
67 ui.status(_('pulling from %s\n') %
69 util.hidepassword(ui.expandpath(source)))
68 util.hidepassword(ui.expandpath(source)))
70 revs = None
69 revs = None
@@ -276,7 +276,7 b' def patchbomb(ui, repo, *revs, **opts):'
276 dest = ui.expandpath(dest or 'default-push', dest or 'default')
276 dest = ui.expandpath(dest or 'default-push', dest or 'default')
277 dest, branches = hg.parseurl(dest)
277 dest, branches = hg.parseurl(dest)
278 revs, checkout = hg.addbranchrevs(repo, repo, branches, revs)
278 revs, checkout = hg.addbranchrevs(repo, repo, branches, revs)
279 other = hg.repository(hg.remoteui(repo, opts), dest)
279 other = hg.peer(repo, opts, dest)
280 ui.status(_('comparing with %s\n') % util.hidepassword(dest))
280 ui.status(_('comparing with %s\n') % util.hidepassword(dest))
281 common, _anyinc, _heads = discovery.findcommonincoming(repo, other)
281 common, _anyinc, _heads = discovery.findcommonincoming(repo, other)
282 nodes = revs and map(repo.lookup, revs) or revs
282 nodes = revs and map(repo.lookup, revs) or revs
@@ -38,9 +38,8 b' def relink(ui, repo, origin=None, **opts'
38 """
38 """
39 if not hasattr(util, 'samefile') or not hasattr(util, 'samedevice'):
39 if not hasattr(util, 'samefile') or not hasattr(util, 'samedevice'):
40 raise util.Abort(_('hardlinks are not supported on this system'))
40 raise util.Abort(_('hardlinks are not supported on this system'))
41 src = hg.repository(hg.remoteui(repo, opts),
41 src = hg.repository(ui, ui.expandpath(origin or 'default-relink',
42 ui.expandpath(origin or 'default-relink',
42 origin or 'default'))
43 origin or 'default'))
44 if not src.local():
43 if not src.local():
45 raise util.Abort(_('must specify local origin repository'))
44 raise util.Abort(_('must specify local origin repository'))
46 ui.status(_('relinking %s to %s\n') % (src.store.path, repo.store.path))
45 ui.status(_('relinking %s to %s\n') % (src.store.path, repo.store.path))
@@ -561,7 +561,7 b' def transplant(ui, repo, *revs, **opts):'
561
561
562 sourcerepo = opts.get('source')
562 sourcerepo = opts.get('source')
563 if sourcerepo:
563 if sourcerepo:
564 source = hg.repository(ui, ui.expandpath(sourcerepo))
564 source = hg.peer(ui, opts, ui.expandpath(sourcerepo))
565 branches = map(source.lookup, opts.get('branch', ()))
565 branches = map(source.lookup, opts.get('branch', ()))
566 source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, source,
566 source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, source,
567 onlyheads=branches, force=True)
567 onlyheads=branches, force=True)
@@ -891,7 +891,7 b' def bundle(ui, repo, fname, dest=None, *'
891 else:
891 else:
892 dest = ui.expandpath(dest or 'default-push', dest or 'default')
892 dest = ui.expandpath(dest or 'default-push', dest or 'default')
893 dest, branches = hg.parseurl(dest, opts.get('branch'))
893 dest, branches = hg.parseurl(dest, opts.get('branch'))
894 other = hg.repository(hg.remoteui(repo, opts), dest)
894 other = hg.peer(repo, opts, dest)
895 revs, checkout = hg.addbranchrevs(repo, other, branches, revs)
895 revs, checkout = hg.addbranchrevs(repo, other, branches, revs)
896 heads = revs and map(repo.lookup, revs) or revs
896 heads = revs and map(repo.lookup, revs) or revs
897 common, outheads = discovery.findcommonoutgoing(repo, other,
897 common, outheads = discovery.findcommonoutgoing(repo, other,
@@ -1542,7 +1542,7 b' def debugdate(ui, date, range=None, **op'
1542 def debugdiscovery(ui, repo, remoteurl="default", **opts):
1542 def debugdiscovery(ui, repo, remoteurl="default", **opts):
1543 """runs the changeset discovery protocol in isolation"""
1543 """runs the changeset discovery protocol in isolation"""
1544 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), opts.get('branch'))
1544 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), opts.get('branch'))
1545 remote = hg.repository(hg.remoteui(repo, opts), remoteurl)
1545 remote = hg.peer(repo, opts, remoteurl)
1546 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
1546 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
1547
1547
1548 # make sure tests are repeatable
1548 # make sure tests are repeatable
@@ -1629,7 +1629,7 b' def debuggetbundle(ui, repopath, bundlep'
1629 Every ID must be a full-length hex node id string. Saves the bundle to the
1629 Every ID must be a full-length hex node id string. Saves the bundle to the
1630 given file.
1630 given file.
1631 """
1631 """
1632 repo = hg.repository(ui, repopath)
1632 repo = hg.peer(ui, opts, repopath)
1633 if not repo.capable('getbundle'):
1633 if not repo.capable('getbundle'):
1634 raise util.Abort("getbundle() not supported by target repository")
1634 raise util.Abort("getbundle() not supported by target repository")
1635 args = {}
1635 args = {}
@@ -1804,14 +1804,14 b' def debugknown(ui, repopath, *ids, **opt'
1804 Every ID must be a full-length hex node id string. Returns a list of 0s and 1s
1804 Every ID must be a full-length hex node id string. Returns a list of 0s and 1s
1805 indicating unknown/known.
1805 indicating unknown/known.
1806 """
1806 """
1807 repo = hg.repository(ui, repopath)
1807 repo = hg.peer(ui, opts, repopath)
1808 if not repo.capable('known'):
1808 if not repo.capable('known'):
1809 raise util.Abort("known() not supported by target repository")
1809 raise util.Abort("known() not supported by target repository")
1810 flags = repo.known([bin(s) for s in ids])
1810 flags = repo.known([bin(s) for s in ids])
1811 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1811 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1812
1812
1813 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'))
1813 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'))
1814 def debugpushkey(ui, repopath, namespace, *keyinfo):
1814 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts):
1815 '''access the pushkey key/value protocol
1815 '''access the pushkey key/value protocol
1816
1816
1817 With two args, list the keys in the given namespace.
1817 With two args, list the keys in the given namespace.
@@ -1820,7 +1820,7 b' def debugpushkey(ui, repopath, namespace'
1820 Reports success or failure.
1820 Reports success or failure.
1821 '''
1821 '''
1822
1822
1823 target = hg.repository(ui, repopath)
1823 target = hg.peer(ui, {}, repopath)
1824 if keyinfo:
1824 if keyinfo:
1825 key, old, new = keyinfo
1825 key, old, new = keyinfo
1826 r = target.pushkey(namespace, key, old, new)
1826 r = target.pushkey(namespace, key, old, new)
@@ -2117,7 +2117,7 b' def debugwalk(ui, repo, *pats, **opts):'
2117 ] + remoteopts,
2117 ] + remoteopts,
2118 _('REPO [OPTIONS]... [ONE [TWO]]'))
2118 _('REPO [OPTIONS]... [ONE [TWO]]'))
2119 def debugwireargs(ui, repopath, *vals, **opts):
2119 def debugwireargs(ui, repopath, *vals, **opts):
2120 repo = hg.repository(hg.remoteui(ui, opts), repopath)
2120 repo = hg.peer(ui, opts, repopath)
2121 for opt in remoteopts:
2121 for opt in remoteopts:
2122 del opts[opt[1]]
2122 del opts[opt[1]]
2123 args = {}
2123 args = {}
@@ -2914,7 +2914,7 b' def identify(ui, repo, source=None, rev='
2914
2914
2915 if source:
2915 if source:
2916 source, branches = hg.parseurl(ui.expandpath(source))
2916 source, branches = hg.parseurl(ui.expandpath(source))
2917 repo = hg.repository(ui, source)
2917 repo = hg.peer(ui, {}, source)
2918 revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
2918 revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
2919
2919
2920 if not repo.local():
2920 if not repo.local():
@@ -3199,7 +3199,7 b' def incoming(ui, repo, source="default",'
3199 if opts.get('bookmarks'):
3199 if opts.get('bookmarks'):
3200 source, branches = hg.parseurl(ui.expandpath(source),
3200 source, branches = hg.parseurl(ui.expandpath(source),
3201 opts.get('branch'))
3201 opts.get('branch'))
3202 other = hg.repository(hg.remoteui(repo, opts), source)
3202 other = hg.peer(repo, opts, source)
3203 if 'bookmarks' not in other.listkeys('namespaces'):
3203 if 'bookmarks' not in other.listkeys('namespaces'):
3204 ui.warn(_("remote doesn't support bookmarks\n"))
3204 ui.warn(_("remote doesn't support bookmarks\n"))
3205 return 0
3205 return 0
@@ -3227,7 +3227,7 b' def init(ui, dest=".", **opts):'
3227
3227
3228 Returns 0 on success.
3228 Returns 0 on success.
3229 """
3229 """
3230 hg.repository(hg.remoteui(ui, opts), ui.expandpath(dest), create=True)
3230 hg.peer(ui, opts, ui.expandpath(dest), create=True)
3231
3231
3232 @command('locate',
3232 @command('locate',
3233 [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
3233 [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
@@ -3561,7 +3561,7 b' def outgoing(ui, repo, dest=None, **opts'
3561 if opts.get('bookmarks'):
3561 if opts.get('bookmarks'):
3562 dest = ui.expandpath(dest or 'default-push', dest or 'default')
3562 dest = ui.expandpath(dest or 'default-push', dest or 'default')
3563 dest, branches = hg.parseurl(dest, opts.get('branch'))
3563 dest, branches = hg.parseurl(dest, opts.get('branch'))
3564 other = hg.repository(hg.remoteui(repo, opts), dest)
3564 other = hg.peer(repo, opts, dest)
3565 if 'bookmarks' not in other.listkeys('namespaces'):
3565 if 'bookmarks' not in other.listkeys('namespaces'):
3566 ui.warn(_("remote doesn't support bookmarks\n"))
3566 ui.warn(_("remote doesn't support bookmarks\n"))
3567 return 0
3567 return 0
@@ -3713,7 +3713,7 b' def pull(ui, repo, source="default", **o'
3713 Returns 0 on success, 1 if an update had unresolved files.
3713 Returns 0 on success, 1 if an update had unresolved files.
3714 """
3714 """
3715 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
3715 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
3716 other = hg.repository(hg.remoteui(repo, opts), source)
3716 other = hg.peer(repo, opts, source)
3717 ui.status(_('pulling from %s\n') % util.hidepassword(source))
3717 ui.status(_('pulling from %s\n') % util.hidepassword(source))
3718 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
3718 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
3719
3719
@@ -3810,7 +3810,7 b' def push(ui, repo, dest=None, **opts):'
3810 dest, branches = hg.parseurl(dest, opts.get('branch'))
3810 dest, branches = hg.parseurl(dest, opts.get('branch'))
3811 ui.status(_('pushing to %s\n') % util.hidepassword(dest))
3811 ui.status(_('pushing to %s\n') % util.hidepassword(dest))
3812 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
3812 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
3813 other = hg.repository(hg.remoteui(repo, opts), dest)
3813 other = hg.peer(repo, opts, dest)
3814 if revs:
3814 if revs:
3815 revs = [repo.lookup(rev) for rev in revs]
3815 revs = [repo.lookup(rev) for rev in revs]
3816
3816
@@ -4742,7 +4742,7 b' def summary(ui, repo, **opts):'
4742 if opts.get('remote'):
4742 if opts.get('remote'):
4743 t = []
4743 t = []
4744 source, branches = hg.parseurl(ui.expandpath('default'))
4744 source, branches = hg.parseurl(ui.expandpath('default'))
4745 other = hg.repository(hg.remoteui(repo, {}), source)
4745 other = hg.peer(repo, {}, source)
4746 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
4746 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
4747 ui.debug('comparing with %s\n' % util.hidepassword(source))
4747 ui.debug('comparing with %s\n' % util.hidepassword(source))
4748 repo.ui.pushbuffer()
4748 repo.ui.pushbuffer()
@@ -4755,7 +4755,7 b' def summary(ui, repo, **opts):'
4755 dest, branches = hg.parseurl(ui.expandpath('default-push', 'default'))
4755 dest, branches = hg.parseurl(ui.expandpath('default-push', 'default'))
4756 revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
4756 revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
4757 if source != dest:
4757 if source != dest:
4758 other = hg.repository(hg.remoteui(repo, {}), dest)
4758 other = hg.peer(repo, {}, dest)
4759 commoninc = None
4759 commoninc = None
4760 ui.debug('comparing with %s\n' % util.hidepassword(dest))
4760 ui.debug('comparing with %s\n' % util.hidepassword(dest))
4761 repo.ui.pushbuffer()
4761 repo.ui.pushbuffer()
@@ -428,7 +428,7 b' def _incoming(displaychlist, subreporecu'
428 and is supposed to contain only code that can't be unified.
428 and is supposed to contain only code that can't be unified.
429 """
429 """
430 source, branches = parseurl(ui.expandpath(source), opts.get('branch'))
430 source, branches = parseurl(ui.expandpath(source), opts.get('branch'))
431 other = repository(remoteui(repo, opts), source)
431 other = peer(repo, opts, source)
432 ui.status(_('comparing with %s\n') % util.hidepassword(source))
432 ui.status(_('comparing with %s\n') % util.hidepassword(source))
433 revs, checkout = addbranchrevs(repo, other, branches, opts.get('rev'))
433 revs, checkout = addbranchrevs(repo, other, branches, opts.get('rev'))
434
434
@@ -486,7 +486,7 b' def _outgoing(ui, repo, dest, opts):'
486 if revs:
486 if revs:
487 revs = [repo.lookup(rev) for rev in revs]
487 revs = [repo.lookup(rev) for rev in revs]
488
488
489 other = repository(remoteui(repo, opts), dest)
489 other = peer(repo, opts, dest)
490 common, outheads = discovery.findcommonoutgoing(repo, other, revs,
490 common, outheads = discovery.findcommonoutgoing(repo, other, revs,
491 force=opts.get('force'))
491 force=opts.get('force'))
492 o = repo.changelog.findmissing(common, outheads)
492 o = repo.changelog.findmissing(common, outheads)
@@ -599,7 +599,7 b' def outgoing(repo, subset, x):'
599 revs, checkout = hg.addbranchrevs(repo, repo, branches, [])
599 revs, checkout = hg.addbranchrevs(repo, repo, branches, [])
600 if revs:
600 if revs:
601 revs = [repo.lookup(rev) for rev in revs]
601 revs = [repo.lookup(rev) for rev in revs]
602 other = hg.repository(hg.remoteui(repo, {}), dest)
602 other = hg.peer(repo, {}, dest)
603 repo.ui.pushbuffer()
603 repo.ui.pushbuffer()
604 common, outheads = discovery.findcommonoutgoing(repo, other, onlyheads=revs)
604 common, outheads = discovery.findcommonoutgoing(repo, other, onlyheads=revs)
605 repo.ui.popbuffer()
605 repo.ui.popbuffer()
@@ -437,7 +437,7 b' class hgsubrepo(abstractsubrepo):'
437 if revision not in self._repo:
437 if revision not in self._repo:
438 self._repo._subsource = source
438 self._repo._subsource = source
439 srcurl = _abssource(self._repo)
439 srcurl = _abssource(self._repo)
440 other = hg.repository(self._repo.ui, srcurl)
440 other = hg.peer(self._repo.ui, {}, srcurl)
441 if len(self._repo) == 0:
441 if len(self._repo) == 0:
442 self._repo.ui.status(_('cloning subrepo %s from %s\n')
442 self._repo.ui.status(_('cloning subrepo %s from %s\n')
443 % (subrelpath(self), srcurl))
443 % (subrelpath(self), srcurl))
@@ -495,7 +495,7 b' class hgsubrepo(abstractsubrepo):'
495 dsturl = _abssource(self._repo, True)
495 dsturl = _abssource(self._repo, True)
496 self._repo.ui.status(_('pushing subrepo %s to %s\n') %
496 self._repo.ui.status(_('pushing subrepo %s to %s\n') %
497 (subrelpath(self), dsturl))
497 (subrelpath(self), dsturl))
498 other = hg.repository(self._repo.ui, dsturl)
498 other = hg.peer(self._repo.ui, {}, dsturl)
499 return self._repo.push(other, force)
499 return self._repo.push(other, force)
500
500
501 def outgoing(self, ui, dest, opts):
501 def outgoing(self, ui, dest, opts):
General Comments 0
You need to be logged in to leave comments. Login now