Make lookup aware of branch labels
authorMatt Mackall <mpm@selenic.com>
Tue, 17 Oct 2006 18:31:56 -0500
changeset 3418 5436c8fe0ff5
parent 3417 028fff46a4ac
child 3419 d0459ec1455d
Make lookup aware of branch labels adjust precedence order slightly: - '.' - tags - branch labels - revlog order
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Tue Oct 17 18:31:18 2006 -0500
+++ b/mercurial/localrepo.py	Tue Oct 17 18:31:56 2006 -0500
@@ -328,17 +328,18 @@
             f.write("%s %s\n" % (hex(node), label))
 
     def lookup(self, key):
-        try:
+        if key == '.':
+            key = self.dirstate.parents()[0]
+            if key == nullid:
+                raise repo.RepoError(_("no revision checked out"))
+        if key in self.tags():
             return self.tags()[key]
-        except KeyError:
-            if key == '.':
-                key = self.dirstate.parents()[0]
-                if key == nullid:
-                    raise repo.RepoError(_("no revision checked out"))
-            try:
-                return self.changelog.lookup(key)
-            except:
-                raise repo.RepoError(_("unknown revision '%s'") % key)
+        if key in self.branchtags():
+            return self.branchtags()[key]
+        try:
+            return self.changelog.lookup(key)
+        except:
+            raise repo.RepoError(_("unknown revision '%s'") % key)
 
     def dev(self):
         return os.lstat(self.path).st_dev