Mercurial > hg
changeset 12735:8888e56ac417
outgoing: unify common graphlog.outgoing and hg.outgoing code
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Fri, 15 Oct 2010 05:21:51 +0200 |
parents | 5dfd1c49dcc5 |
children | 7e14e67e6622 |
files | hgext/graphlog.py mercurial/hg.py |
diffstat | 2 files changed, 21 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- 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()]
--- 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)