Patchwork D6238: branchcache: don't verify while creating a copy

login
register
mail settings
Submitter phabricator
Date April 16, 2019, 12:27 p.m.
Message ID <differential-rev-PHID-DREV-w5czefaebhrrkb4hjnae-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/39626/
State Superseded
Headers show

Comments

phabricator - April 16, 2019, 12:27 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The copy will not be mark as verified, so there is no need to verify nodes.
  Thanks to Yuya who spotted this while reviewing.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
Yuya Nishihara - April 16, 2019, 11:05 p.m.
>      def copy(self):
>          """return an deep copy of the branchcache object"""
> -        self._verifyall()
>          return type(self)(
>              self._entries, self.tipnode, self.tiprev, self.filteredhash,
>              self._closednodes)

Looks good, but it's probably better to copy the verification state to
new instance, or simply make branchcache() start with "verified" state.
IIUC, only branches loaded from file have to be validated.
phabricator - April 16, 2019, 11:08 p.m.
yuja added a comment.


  >   def copy(self):
  >       """return an deep copy of the branchcache object"""
  > 
  > - self._verifyall() return type(self)( self._entries, self.tipnode, self.tiprev, self.filteredhash, self._closednodes)
  
  Looks good, but it's probably better to copy the verification state to
  new instance, or simply make branchcache() start with "verified" state.
  IIUC, only branches loaded from file have to be validated.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #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
@@ -339,7 +339,6 @@ 
 
     def copy(self):
         """return an deep copy of the branchcache object"""
-        self._verifyall()
         return type(self)(
             self._entries, self.tipnode, self.tiprev, self.filteredhash,
             self._closednodes)