comparison mercurial/commands.py @ 12271:01dc8ba3e032

outgoing: move code from commands to cmdutil This makes it easier to reuse it in a recursive fashion for subrepos.
author Martin Geisler <mg@lazybytes.net>
date Mon, 13 Sep 2010 13:09:24 +0200
parents 166b9866580a
children 42ecd56399d7
comparison
equal deleted inserted replaced
12270:166b9866580a 12271:01dc8ba3e032
2670 2670
2671 See pull for details of valid destination formats. 2671 See pull for details of valid destination formats.
2672 2672
2673 Returns 0 if there are outgoing changes, 1 otherwise. 2673 Returns 0 if there are outgoing changes, 1 otherwise.
2674 """ 2674 """
2675 limit = cmdutil.loglimit(opts) 2675 return hg.outgoing(ui, repo, dest, opts)
2676 dest = ui.expandpath(dest or 'default-push', dest or 'default')
2677 dest, branches = hg.parseurl(dest, opts.get('branch'))
2678 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
2679 if revs:
2680 revs = [repo.lookup(rev) for rev in revs]
2681
2682 other = hg.repository(hg.remoteui(repo, opts), dest)
2683 ui.status(_('comparing with %s\n') % url.hidepassword(dest))
2684 o = discovery.findoutgoing(repo, other, force=opts.get('force'))
2685 if not o:
2686 ui.status(_("no changes found\n"))
2687 return 1
2688 o = repo.changelog.nodesbetween(o, revs)[0]
2689 if opts.get('newest_first'):
2690 o.reverse()
2691 displayer = cmdutil.show_changeset(ui, repo, opts)
2692 count = 0
2693 for n in o:
2694 if limit is not None and count >= limit:
2695 break
2696 parents = [p for p in repo.changelog.parents(n) if p != nullid]
2697 if opts.get('no_merges') and len(parents) == 2:
2698 continue
2699 count += 1
2700 displayer.show(repo[n])
2701 displayer.close()
2702 2676
2703 def parents(ui, repo, file_=None, **opts): 2677 def parents(ui, repo, file_=None, **opts):
2704 """show the parents of the working directory or revision 2678 """show the parents of the working directory or revision
2705 2679
2706 Print the working directory's parent revisions. If a revision is 2680 Print the working directory's parent revisions. If a revision is