mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
outgoing: unify common graphlog.outgoing and hg.outgoing code
This commit is contained in:
parent
15e204f50d
commit
6b618a96de
@ -18,7 +18,7 @@ from mercurial.commands import templateopts
|
||||
from mercurial.i18n import _
|
||||
from mercurial.node import nullrev
|
||||
from mercurial import cmdutil, commands, extensions
|
||||
from mercurial import hg, url, util, graphmod, discovery
|
||||
from mercurial import hg, util, graphmod
|
||||
|
||||
ASCIIDATA = 'ASC'
|
||||
|
||||
@ -280,19 +280,10 @@ def goutgoing(ui, repo, dest=None, **opts):
|
||||
"""
|
||||
|
||||
check_unsupported_flags(opts)
|
||||
dest = ui.expandpath(dest or 'default-push', dest or 'default')
|
||||
dest, branches = hg.parseurl(dest, opts.get('branch'))
|
||||
revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
|
||||
other = hg.repository(hg.remoteui(ui, opts), dest)
|
||||
if revs:
|
||||
revs = [repo.lookup(rev) for rev in revs]
|
||||
ui.status(_('comparing with %s\n') % url.hidepassword(dest))
|
||||
o = discovery.findoutgoing(repo, other, force=opts.get('force'))
|
||||
if not o:
|
||||
ui.status(_("no changes found\n"))
|
||||
o = hg._outgoing(ui, repo, dest, opts)
|
||||
if o is None:
|
||||
return
|
||||
|
||||
o = repo.changelog.nodesbetween(o, revs)[0]
|
||||
revdag = graphrevs(repo, o, opts)
|
||||
displayer = show_changeset(ui, repo, opts, buffered=True)
|
||||
showparents = [ctx.node() for ctx in repo[None].parents()]
|
||||
|
@ -471,17 +471,7 @@ def incoming(ui, repo, source, opts):
|
||||
displayer.show(other[n])
|
||||
return _incoming(display, subreporecurse, ui, repo, source, opts)
|
||||
|
||||
def outgoing(ui, repo, dest, opts):
|
||||
def recurse():
|
||||
ret = 1
|
||||
if opts.get('subrepos'):
|
||||
ctx = repo[None]
|
||||
for subpath in sorted(ctx.substate):
|
||||
sub = ctx.sub(subpath)
|
||||
ret = min(ret, sub.outgoing(ui, dest, opts))
|
||||
return ret
|
||||
|
||||
limit = cmdutil.loglimit(opts)
|
||||
def _outgoing(ui, repo, dest, opts):
|
||||
dest = ui.expandpath(dest or 'default-push', dest or 'default')
|
||||
dest, branches = parseurl(dest, opts.get('branch'))
|
||||
revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev'))
|
||||
@ -493,9 +483,25 @@ def outgoing(ui, repo, dest, opts):
|
||||
o = discovery.findoutgoing(repo, other, force=opts.get('force'))
|
||||
if not o:
|
||||
ui.status(_("no changes found\n"))
|
||||
return None
|
||||
|
||||
return repo.changelog.nodesbetween(o, revs)[0]
|
||||
|
||||
def outgoing(ui, repo, dest, opts):
|
||||
def recurse():
|
||||
ret = 1
|
||||
if opts.get('subrepos'):
|
||||
ctx = repo[None]
|
||||
for subpath in sorted(ctx.substate):
|
||||
sub = ctx.sub(subpath)
|
||||
ret = min(ret, sub.outgoing(ui, dest, opts))
|
||||
return ret
|
||||
|
||||
limit = cmdutil.loglimit(opts)
|
||||
o = _outgoing(ui, repo, dest, opts)
|
||||
if o is None:
|
||||
return recurse()
|
||||
|
||||
o = repo.changelog.nodesbetween(o, revs)[0]
|
||||
if opts.get('newest_first'):
|
||||
o.reverse()
|
||||
displayer = cmdutil.show_changeset(ui, repo, opts)
|
||||
|
Loading…
Reference in New Issue
Block a user