changeset 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 fc06bd17c985
children 8dde275680d8
files mercurial/localrepo.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
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