# HG changeset patch # User Nicolas Dumazet # Date 1260718349 -32400 # Node ID 27457d31ae3f3b466edb784fe0ea0a14a917f812 # Parent 9ed13f718e535ab4199e8cad02905f164e975674 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. diff -r 9ed13f718e53 -r 27457d31ae3f hgext/graphlog.py --- 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) diff -r 9ed13f718e53 -r 27457d31ae3f mercurial/cmdutil.py --- a/mercurial/cmdutil.py Mon Dec 21 12:18:43 2009 +0200 +++ b/mercurial/cmdutil.py Mon Dec 14 00:32:29 2009 +0900 @@ -95,7 +95,7 @@ raise util.Abort(_('limit must be a positive integer')) if limit <= 0: raise util.Abort(_('limit must be positive')) else: - limit = sys.maxint + limit = None return limit def remoteui(src, opts): diff -r 9ed13f718e53 -r 27457d31ae3f mercurial/commands.py --- a/mercurial/commands.py Mon Dec 21 12:18:43 2009 +0200 +++ b/mercurial/commands.py Mon Dec 14 00:32:29 2009 +0900 @@ -1924,7 +1924,7 @@ displayer = cmdutil.show_changeset(ui, other, opts) count = 0 for n in o: - if count >= limit: + if limit is not None and count >= limit: break parents = [p for p in other.changelog.parents(n) if p != nullid] if opts.get('no_merges') and len(parents) == 2: @@ -2179,7 +2179,7 @@ displayer = cmdutil.show_changeset(ui, repo, opts) count = 0 for n in o: - if count >= limit: + if limit is not None and count >= limit: break parents = [p for p in repo.changelog.parents(n) if p != nullid] if opts.get('no_merges') and len(parents) == 2: diff -r 9ed13f718e53 -r 27457d31ae3f mercurial/graphmod.py --- a/mercurial/graphmod.py Mon Dec 21 12:18:43 2009 +0200 +++ b/mercurial/graphmod.py Mon Dec 14 00:32:29 2009 +0900 @@ -17,7 +17,6 @@ Data depends on type. """ -import sys from mercurial.node import nullrev CHANGESET = 'C' @@ -37,7 +36,7 @@ yield (cur, CHANGESET, ctx, sorted(parents)) cur -= 1 -def filerevs(repo, path, start, stop, limit=sys.maxint): +def filerevs(repo, path, start, stop, limit=None): """file cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples This generator function walks through the revision history of a single