mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +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.i18n import _
|
||||||
from mercurial.node import nullrev
|
from mercurial.node import nullrev
|
||||||
from mercurial import cmdutil, commands, extensions
|
from mercurial import cmdutil, commands, extensions
|
||||||
from mercurial import hg, url, util, graphmod, discovery
|
from mercurial import hg, util, graphmod
|
||||||
|
|
||||||
ASCIIDATA = 'ASC'
|
ASCIIDATA = 'ASC'
|
||||||
|
|
||||||
@ -280,19 +280,10 @@ def goutgoing(ui, repo, dest=None, **opts):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
check_unsupported_flags(opts)
|
check_unsupported_flags(opts)
|
||||||
dest = ui.expandpath(dest or 'default-push', dest or 'default')
|
o = hg._outgoing(ui, repo, dest, opts)
|
||||||
dest, branches = hg.parseurl(dest, opts.get('branch'))
|
if o is None:
|
||||||
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"))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
o = repo.changelog.nodesbetween(o, revs)[0]
|
|
||||||
revdag = graphrevs(repo, o, opts)
|
revdag = graphrevs(repo, o, opts)
|
||||||
displayer = show_changeset(ui, repo, opts, buffered=True)
|
displayer = show_changeset(ui, repo, opts, buffered=True)
|
||||||
showparents = [ctx.node() for ctx in repo[None].parents()]
|
showparents = [ctx.node() for ctx in repo[None].parents()]
|
||||||
|
@ -471,17 +471,7 @@ def incoming(ui, repo, source, opts):
|
|||||||
displayer.show(other[n])
|
displayer.show(other[n])
|
||||||
return _incoming(display, subreporecurse, ui, repo, source, opts)
|
return _incoming(display, subreporecurse, ui, repo, source, opts)
|
||||||
|
|
||||||
def outgoing(ui, repo, dest, 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)
|
|
||||||
dest = ui.expandpath(dest or 'default-push', dest or 'default')
|
dest = ui.expandpath(dest or 'default-push', dest or 'default')
|
||||||
dest, branches = parseurl(dest, opts.get('branch'))
|
dest, branches = parseurl(dest, opts.get('branch'))
|
||||||
revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev'))
|
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'))
|
o = discovery.findoutgoing(repo, other, force=opts.get('force'))
|
||||||
if not o:
|
if not o:
|
||||||
ui.status(_("no changes found\n"))
|
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()
|
return recurse()
|
||||||
|
|
||||||
o = repo.changelog.nodesbetween(o, revs)[0]
|
|
||||||
if opts.get('newest_first'):
|
if opts.get('newest_first'):
|
||||||
o.reverse()
|
o.reverse()
|
||||||
displayer = cmdutil.show_changeset(ui, repo, opts)
|
displayer = cmdutil.show_changeset(ui, repo, opts)
|
||||||
|
Loading…
Reference in New Issue
Block a user