Mercurial > hg-stable
diff mercurial/revlog.py @ 2560:c35694df7b13
revlog: handle integer arguments to lookup
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 28 Jun 2006 15:49:33 -0500 |
parents | 6ff82ec1f4b8 |
children | 494f7787d8ee |
line wrap: on
line diff
--- a/mercurial/revlog.py Mon Jun 26 16:47:24 2006 +0200 +++ b/mercurial/revlog.py Wed Jun 28 15:49:33 2006 -0500 @@ -743,6 +743,11 @@ def lookup(self, id): """locate a node based on revision number or subset of hex nodeid""" + if type(id) == type(0): + rev = id + if rev < 0: rev = self.count() + rev + if rev < 0 or rev >= self.count(): return None + return self.node(rev) try: rev = int(id) if str(rev) != id: raise ValueError