Patchwork [01,of,10,V2] branchmap: `stream_in` write remote branchcache to local one

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 24, 2012, 1:53 a.m.
Message ID <6fb3b8c61775ca53cdd1.1356314013@yamac.lan>
Download mbox | patch
Permalink /patch/280/
State Accepted
Commit 6fb3b8c61775ca53cdd1c69505295fb51c265883
Headers show

Comments

Pierre-Yves David - Dec. 24, 2012, 1:53 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1356136463 -3600
# Node ID 6fb3b8c61775ca53cdd1c69505295fb51c265883
# Parent  f8a13f061a8a4a278c7029c2cac7417dbcb08808
branchmap: `stream_in` write remote branchcache to local one

The previous code was writing it to a non existent `branchcache` attribute.  We
now write is to the proper `_branchcache` attribute and initialize the
`_branchcachetip` at the same time.

We keep writing it to disk, the previous code had this part right.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2490,16 +2490,16 @@  class localrepository(object):
             if rbranchmap:
                 rbheads = []
                 for bheads in rbranchmap.itervalues():
                     rbheads.extend(bheads)
 
-                self.branchcache = rbranchmap
                 if rbheads:
                     rtiprev = max((int(self.changelog.rev(node))
                             for node in rbheads))
-                    branchmap.write(self, self.branchcache,
-                            self[rtiprev].node(), rtiprev)
+                    self._branchcache = rbranchmap
+                    rtipnode = self._branchcachetip = self[rtiprev].node()
+                    branchmap.write(self, self._branchcache, rtipnode, rtiprev)
             self.invalidate()
             return len(self.heads()) + 1
         finally:
             lock.release()