Patchwork D6155: branchcache: make entries a private attribute

login
register
mail settings
Submitter phabricator
Date March 23, 2019, 3:40 p.m.
Message ID <cb588c9a7c6624f83447fd91070b18f0@localhost.localdomain>
Download mbox | patch
Permalink /patch/39368/
State Not Applicable
Headers show

Comments

phabricator - March 23, 2019, 3:40 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb137a6793c51: branchcache: make entries a private attribute (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6155?vs=14556&id=14587

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

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -161,23 +161,23 @@ 
             self._closednodes = set()
         else:
             self._closednodes = closednodes
-        self.entries = dict(entries)
+        self._entries = dict(entries)
 
     def __iter__(self):
-        return iter(self.entries)
+        return iter(self._entries)
 
     def __setitem__(self, key, value):
-        self.entries[key] = value
+        self._entries[key] = value
 
     def __getitem__(self, key):
-        return self.entries[key]
+        return self._entries[key]
 
     def iteritems(self):
-        return self.entries.iteritems()
+        return self._entries.iteritems()
 
     def hasbranch(self, label):
         """ checks whether a branch of this name exists or not """
-        return label in self.entries
+        return label in self._entries
 
     @classmethod
     def fromfile(cls, repo):
@@ -230,7 +230,7 @@ 
             if not cl.hasnode(node):
                 raise ValueError(
                     r'node %s does not exist' % pycompat.sysstr(hex(node)))
-            self.entries.setdefault(label, []).append(node)
+            self._entries.setdefault(label, []).append(node)
             if state == 'c':
                 self._closednodes.add(node)
 
@@ -287,12 +287,12 @@ 
 
     def iterheads(self):
         """ returns all the heads """
-        return self.entries.itervalues()
+        return self._entries.itervalues()
 
     def copy(self):
         """return an deep copy of the branchcache object"""
         return branchcache(
-            self.entries, self.tipnode, self.tiprev, self.filteredhash,
+            self._entries, self.tipnode, self.tiprev, self.filteredhash,
             self._closednodes)
 
     def write(self, repo):
@@ -315,7 +315,7 @@ 
             f.close()
             repo.ui.log('branchcache',
                         'wrote %s branch cache with %d labels and %d nodes\n',
-                        repo.filtername, len(self.entries), nodecount)
+                        repo.filtername, len(self._entries), nodecount)
         except (IOError, OSError, error.Abort) as inst:
             # Abort may be raised by read only opener, so log and continue
             repo.ui.debug("couldn't write branch cache: %s\n" %
@@ -344,7 +344,7 @@ 
         # really branchheads. Note checking parents is insufficient:
         # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
         for branch, newheadrevs in newbranches.iteritems():
-            bheads = self.entries.setdefault(branch, [])
+            bheads = self._entries.setdefault(branch, [])
             bheadset = set(cl.rev(node) for node in bheads)
 
             # This have been tested True on all internal usage of this function.