comparison 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
comparison
equal deleted inserted replaced
23557:b04b27aa6da3 23558:3198aac7a95d
33 33
34 def __init__(self, repo): 34 def __init__(self, repo):
35 self._names = util.sortdict() 35 self._names = util.sortdict()
36 self._repo = weakref.ref(repo) 36 self._repo = weakref.ref(repo)
37 37
38 # we need current mercurial named objects (bookmarks, tags, and
39 # branches) to be initialized somewhere, so that place is here
40 self.addnamespace("bookmarks",
41 lambda repo, name: tolist(repo._bookmarks.get(name)))
42
38 @property 43 @property
39 def repo(self): 44 def repo(self):
40 return self._repo() 45 return self._repo()
41 46
42 def addnamespace(self, namespace, namemap, order=None): 47 def addnamespace(self, namespace, namemap, order=None):