D6311: branchcache: store the maximum tip in a variable inside for loop

2019-04-28 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9893d7aa7420: branchcache: store the maximum tip in a 
variable inside for loop (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6311?vs=14926=14954

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

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -378,6 +378,10 @@
 # fetch current topological heads to speed up filtering
 topoheads = set(cl.headrevs())
 
+# new tip revision which we found after iterating items from new
+# branches
+ntiprev = self.tiprev
+
 # if older branchheads are reachable from new ones, they aren't
 # really branchheads. Note checking parents is insufficient:
 # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
@@ -401,9 +405,12 @@
 bheadrevs = sorted(bheadset)
 self[branch] = [cl.node(rev) for rev in bheadrevs]
 tiprev = bheadrevs[-1]
-if tiprev > self.tiprev:
-self.tipnode = cl.node(tiprev)
-self.tiprev = tiprev
+if tiprev > ntiprev:
+ntiprev = tiprev
+
+if ntiprev > self.tiprev:
+self.tiprev = ntiprev
+self.tipnode = cl.node(ntiprev)
 
 if not self.validfor(repo):
 # cache key are not valid anymore



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6311: branchcache: store the maximum tip in a variable inside for loop

2019-04-26 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Instead of assigning self.tiprev multiple times in the for loop, and calling
  cl.node() on it, let's store that in a temporary variable and assign it in the
  end of loop.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -378,6 +378,10 @@
 # fetch current topological heads to speed up filtering
 topoheads = set(cl.headrevs())
 
+# new tip revision which we found after iterating items from new
+# branches
+ntiprev = self.tiprev
+
 # if older branchheads are reachable from new ones, they aren't
 # really branchheads. Note checking parents is insufficient:
 # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
@@ -401,9 +405,12 @@
 bheadrevs = sorted(bheadset)
 self[branch] = [cl.node(rev) for rev in bheadrevs]
 tiprev = bheadrevs[-1]
-if tiprev > self.tiprev:
-self.tipnode = cl.node(tiprev)
-self.tiprev = tiprev
+if tiprev > ntiprev:
+ntiprev = tiprev
+
+if ntiprev > self.tiprev:
+self.tiprev = ntiprev
+self.tipnode = cl.node(ntiprev)
 
 if not self.validfor(repo):
 # cache key are not valid anymore



To: pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel