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

login
register
mail settings
Submitter phabricator
Date Feb. 28, 2018, 1:04 a.m.
Message ID <3e6316ab6b6c0f1b87e6e7b9e503f8e4@localhost.localdomain>
Download mbox | patch
Permalink /patch/28485/
State Not Applicable
Headers show

Comments

phabricator - Feb. 28, 2018, 1:04 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1bd132a021dd: remotenames: don&#039;t inherit the remotenames class from dict class (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2361?vs=5939&id=6186

REVISION DETAIL
  https://phab.mercurial-scm.org/D2361

AFFECTED FILES
  hgext/remotenames.py

CHANGE DETAILS




To: pulkit, #hg-reviewers, yuja
Cc: mercurial-devel

Patch

diff --git a/hgext/remotenames.py b/hgext/remotenames.py
--- a/hgext/remotenames.py
+++ b/hgext/remotenames.py
@@ -147,31 +147,30 @@ 
         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
     loaded. Whenever client code needs to ensure the freshest copy of
     remotenames, use the `clearnames` method to force an eventual load.
     """
 
     def __init__(self, repo, *args):
-        dict.__init__(self, *args)
         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):
         self._nodetobmarks = None
         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: