# HG changeset patch # User Benoit Boissinot # Date 2006-06-30 14:16:35 # Node ID 9cceb439048b654d950856fc0b171ab42b0392cf # Parent e30f425a4b2ca3679ea715ceef3ef4b5130f1a27 add -r/--rev arguments to incoming and outgoing diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1875,7 +1875,10 @@ def incoming(ui, repo, source="default", # use the created uncompressed bundlerepo other = bundlerepo.bundlerepository(ui, repo.root, fname) - o = other.changelog.nodesbetween(incoming)[0] + revs = None + if opts['rev']: + revs = [other.lookup(rev) for rev in opts['rev']] + o = other.changelog.nodesbetween(incoming, revs)[0] if opts['newest_first']: o.reverse() displayer = show_changeset(ui, other, opts) @@ -2085,13 +2088,16 @@ def outgoing(ui, repo, dest=None, **opts ui.setconfig("ui", "ssh", opts['ssh']) if opts['remotecmd']: ui.setconfig("ui", "remotecmd", opts['remotecmd']) + revs = None + if opts['rev']: + revs = [repo.lookup(rev) for rev in opts['rev']] other = hg.repository(ui, dest) o = repo.findoutgoing(other, force=opts['force']) if not o: ui.status(_("no changes found\n")) return - o = repo.changelog.nodesbetween(o)[0] + o = repo.changelog.nodesbetween(o, revs)[0] if opts['newest_first']: o.reverse() displayer = show_changeset(ui, repo, opts) @@ -3022,11 +3028,13 @@ table = { ('n', 'newest-first', None, _('show newest record first')), ('', 'bundle', '', _('file to store the bundles into')), ('p', 'patch', None, _('show patch')), + ('r', 'rev', [], _('a specific revision you would like to pull')), ('', 'template', '', _('display with template')), ('e', 'ssh', '', _('specify ssh command to use')), ('', 'remotecmd', '', _('specify hg command to run on the remote side'))], - _('hg incoming [-p] [-n] [-M] [--bundle FILENAME] [SOURCE]')), + _('hg incoming [-p] [-n] [-M] [-r REV]...' + '[--bundle FILENAME] [SOURCE]')), "^init": (init, [], _('hg init [DEST]')), "locate": (locate, @@ -3064,12 +3072,13 @@ table = { _('run even when remote repository is unrelated')), ('p', 'patch', None, _('show patch')), ('', 'style', '', _('display using template map file')), + ('r', 'rev', [], _('a specific revision you would like to push')), ('n', 'newest-first', None, _('show newest record first')), ('', 'template', '', _('display with template')), ('e', 'ssh', '', _('specify ssh command to use')), ('', 'remotecmd', '', _('specify hg command to run on the remote side'))], - _('hg outgoing [-M] [-p] [-n] [DEST]')), + _('hg outgoing [-M] [-p] [-n] [-r REV]... [DEST]')), "^parents": (parents, [('b', 'branches', None, _('show branches')), diff --git a/tests/test-incoming-outgoing b/tests/test-incoming-outgoing --- a/tests/test-incoming-outgoing +++ b/tests/test-incoming-outgoing @@ -14,8 +14,10 @@ cd .. hg init new # http incoming http_proxy= hg -R new incoming http://localhost:20059/ +http_proxy= hg -R new incoming -r 4 http://localhost:20059/ # local incoming hg -R new incoming test +hg -R new incoming -r 4 test # test with --bundle http_proxy= hg -R new incoming --bundle test.hg http://localhost:20059/ @@ -42,5 +44,6 @@ hg verify cd .. hg -R test-dev outgoing test http_proxy= hg -R test-dev outgoing http://localhost:20059/ +http_proxy= hg -R test-dev outgoing -r 11 http://localhost:20059/ kill `cat test/hg.pid` diff --git a/tests/test-incoming-outgoing.out b/tests/test-incoming-outgoing.out --- a/tests/test-incoming-outgoing.out +++ b/tests/test-incoming-outgoing.out @@ -75,6 +75,31 @@ user: test date: Mon Jan 12 13:46:40 1970 +0000 summary: 4 +changeset: 0:9cb21d99fe27 +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 0 + +changeset: 1:d717f5dfad6a +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 1 + +changeset: 2:c0d6b86da426 +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 2 + +changeset: 3:dfacbd43b3fe +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 3 + +changeset: 4:1f3a964b6022 +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 4 + changeset: 5:c028bcc7a28a user: test date: Mon Jan 12 13:46:40 1970 +0000 @@ -121,6 +146,31 @@ user: test date: Mon Jan 12 13:46:40 1970 +0000 summary: 4 +changeset: 0:9cb21d99fe27 +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 0 + +changeset: 1:d717f5dfad6a +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 1 + +changeset: 2:c0d6b86da426 +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 2 + +changeset: 3:dfacbd43b3fe +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 3 + +changeset: 4:1f3a964b6022 +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 4 + changeset: 5:c028bcc7a28a user: test date: Mon Jan 12 13:46:40 1970 +0000 @@ -270,3 +320,19 @@ user: test date: Mon Jan 12 13:46:40 1970 +0000 summary: 13 +searching for changes +changeset: 9:3741c3ad1096 +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 9 + +changeset: 10:de4143c8d9a5 +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 10 + +changeset: 11:0e1c188b9a7a +user: test +date: Mon Jan 12 13:46:40 1970 +0000 +summary: 11 +