diff mercurial/namespaces.py @ 23558:3198aac7a95d

namespaces: add bookmarks to the names data structure This marks the first use of abstracting our different types of named objects (bookmarks, tags, branches, etc.) and upcoming patches will use this to simplify logic.
author Sean Farley <sean.michael.farley@gmail.com>
date Sun, 14 Dec 2014 12:53:50 -0800
parents b04b27aa6da3
children 3b3a962e3677
line wrap: on
line diff
--- a/mercurial/namespaces.py	Sun Dec 14 16:22:24 2014 -0800
+++ b/mercurial/namespaces.py	Sun Dec 14 12:53:50 2014 -0800
@@ -35,6 +35,11 @@
         self._names = util.sortdict()
         self._repo = weakref.ref(repo)
 
+        # 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)))
+
     @property
     def repo(self):
         return self._repo()