diff hgext/graphlog.py @ 10111:27457d31ae3f

cmdutil: replace sys.maxint with None as default value in loglimit Semantically, it is better to use None over any other value when there is "no value". Using maxint in this context is quite hackish, and is not forward compatible.
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Mon, 14 Dec 2009 00:32:29 +0900
parents ffa6f2eb934e
children d6512b3e9ac0
line wrap: on
line diff
--- a/hgext/graphlog.py	Mon Dec 21 12:18:43 2009 +0200
+++ b/hgext/graphlog.py	Mon Dec 14 00:32:29 2009 +0900
@@ -250,7 +250,8 @@
     if path: # could be reset in canonpath
         revdag = graphmod.filerevs(repo, path, start, stop, limit)
     else:
-        stop = max(stop, start - limit + 1)
+        if limit is not None:
+            stop = max(stop, start - limit + 1)
         revdag = graphmod.revisions(repo, start, stop)
 
     displayer = show_changeset(ui, repo, opts, buffered=True)
@@ -260,7 +261,7 @@
 def graphrevs(repo, nodes, opts):
     limit = cmdutil.loglimit(opts)
     nodes.reverse()
-    if limit < sys.maxint:
+    if limit is not None:
         nodes = nodes[:limit]
     return graphmod.nodes(repo, nodes)