Skip to content
Snippets Groups Projects
Commit 1bd132a0 authored by Pulkit Goyal's avatar Pulkit Goyal
Browse files

remotenames: don't inherit the remotenames class from dict class

The remotenames class was moved from hgremotenames extension. The class in
hgremotenames extension used to extend dict because updating bookmark was done
through a dict-like interface or Sean (smf) wanted it to be that way.
But now, we can remove the inheritance from the dict class as updating bookmark
is not done using a dict-like interface.

Thanks to Martin von Zweigbergk for spotting this.

Differential Revision: https://phab.mercurial-scm.org/D2361
parent 5c1cea8a
Branches
Tags
No related merge requests found
......@@ -147,7 +147,7 @@
for k, vtup in self.potentialentries.iteritems():
yield (k, [bin(vtup[0])])
class remotenames(dict):
class remotenames(object):
"""
This class encapsulates all the remotenames state. It also contains
methods to access that state in convenient ways. Remotenames are lazy
......@@ -156,9 +156,8 @@
"""
def __init__(self, repo, *args):
dict.__init__(self, *args)
self._repo = repo
self.clearnames()
def clearnames(self):
""" Clear all remote names state """
......@@ -160,10 +159,10 @@
self._repo = repo
self.clearnames()
def clearnames(self):
""" Clear all remote names state """
self['bookmarks'] = lazyremotenamedict("bookmarks", self._repo)
self['branches'] = lazyremotenamedict("branches", self._repo)
self.bookmarks = lazyremotenamedict("bookmarks", self._repo)
self.branches = lazyremotenamedict("branches", self._repo)
self._invalidatecache()
def _invalidatecache(self):
......@@ -171,7 +170,7 @@
self._nodetobranch = None
def bmarktonodes(self):
return self['bookmarks']
return self.bookmarks
def nodetobmarks(self):
if not self._nodetobmarks:
......@@ -182,7 +181,7 @@
return self._nodetobmarks
def branchtonodes(self):
return self['branches']
return self.branches
def nodetobranch(self):
if not self._nodetobranch:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment