changeset 23562:59e703aecaf6

namespaces: add tags
author Sean Farley <sean.michael.farley@gmail.com>
date Fri, 17 Oct 2014 15:27:33 -0700
parents 3c2419e07df5
children 114992041625
files mercurial/context.py mercurial/namespaces.py
diffstat 2 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Sun Dec 14 19:11:44 2014 -0800
+++ b/mercurial/context.py	Fri Oct 17 15:27:33 2014 -0700
@@ -415,10 +415,6 @@
             except KeyError:
                 pass
 
-            if changeid in repo._tagscache.tags:
-                self._node = repo._tagscache.tags[changeid]
-                self._rev = repo.changelog.rev(self._node)
-                return
             try:
                 self._node = repo.branchtip(changeid)
                 self._rev = repo.changelog.rev(self._node)
--- a/mercurial/namespaces.py	Sun Dec 14 19:11:44 2014 -0800
+++ b/mercurial/namespaces.py	Fri Oct 17 15:27:33 2014 -0700
@@ -34,10 +34,15 @@
     def __init__(self):
         self._names = util.sortdict()
 
+        addns = self.addnamespace
+
         # we need current mercurial named objects (bookmarks, tags, and
         # branches) to be initialized somewhere, so that place is here
-        self.addnamespace("bookmarks",
-                          lambda repo, name: tolist(repo._bookmarks.get(name)))
+        addns("bookmarks",
+              lambda repo, name: tolist(repo._bookmarks.get(name)))
+
+        addns("tags",
+              lambda repo, name: tolist(repo._tagscache.tags.get(name)))
 
     def addnamespace(self, namespace, namemap, order=None):
         """