Patchwork [2,of,3] namespaces: add tags

login
register
mail settings
Submitter Ryan McElroy
Date Dec. 15, 2014, 3:35 a.m.
Message ID <8b7c99b4d8ef8cd40712.1418614532@devbig105.prn2.facebook.com>
Download mbox | patch
Permalink /patch/7111/
State Accepted
Headers show

Comments

Ryan McElroy - Dec. 15, 2014, 3:35 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1413584853 25200
#      Fri Oct 17 15:27:33 2014 -0700
# Node ID 8b7c99b4d8ef8cd40712ad4c154111a51871e1b4
# Parent  2def00d143fbcc131a79c974ad66ab5ae5f02e89
namespaces: add tags

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -415,10 +415,6 @@  class changectx(basectx):
             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)
diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py
--- a/mercurial/namespaces.py
+++ b/mercurial/namespaces.py
@@ -34,10 +34,15 @@  class namespaces(object):
     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):
         """