##// END OF EJS Templates
outgoing: unify common graphlog.outgoing and hg.outgoing code
Nicolas Dumazet -
r12735:8888e56a default
parent child Browse files
Show More
@@ -18,7 +18,7 b' from mercurial.commands import templateo'
18 from mercurial.i18n import _
18 from mercurial.i18n import _
19 from mercurial.node import nullrev
19 from mercurial.node import nullrev
20 from mercurial import cmdutil, commands, extensions
20 from mercurial import cmdutil, commands, extensions
21 from mercurial import hg, url, util, graphmod, discovery
21 from mercurial import hg, util, graphmod
22
22
23 ASCIIDATA = 'ASC'
23 ASCIIDATA = 'ASC'
24
24
@@ -280,19 +280,10 b' def goutgoing(ui, repo, dest=None, **opt'
280 """
280 """
281
281
282 check_unsupported_flags(opts)
282 check_unsupported_flags(opts)
283 dest = ui.expandpath(dest or 'default-push', dest or 'default')
283 o = hg._outgoing(ui, repo, dest, opts)
284 dest, branches = hg.parseurl(dest, opts.get('branch'))
284 if o is None:
285 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
286 other = hg.repository(hg.remoteui(ui, opts), dest)
287 if revs:
288 revs = [repo.lookup(rev) for rev in revs]
289 ui.status(_('comparing with %s\n') % url.hidepassword(dest))
290 o = discovery.findoutgoing(repo, other, force=opts.get('force'))
291 if not o:
292 ui.status(_("no changes found\n"))
293 return
285 return
294
286
295 o = repo.changelog.nodesbetween(o, revs)[0]
296 revdag = graphrevs(repo, o, opts)
287 revdag = graphrevs(repo, o, opts)
297 displayer = show_changeset(ui, repo, opts, buffered=True)
288 displayer = show_changeset(ui, repo, opts, buffered=True)
298 showparents = [ctx.node() for ctx in repo[None].parents()]
289 showparents = [ctx.node() for ctx in repo[None].parents()]
@@ -471,6 +471,22 b' def incoming(ui, repo, source, opts):'
471 displayer.show(other[n])
471 displayer.show(other[n])
472 return _incoming(display, subreporecurse, ui, repo, source, opts)
472 return _incoming(display, subreporecurse, ui, repo, source, opts)
473
473
474 def _outgoing(ui, repo, dest, opts):
475 dest = ui.expandpath(dest or 'default-push', dest or 'default')
476 dest, branches = parseurl(dest, opts.get('branch'))
477 revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev'))
478 if revs:
479 revs = [repo.lookup(rev) for rev in revs]
480
481 other = repository(remoteui(repo, opts), dest)
482 ui.status(_('comparing with %s\n') % url.hidepassword(dest))
483 o = discovery.findoutgoing(repo, other, force=opts.get('force'))
484 if not o:
485 ui.status(_("no changes found\n"))
486 return None
487
488 return repo.changelog.nodesbetween(o, revs)[0]
489
474 def outgoing(ui, repo, dest, opts):
490 def outgoing(ui, repo, dest, opts):
475 def recurse():
491 def recurse():
476 ret = 1
492 ret = 1
@@ -482,20 +498,10 b' def outgoing(ui, repo, dest, opts):'
482 return ret
498 return ret
483
499
484 limit = cmdutil.loglimit(opts)
500 limit = cmdutil.loglimit(opts)
485 dest = ui.expandpath(dest or 'default-push', dest or 'default')
501 o = _outgoing(ui, repo, dest, opts)
486 dest, branches = parseurl(dest, opts.get('branch'))
502 if o is None:
487 revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev'))
488 if revs:
489 revs = [repo.lookup(rev) for rev in revs]
490
491 other = repository(remoteui(repo, opts), dest)
492 ui.status(_('comparing with %s\n') % url.hidepassword(dest))
493 o = discovery.findoutgoing(repo, other, force=opts.get('force'))
494 if not o:
495 ui.status(_("no changes found\n"))
496 return recurse()
503 return recurse()
497
504
498 o = repo.changelog.nodesbetween(o, revs)[0]
499 if opts.get('newest_first'):
505 if opts.get('newest_first'):
500 o.reverse()
506 o.reverse()
501 displayer = cmdutil.show_changeset(ui, repo, opts)
507 displayer = cmdutil.show_changeset(ui, repo, opts)
General Comments 0
You need to be logged in to leave comments. Login now