changeset 3418:5436c8fe0ff5

Make lookup aware of branch labels adjust precedence order slightly: - '.' - tags - branch labels - revlog order
author Matt Mackall <mpm@selenic.com>
date Tue, 17 Oct 2006 18:31:56 -0500
parents 028fff46a4ac
children d0459ec1455d
files mercurial/localrepo.py
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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