changeset 16378:c463f46fe050

localrepo: lookup now goes through context
author Matt Mackall <mpm@selenic.com>
date Sun, 08 Apr 2012 12:38:10 -0500
parents f8ce254e514f
children 5cbfbb838198
files mercurial/localrepo.py
diffstat 1 files changed, 1 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sun Apr 08 12:38:08 2012 -0500
+++ b/mercurial/localrepo.py	Sun Apr 08 12:38:10 2012 -0500
@@ -593,37 +593,7 @@
             partial[branch] = bheads
 
     def lookup(self, key):
-        if isinstance(key, int):
-            return self.changelog.node(key)
-        elif key == '.':
-            return self.dirstate.p1()
-        elif key == 'null':
-            return nullid
-        elif key == 'tip':
-            return self.changelog.tip()
-        n = self.changelog._match(key)
-        if n:
-            return n
-        if key in self._bookmarks:
-            return self._bookmarks[key]
-        if key in self.tags():
-            return self.tags()[key]
-        if key in self.branchtags():
-            return self.branchtags()[key]
-        n = self.changelog._partialmatch(key)
-        if n:
-            return n
-
-        # can't find key, check if it might have come from damaged dirstate
-        if key in self.dirstate.parents():
-            raise error.Abort(_("working directory has unknown parent '%s'!")
-                              % short(key))
-        try:
-            if len(key) == 20:
-                key = hex(key)
-        except TypeError:
-            pass
-        raise error.RepoLookupError(_("unknown revision '%s'") % key)
+        return self[key].node()
 
     def lookupbranch(self, key, remote=None):
         repo = remote or self