diff mercurial/commands.py @ 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
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')),