# HG changeset patch # User Sean Farley # Date 1418590430 28800 # Node ID 3198aac7a95de5bf6e7a13be08a4ce60d7380620 # Parent b04b27aa6da3a659f3a2b310dacac04ddffdebe5 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. diff -r b04b27aa6da3 -r 3198aac7a95d mercurial/localrepo.py --- a/mercurial/localrepo.py Sun Dec 14 16:22:24 2014 -0800 +++ b/mercurial/localrepo.py Sun Dec 14 12:53:50 2014 -0800 @@ -18,6 +18,7 @@ from lock import release import weakref, errno, os, time, inspect import branchmap, pathutil +import namespaces propertycache = util.propertycache filecache = scmutil.filecache @@ -297,6 +298,9 @@ # - bookmark changes self.filteredrevcache = {} + # generic mapping between names and nodes + self.names = namespaces.namespaces(self) + def close(self): pass diff -r b04b27aa6da3 -r 3198aac7a95d mercurial/namespaces.py --- 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() diff -r b04b27aa6da3 -r 3198aac7a95d mercurial/statichttprepo.py --- a/mercurial/statichttprepo.py Sun Dec 14 16:22:24 2014 -0800 +++ b/mercurial/statichttprepo.py Sun Dec 14 12:53:50 2014 -0800 @@ -8,7 +8,7 @@ # GNU General Public License version 2 or any later version. from i18n import _ -import changelog, byterange, url, error +import changelog, byterange, url, error, namespaces import localrepo, manifest, util, scmutil, store import urllib, urllib2, errno, os @@ -106,6 +106,8 @@ self.vfs = self.opener self._phasedefaults = [] + self.names = namespaces.namespaces(self) + try: requirements = scmutil.readrequires(self.opener, self.supported) except IOError, inst: