changeset 7715:fd3266287b40

graphlog: reuse cmdutil.loglimit() instead of redefining
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Mon, 26 Jan 2009 16:40:43 +0100
parents f6cee47c0907
children 4ad12930a459
files hgext/graphlog.py
diffstat 1 files changed, 1 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/graphlog.py	Mon Jan 26 16:34:38 2009 +0100
+++ b/hgext/graphlog.py	Mon Jan 26 16:40:43 2009 +0100
@@ -244,18 +244,6 @@
         prev_node_index = node_index
         prev_n_columns_diff = n_columns_diff
 
-def get_limit(limit_opt):
-    if limit_opt:
-        try:
-            limit = int(limit_opt)
-        except ValueError:
-            raise util.Abort(_("limit must be a positive integer"))
-        if limit <= 0:
-            raise util.Abort(_("limit must be positive"))
-    else:
-        limit = sys.maxint
-    return limit
-
 def get_revs(repo, rev_opt):
     if rev_opt:
         revs = revrange(repo, rev_opt)
@@ -270,7 +258,6 @@
         if op in opts and opts[op]:
             raise util.Abort(_("--graph option is incompatible with --%s") % op)
 
-
 def graphlog(ui, repo, path=None, **opts):
     """show revision history alongside an ASCII revision graph
 
@@ -282,7 +269,7 @@
     """
 
     check_unsupported_flags(opts)
-    limit = get_limit(opts["limit"])
+    limit = cmdutil.loglimit(opts)
     start, stop = get_revs(repo, opts["rev"])
     stop = max(stop, start - limit + 1)
     if start == nullrev: