comparison mercurial/commands.py @ 11273:d1908cb95a82

remoteui: move from cmdutil to hg
author Matt Mackall <mpm@selenic.com>
date Tue, 01 Jun 2010 11:18:57 -0500
parents 39a7f69a0a9a
children f28b58e35768
comparison
equal deleted inserted replaced
11272:e8a66a40474d 11273:d1908cb95a82
592 seen[p] = 1 592 seen[p] = 1
593 visit.append(p) 593 visit.append(p)
594 else: 594 else:
595 dest = ui.expandpath(dest or 'default-push', dest or 'default') 595 dest = ui.expandpath(dest or 'default-push', dest or 'default')
596 dest, branches = hg.parseurl(dest, opts.get('branch')) 596 dest, branches = hg.parseurl(dest, opts.get('branch'))
597 other = hg.repository(cmdutil.remoteui(repo, opts), dest) 597 other = hg.repository(hg.remoteui(repo, opts), dest)
598 revs, checkout = hg.addbranchrevs(repo, other, branches, revs) 598 revs, checkout = hg.addbranchrevs(repo, other, branches, revs)
599 o = repo.findoutgoing(other, force=opts.get('force')) 599 o = repo.findoutgoing(other, force=opts.get('force'))
600 600
601 if not o: 601 if not o:
602 ui.status(_("no changes found\n")) 602 ui.status(_("no changes found\n"))
709 Returns 0 on success. 709 Returns 0 on success.
710 """ 710 """
711 if opts.get('noupdate') and opts.get('updaterev'): 711 if opts.get('noupdate') and opts.get('updaterev'):
712 raise util.Abort(_("cannot specify both --noupdate and --updaterev")) 712 raise util.Abort(_("cannot specify both --noupdate and --updaterev"))
713 713
714 r = hg.clone(cmdutil.remoteui(ui, opts), source, dest, 714 r = hg.clone(hg.remoteui(ui, opts), source, dest,
715 pull=opts.get('pull'), 715 pull=opts.get('pull'),
716 stream=opts.get('uncompressed'), 716 stream=opts.get('uncompressed'),
717 rev=opts.get('rev'), 717 rev=opts.get('rev'),
718 update=opts.get('updaterev') or not opts.get('noupdate'), 718 update=opts.get('updaterev') or not opts.get('noupdate'),
719 branch=opts.get('branch')) 719 branch=opts.get('branch'))
2069 2069
2070 Returns 0 if there are incoming changes, 1 otherwise. 2070 Returns 0 if there are incoming changes, 1 otherwise.
2071 """ 2071 """
2072 limit = cmdutil.loglimit(opts) 2072 limit = cmdutil.loglimit(opts)
2073 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) 2073 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
2074 other = hg.repository(cmdutil.remoteui(repo, opts), source) 2074 other = hg.repository(hg.remoteui(repo, opts), source)
2075 ui.status(_('comparing with %s\n') % url.hidepassword(source)) 2075 ui.status(_('comparing with %s\n') % url.hidepassword(source))
2076 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev')) 2076 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
2077 if revs: 2077 if revs:
2078 revs = [other.lookup(rev) for rev in revs] 2078 revs = [other.lookup(rev) for rev in revs]
2079 common, incoming, rheads = repo.findcommonincoming(other, heads=revs, 2079 common, incoming, rheads = repo.findcommonincoming(other, heads=revs,
2139 It is possible to specify an ``ssh://`` URL as the destination. 2139 It is possible to specify an ``ssh://`` URL as the destination.
2140 See :hg:`help urls` for more information. 2140 See :hg:`help urls` for more information.
2141 2141
2142 Returns 0 on success. 2142 Returns 0 on success.
2143 """ 2143 """
2144 hg.repository(cmdutil.remoteui(ui, opts), dest, create=1) 2144 hg.repository(hg.remoteui(ui, opts), dest, create=1)
2145 2145
2146 def locate(ui, repo, *pats, **opts): 2146 def locate(ui, repo, *pats, **opts):
2147 """locate files matching specific patterns 2147 """locate files matching specific patterns
2148 2148
2149 Print files under Mercurial control in the working directory whose 2149 Print files under Mercurial control in the working directory whose
2377 dest, branches = hg.parseurl(dest, opts.get('branch')) 2377 dest, branches = hg.parseurl(dest, opts.get('branch'))
2378 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) 2378 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
2379 if revs: 2379 if revs:
2380 revs = [repo.lookup(rev) for rev in revs] 2380 revs = [repo.lookup(rev) for rev in revs]
2381 2381
2382 other = hg.repository(cmdutil.remoteui(repo, opts), dest) 2382 other = hg.repository(hg.remoteui(repo, opts), dest)
2383 ui.status(_('comparing with %s\n') % url.hidepassword(dest)) 2383 ui.status(_('comparing with %s\n') % url.hidepassword(dest))
2384 o = repo.findoutgoing(other, force=opts.get('force')) 2384 o = repo.findoutgoing(other, force=opts.get('force'))
2385 if not o: 2385 if not o:
2386 ui.status(_("no changes found\n")) 2386 ui.status(_("no changes found\n"))
2387 return 1 2387 return 1
2509 See :hg:`help urls` for more information. 2509 See :hg:`help urls` for more information.
2510 2510
2511 Returns 0 on success, 1 if an update had unresolved files. 2511 Returns 0 on success, 1 if an update had unresolved files.
2512 """ 2512 """
2513 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) 2513 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
2514 other = hg.repository(cmdutil.remoteui(repo, opts), source) 2514 other = hg.repository(hg.remoteui(repo, opts), source)
2515 ui.status(_('pulling from %s\n') % url.hidepassword(source)) 2515 ui.status(_('pulling from %s\n') % url.hidepassword(source))
2516 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev')) 2516 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
2517 if revs: 2517 if revs:
2518 try: 2518 try:
2519 revs = [other.lookup(rev) for rev in revs] 2519 revs = [other.lookup(rev) for rev in revs]
2557 Returns 0 if push was successful, 1 if nothing to push. 2557 Returns 0 if push was successful, 1 if nothing to push.
2558 """ 2558 """
2559 dest = ui.expandpath(dest or 'default-push', dest or 'default') 2559 dest = ui.expandpath(dest or 'default-push', dest or 'default')
2560 dest, branches = hg.parseurl(dest, opts.get('branch')) 2560 dest, branches = hg.parseurl(dest, opts.get('branch'))
2561 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) 2561 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
2562 other = hg.repository(cmdutil.remoteui(repo, opts), dest) 2562 other = hg.repository(hg.remoteui(repo, opts), dest)
2563 ui.status(_('pushing to %s\n') % url.hidepassword(dest)) 2563 ui.status(_('pushing to %s\n') % url.hidepassword(dest))
2564 if revs: 2564 if revs:
2565 revs = [repo.lookup(rev) for rev in revs] 2565 revs = [repo.lookup(rev) for rev in revs]
2566 2566
2567 # push subrepos depth-first for coherent ordering 2567 # push subrepos depth-first for coherent ordering
3304 (new, len(bheads))) 3304 (new, len(bheads)))
3305 3305
3306 if opts.get('remote'): 3306 if opts.get('remote'):
3307 t = [] 3307 t = []
3308 source, branches = hg.parseurl(ui.expandpath('default')) 3308 source, branches = hg.parseurl(ui.expandpath('default'))
3309 other = hg.repository(cmdutil.remoteui(repo, {}), source) 3309 other = hg.repository(hg.remoteui(repo, {}), source)
3310 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev')) 3310 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
3311 ui.debug('comparing with %s\n' % url.hidepassword(source)) 3311 ui.debug('comparing with %s\n' % url.hidepassword(source))
3312 repo.ui.pushbuffer() 3312 repo.ui.pushbuffer()
3313 common, incoming, rheads = repo.findcommonincoming(other) 3313 common, incoming, rheads = repo.findcommonincoming(other)
3314 repo.ui.popbuffer() 3314 repo.ui.popbuffer()
3315 if incoming: 3315 if incoming:
3316 t.append(_('1 or more incoming')) 3316 t.append(_('1 or more incoming'))
3317 3317
3318 dest, branches = hg.parseurl(ui.expandpath('default-push', 'default')) 3318 dest, branches = hg.parseurl(ui.expandpath('default-push', 'default'))
3319 revs, checkout = hg.addbranchrevs(repo, repo, branches, None) 3319 revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
3320 other = hg.repository(cmdutil.remoteui(repo, {}), dest) 3320 other = hg.repository(hg.remoteui(repo, {}), dest)
3321 ui.debug('comparing with %s\n' % url.hidepassword(dest)) 3321 ui.debug('comparing with %s\n' % url.hidepassword(dest))
3322 repo.ui.pushbuffer() 3322 repo.ui.pushbuffer()
3323 o = repo.findoutgoing(other) 3323 o = repo.findoutgoing(other)
3324 repo.ui.popbuffer() 3324 repo.ui.popbuffer()
3325 o = repo.changelog.nodesbetween(o, None)[0] 3325 o = repo.changelog.nodesbetween(o, None)[0]