# HG changeset patch # User Matt Mackall # Date 2008-11-14 20:12:43 # Node ID 374a6b3ac623b060a4a840030ba62b9afc3c44a5 # Parent fc06bd17c985cd5433ca8e28839b6217a22b8a2c lookup: fast-paths for int and 'tip' diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -437,10 +437,14 @@ class localrepository(repo.repository): 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