Patchwork D5290: branchmap: rename partial -> bcache

login
register
mail settings
Submitter phabricator
Date Jan. 21, 2019, 6:08 p.m.
Message ID <3f7fd31c98306ddaf7561c486fc59df4@localhost.localdomain>
Download mbox | patch
Permalink /patch/37891/
State Not Applicable
Headers show

Comments

phabricator - Jan. 21, 2019, 6:08 p.m.
mjpieters updated this revision to Diff 13329.
mjpieters edited the summary of this revision.
mjpieters retitled this revision from "branchmap: refactor for better encapsulation" to "branchmap: rename partial -> bcache".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5290?vs=12573&id=13329

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

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -48,9 +48,9 @@ 
         filteredhash = None
         if len(cachekey) > 2:
             filteredhash = bin(cachekey[2])
-        partial = branchcache(tipnode=last, tiprev=lrev,
+        bcache = branchcache(tipnode=last, tiprev=lrev,
                               filteredhash=filteredhash)
-        if not partial.validfor(repo):
+        if not bcache.validfor(repo):
             # invalidate the cache
             raise ValueError(r'tip differs')
         cl = repo.changelog
@@ -66,9 +66,9 @@ 
             if not cl.hasnode(node):
                 raise ValueError(
                     r'node %s does not exist' % pycompat.sysstr(hex(node)))
-            partial.setdefault(label, []).append(node)
+            bcache.setdefault(label, []).append(node)
             if state == 'c':
-                partial._closednodes.add(node)
+                bcache._closednodes.add(node)
 
     except (IOError, OSError):
         return None
@@ -80,13 +80,13 @@ 
                 msg += ' (%s)' % repo.filtername
             msg += ': %s\n'
             repo.ui.debug(msg % pycompat.bytestr(inst))
-        partial = None
+        bcache = None
 
     finally:
         if f:
             f.close()
 
-    return partial
+    return bcache
 
 ### Nearest subset relation
 # Nearest subset of filter X is a filter Y so that:
@@ -103,27 +103,27 @@ 
 def updatecache(repo):
     cl = repo.changelog
     filtername = repo.filtername
-    partial = repo._branchcaches.get(filtername)
+    bcache = repo._branchcaches.get(filtername)
 
     revs = []
-    if partial is None or not partial.validfor(repo):
-        partial = read(repo)
-        if partial is None:
+    if bcache is None or not bcache.validfor(repo):
+        bcache = read(repo)
+        if bcache is None:
             subsetname = subsettable.get(filtername)
             if subsetname is None:
-                partial = branchcache()
+                bcache = branchcache()
             else:
                 subset = repo.filtered(subsetname)
-                partial = subset.branchmap().copy()
+                bcache = subset.branchmap().copy()
                 extrarevs = subset.changelog.filteredrevs - cl.filteredrevs
-                revs.extend(r for  r in extrarevs if r <= partial.tiprev)
-    revs.extend(cl.revs(start=partial.tiprev + 1))
+                revs.extend(r for  r in extrarevs if r <= bcache.tiprev)
+    revs.extend(cl.revs(start=bcache.tiprev + 1))
     if revs:
-        partial.update(repo, revs)
-        partial.write(repo)
+        bcache.update(repo, revs)
+        bcache.write(repo)
 
-    assert partial.validfor(repo), filtername
-    repo._branchcaches[repo.filtername] = partial
+    assert bcache.validfor(repo), filtername
+    repo._branchcaches[repo.filtername] = bcache
 
 def replacecache(repo, bm):
     """Replace the branchmap cache for a repo with a branch mapping.