Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 7377:374a6b3ac623
lookup: fast-paths for int and 'tip'
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 14 Nov 2008 14:12:43 -0600 |
parents | 9fe97eea5510 |
children | 6163ef936a00 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Fri Nov 14 14:12:16 2008 -0600 +++ b/mercurial/localrepo.py Fri Nov 14 14:12:43 2008 -0600 @@ -437,10 +437,14 @@ partial[b] = c.node() def lookup(self, key): - if key == '.': + if isinstance(key, int): + return self.changelog.node(key) + elif key == '.': return self.dirstate.parents()[0] elif key == 'null': return nullid + elif key == 'tip': + return self.changelog.tip() n = self.changelog._match(key) if n: return n