##// END OF EJS Templates
outgoing: move code from commands to cmdutil...
Martin Geisler -
r12271:01dc8ba3 default
parent child Browse files
Show More
@@ -2672,33 +2672,7 b' def outgoing(ui, repo, dest=None, **opts'
2672 2672
2673 2673 Returns 0 if there are outgoing changes, 1 otherwise.
2674 2674 """
2675 limit = cmdutil.loglimit(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()
2675 return hg.outgoing(ui, repo, dest, opts)
2702 2676
2703 2677 def parents(ui, repo, file_=None, **opts):
2704 2678 """show the parents of the working directory or revision
@@ -8,8 +8,10 b''
8 8
9 9 from i18n import _
10 10 from lock import release
11 from node import hex, nullid, nullrev, short
11 12 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo
12 13 import lock, util, extensions, error, encoding, node
14 import cmdutil, discovery, url
13 15 import merge as mergemod
14 16 import verify as verifymod
15 17 import errno, os, shutil
@@ -406,6 +408,35 b' def merge(repo, node, force=None, remind'
406 408 repo.ui.status(_("(branch merge, don't forget to commit)\n"))
407 409 return stats[3] > 0
408 410
411 def outgoing(ui, repo, dest, opts):
412 limit = cmdutil.loglimit(opts)
413 dest = ui.expandpath(dest or 'default-push', dest or 'default')
414 dest, branches = parseurl(dest, opts.get('branch'))
415 revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev'))
416 if revs:
417 revs = [repo.lookup(rev) for rev in revs]
418
419 other = repository(remoteui(repo, opts), dest)
420 ui.status(_('comparing with %s\n') % url.hidepassword(dest))
421 o = discovery.findoutgoing(repo, other, force=opts.get('force'))
422 if not o:
423 ui.status(_("no changes found\n"))
424 return 1
425 o = repo.changelog.nodesbetween(o, revs)[0]
426 if opts.get('newest_first'):
427 o.reverse()
428 displayer = cmdutil.show_changeset(ui, repo, opts)
429 count = 0
430 for n in o:
431 if limit is not None and count >= limit:
432 break
433 parents = [p for p in repo.changelog.parents(n) if p != nullid]
434 if opts.get('no_merges') and len(parents) == 2:
435 continue
436 count += 1
437 displayer.show(repo[n])
438 displayer.close()
439
409 440 def revert(repo, node, choose):
410 441 """revert changes to revision in node without updating dirstate"""
411 442 return mergemod.update(repo, node, False, True, choose)[3] > 0
General Comments 0
You need to be logged in to leave comments. Login now