diff -r 85219d6ece67 -r 56fff44cce98 mercurial/scmutil.py --- a/mercurial/scmutil.py Thu Apr 02 08:18:33 2015 +0200 +++ b/mercurial/scmutil.py Sat Mar 14 19:38:59 2015 +0900 @@ -582,6 +582,13 @@ _rcpath = osrcpath() return _rcpath +def intrev(repo, rev): + """Return integer for a given revision that can be used in comparison or + arithmetic operation""" + if rev is None: + return len(repo) + return rev + def revsingle(repo, revspec, default='.'): if not revspec and revspec != 0: return repo[default]