Mercurial > hg
changeset 6191:01594b0c86e2
Add option -l/--limit to hg incoming and hg outgoing.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 29 Feb 2008 02:15:31 +0100 |
parents | a79d9408806f |
children | cd65a67aff31 |
files | mercurial/commands.py tests/test-incoming-outgoing tests/test-incoming-outgoing.out |
diffstat | 3 files changed, 46 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Fri Feb 29 01:51:23 2008 +0100 +++ b/mercurial/commands.py Fri Feb 29 02:15:31 2008 +0100 @@ -1561,6 +1561,7 @@ See pull for valid source format details. """ + limit = cmdutil.loglimit(opts) source, revs, checkout = hg.parseurl(ui.expandpath(source), opts['rev']) cmdutil.setremoteconfig(ui, opts) @@ -1599,10 +1600,14 @@ if opts['newest_first']: o.reverse() displayer = cmdutil.show_changeset(ui, other, opts) + count = 0 for n in o: + if count >= limit: + break parents = [p for p in other.changelog.parents(n) if p != nullid] if opts['no_merges'] and len(parents) == 2: continue + count += 1 displayer.show(changenode=n) finally: if hasattr(other, 'close'): @@ -1869,6 +1874,7 @@ See pull for valid destination format details. """ + limit = cmdutil.loglimit(opts) dest, revs, checkout = hg.parseurl( ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev']) cmdutil.setremoteconfig(ui, opts) @@ -1885,10 +1891,14 @@ if opts['newest_first']: o.reverse() displayer = cmdutil.show_changeset(ui, repo, opts) + count = 0 for n in o: + if count >= limit: + break parents = [p for p in repo.changelog.parents(n) if p != nullid] if opts['no_merges'] and len(parents) == 2: continue + count += 1 displayer.show(changenode=n) def parents(ui, repo, file_=None, **opts): @@ -2975,6 +2985,7 @@ ('n', 'newest-first', None, _('show newest record first')), ('', 'bundle', '', _('file to store the bundles into')), ('p', 'patch', None, _('show patch')), + ('l', 'limit', '', _('limit number of changes displayed')), ('r', 'rev', [], _('a specific revision up to which you would like to pull')), ('', 'template', '', _('display with template')), ] + remoteopts, @@ -3032,6 +3043,7 @@ _('run even when remote repository is unrelated')), ('p', 'patch', None, _('show patch')), ('', 'style', '', _('display using template map file')), + ('l', 'limit', '', _('limit number of changes displayed')), ('r', 'rev', [], _('a specific revision you would like to push')), ('n', 'newest-first', None, _('show newest record first')), ('', 'template', '', _('display with template')),
--- a/tests/test-incoming-outgoing Fri Feb 29 01:51:23 2008 +0100 +++ b/tests/test-incoming-outgoing Fri Feb 29 02:15:31 2008 +0100 @@ -19,6 +19,8 @@ # local incoming hg -R new incoming test hg -R new incoming -r 4 test +echo "% limit to 2 changesets" +hg -R new incoming -l 2 test # test with --bundle http_proxy= hg -R new incoming --bundle test.hg http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,' @@ -44,5 +46,7 @@ hg verify cd .. hg -R test-dev outgoing test +echo "% limit to 3 changesets" +hg -R test-dev outgoing -l 3 test http_proxy= hg -R test-dev outgoing http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,' http_proxy= hg -R test-dev outgoing -r 11 http://localhost:$HGPORT/ | sed -e 's,:[0-9][0-9]*/,/,'
--- a/tests/test-incoming-outgoing.out Fri Feb 29 01:51:23 2008 +0100 +++ b/tests/test-incoming-outgoing.out Fri Feb 29 02:15:31 2008 +0100 @@ -151,6 +151,18 @@ date: Mon Jan 12 13:46:40 1970 +0000 summary: 4 +% limit to 2 changesets +comparing with test +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 + comparing with http://localhost/ changeset: 0:9cb21d99fe27 user: test @@ -301,6 +313,24 @@ date: Mon Jan 12 13:46:40 1970 +0000 summary: 13 +% limit to 3 changesets +comparing with test +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 + comparing with http://localhost/ searching for changes changeset: 9:3741c3ad1096