comparison mercurial/hg.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 be9c4131a8f4
children e392d00ab5b0
comparison
equal deleted inserted replaced
12270:166b9866580a 12271:01dc8ba3e032
6 # This software may be used and distributed according to the terms of the 6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version. 7 # GNU General Public License version 2 or any later version.
8 8
9 from i18n import _ 9 from i18n import _
10 from lock import release 10 from lock import release
11 from node import hex, nullid, nullrev, short
11 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo 12 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo
12 import lock, util, extensions, error, encoding, node 13 import lock, util, extensions, error, encoding, node
14 import cmdutil, discovery, url
13 import merge as mergemod 15 import merge as mergemod
14 import verify as verifymod 16 import verify as verifymod
15 import errno, os, shutil 17 import errno, os, shutil
16 18
17 def _local(path): 19 def _local(path):
404 "or 'hg update -C' to abandon\n")) 406 "or 'hg update -C' to abandon\n"))
405 elif remind: 407 elif remind:
406 repo.ui.status(_("(branch merge, don't forget to commit)\n")) 408 repo.ui.status(_("(branch merge, don't forget to commit)\n"))
407 return stats[3] > 0 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 def revert(repo, node, choose): 440 def revert(repo, node, choose):
410 """revert changes to revision in node without updating dirstate""" 441 """revert changes to revision in node without updating dirstate"""
411 return mergemod.update(repo, node, False, True, choose)[3] > 0 442 return mergemod.update(repo, node, False, True, choose)[3] > 0
412 443
413 def verify(repo): 444 def verify(repo):