# HG changeset patch # User Nicolas Dumazet # Date 1287112911 -7200 # Node ID 8888e56ac4171d34960348a9ba0043317907fe4e # Parent 5dfd1c49dcc5a38ca87aaa82fb67880c7bd3f4da outgoing: unify common graphlog.outgoing and hg.outgoing code diff -r 5dfd1c49dcc5 -r 8888e56ac417 hgext/graphlog.py --- a/hgext/graphlog.py Thu Oct 14 22:41:43 2010 +0200 +++ b/hgext/graphlog.py Fri Oct 15 05:21:51 2010 +0200 @@ -18,7 +18,7 @@ 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 @@ """ 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()] diff -r 5dfd1c49dcc5 -r 8888e56ac417 mercurial/hg.py --- a/mercurial/hg.py Thu Oct 14 22:41:43 2010 +0200 +++ b/mercurial/hg.py Fri Oct 15 05:21:51 2010 +0200 @@ -471,6 +471,22 @@ displayer.show(other[n]) return _incoming(display, subreporecurse, ui, repo, source, 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')) + if revs: + revs = [repo.lookup(rev) for rev in revs] + + other = repository(remoteui(repo, opts), dest) + 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 None + + return repo.changelog.nodesbetween(o, revs)[0] + def outgoing(ui, repo, dest, opts): def recurse(): ret = 1 @@ -482,20 +498,10 @@ return ret limit = cmdutil.loglimit(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')) - if revs: - revs = [repo.lookup(rev) for rev in revs] - - other = repository(remoteui(repo, opts), dest) - 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 = _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)