Mercurial > hg > mercurial-source
diff mercurial/hg.py @ 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 (2010-10-15) |
parents | 5dfd1c49dcc5 |
children | 6c375e07d673 4d03707916d3 |
line wrap: on
line diff
--- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -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)