Patchwork D5636: branchmap: updating triggers a write

login
register
mail settings
Submitter phabricator
Date Feb. 5, 2019, 4:45 p.m.
Message ID <34ff2259badfae3e8d9e4d5cc9b4904d@localhost.localdomain>
Download mbox | patch
Permalink /patch/38429/
State Not Applicable
Headers show

Comments

phabricator - Feb. 5, 2019, 4:45 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGeb7ce452e0fb: branchmap: updating triggers a write (authored by mjpieters, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5636?vs=13331&id=13807

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

AFFECTED FILES
  mercurial/branchmap.py
  mercurial/discovery.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -238,7 +238,7 @@ 
 
     # D. Update newmap with outgoing changes.
     # This will possibly add new heads and remove existing ones.
-    newmap = branchmap.branchcache((branch, heads[1])
+    newmap = branchmap.remotebranchcache((branch, heads[1])
                                  for branch, heads in headssum.iteritems()
                                  if heads[0] is not None)
     newmap.update(repo, (ctx.rev() for ctx in missingctx))
diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -63,7 +63,6 @@ 
     revs.extend(cl.revs(start=bcache.tiprev + 1))
     if revs:
         bcache.update(repo, revs)
-        bcache.write(repo)
 
     assert bcache.validfor(repo), filtername
     repo._branchcaches[repo.filtername] = bcache
@@ -242,8 +241,9 @@ 
 
     def copy(self):
         """return an deep copy of the branchcache object"""
-        return branchcache(self, self.tipnode, self.tiprev, self.filteredhash,
-                           self._closednodes)
+        return type(self)(
+            self, self.tipnode, self.tiprev, self.filteredhash,
+            self._closednodes)
 
     def write(self, repo):
         try:
@@ -332,6 +332,15 @@ 
         repo.ui.log('branchcache', 'updated %s branch cache in %.4f seconds\n',
                     repo.filtername, duration)
 
+        self.write(repo)
+
+
+class remotebranchcache(branchcache):
+    """Branchmap info for a remote connection, should not write locally"""
+    def write(self, repo):
+        pass
+
+
 # Revision branch info cache
 
 _rbcversion = '-v1'