changeset 32268:24f55686a63d

caches: stop warming the cache after changegroup application Now that we garantee that branchmap cache is updated at the end of the transaction we can drop this update. This removes a problematic case with nested transaction where the new cache could be written on disk before the transaction is finished (and even roll-backed) Such premature cache write was visible in the following test: * tests/test-acl.t * tests/test-rebase-conflicts.t In addition, running the cache update later means having more date about the state of the repository (in particular: phases). So we can generate caches with more information. This creates harmless changes to the following tests: * tests/test-hardlinks-whitelisted.t * tests/test-hardlinks.t * tests/test-phases.t * tests/test-tags.t * tests/test-inherit-mode.t
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 02 May 2017 18:57:52 +0200
parents c2380b448265
children ed2c44741190
files mercurial/changegroup.py tests/test-acl.t tests/test-hardlinks-whitelisted.t tests/test-hardlinks.t tests/test-inherit-mode.t tests/test-phases.t tests/test-rebase-conflicts.t tests/test-tags.t
diffstat 8 files changed, 23 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Tue May 02 22:27:44 2017 +0200
+++ b/mercurial/changegroup.py	Tue May 02 18:57:52 2017 +0200
@@ -20,7 +20,6 @@
 )
 
 from . import (
-    branchmap,
     dagutil,
     discovery,
     error,
@@ -404,12 +403,6 @@
                     phases.retractboundary(repo, tr, targetphase, added)
 
                 if changesets > 0:
-                    if srctype != 'strip':
-                        # During strip, branchcache is invalid but
-                        # coming call to `destroyed` will repair it.
-                        # In other case we can safely update cache on
-                        # disk.
-                        branchmap.updatecache(repo.filtered('served'))
 
                     def runhooks():
                         # These hooks run when the lock releases, not when the
--- a/tests/test-acl.t	Tue May 02 22:27:44 2017 +0200
+++ b/tests/test-acl.t	Tue May 02 18:57:52 2017 +0200
@@ -147,7 +147,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -213,7 +212,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -289,7 +287,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -354,7 +351,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -424,7 +420,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -491,7 +486,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -563,7 +557,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -632,7 +625,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -703,7 +695,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -786,7 +777,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -864,7 +854,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -937,7 +926,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -1021,7 +1009,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -1107,7 +1094,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -1189,7 +1175,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -1265,7 +1250,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
@@ -1348,7 +1332,6 @@
   listing keys for "phases"
   checking for updated bookmarks
   listing keys for "bookmarks"
-  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
--- a/tests/test-hardlinks-whitelisted.t	Tue May 02 22:27:44 2017 +0200
+++ b/tests/test-hardlinks-whitelisted.t	Tue May 02 18:57:52 2017 +0200
@@ -216,9 +216,10 @@
   $ nlinksdir r4
   2 r4/.hg/00changelog.i
   2 r4/.hg/branch
+  3 r4/.hg/cache/checklink (?)
+  2 r4/.hg/cache/branch2-base
   2 r4/.hg/cache/branch2-served
   2 r4/.hg/cache/checkisexec
-  3 r4/.hg/cache/checklink (?)
   ? r4/.hg/cache/checklink-target (glob)
   2 r4/.hg/cache/checknoexec
   2 r4/.hg/cache/rbc-names-v1
@@ -256,6 +257,7 @@
   $ nlinksdir r4
   2 r4/.hg/00changelog.i
   1 r4/.hg/branch
+  2 r4/.hg/cache/branch2-base
   2 r4/.hg/cache/branch2-served
   2 r4/.hg/cache/checkisexec
   2 r4/.hg/cache/checklink-target
--- a/tests/test-hardlinks.t	Tue May 02 22:27:44 2017 +0200
+++ b/tests/test-hardlinks.t	Tue May 02 18:57:52 2017 +0200
@@ -210,11 +210,15 @@
   $ nlinksdir r4
   2 r4/.hg/00changelog.i
   2 r4/.hg/branch
-  2 r4/.hg/cache/branch2-served
   2 r4/.hg/cache/checkisexec (execbit !)
   3 r4/.hg/cache/checklink (?)
   ? r4/.hg/cache/checklink-target (glob) (symlink !)
   2 r4/.hg/cache/checknoexec (execbit !)
+  2 r4/.hg/cache/branch2-base
+  2 r4/.hg/cache/branch2-served
+  2 r4/.hg/cache/checkisexec
+  2 r4/.hg/cache/checklink-target
+  2 r4/.hg/cache/checknoexec
   2 r4/.hg/cache/rbc-names-v1
   2 r4/.hg/cache/rbc-revs-v1
   2 r4/.hg/dirstate
@@ -250,10 +254,14 @@
   $ nlinksdir r4
   2 r4/.hg/00changelog.i
   1 r4/.hg/branch
-  2 r4/.hg/cache/branch2-served
   2 r4/.hg/cache/checkisexec (execbit !)
   2 r4/.hg/cache/checklink-target (symlink !)
   2 r4/.hg/cache/checknoexec (execbit !)
+  2 r4/.hg/cache/branch2-base
+  2 r4/.hg/cache/branch2-served
+  2 r4/.hg/cache/checkisexec
+  2 r4/.hg/cache/checklink-target
+  2 r4/.hg/cache/checknoexec
   2 r4/.hg/cache/rbc-names-v1
   2 r4/.hg/cache/rbc-revs-v1
   1 r4/.hg/dirstate
--- a/tests/test-inherit-mode.t	Tue May 02 22:27:44 2017 +0200
+++ b/tests/test-inherit-mode.t	Tue May 02 18:57:52 2017 +0200
@@ -115,8 +115,6 @@
   00660 ../push/.hg/00changelog.i
   00770 ../push/.hg/cache/
   00660 ../push/.hg/cache/branch2-base
-  00660 ../push/.hg/cache/rbc-names-v1
-  00660 ../push/.hg/cache/rbc-revs-v1
   00660 ../push/.hg/dirstate
   00660 ../push/.hg/requires
   00770 ../push/.hg/store/
--- a/tests/test-phases.t	Tue May 02 22:27:44 2017 +0200
+++ b/tests/test-phases.t	Tue May 02 18:57:52 2017 +0200
@@ -181,6 +181,7 @@
 check that branch cache with "served" filter are properly computed and stored
 
   $ ls ../push-dest/.hg/cache/branch2*
+  ../push-dest/.hg/cache/branch2-base
   ../push-dest/.hg/cache/branch2-served
   $ cat ../push-dest/.hg/cache/branch2-served
   6d6770faffce199f1fddd1cf87f6f026138cf061 6 465891ffab3c47a3c23792f7dc84156e19a90722
@@ -191,6 +192,7 @@
   5:2713879da13d6eea1ff22b442a5a87cb31a7ce6a secret
   3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e draft
   $ ls ../push-dest/.hg/cache/branch2*
+  ../push-dest/.hg/cache/branch2-base
   ../push-dest/.hg/cache/branch2-served
   ../push-dest/.hg/cache/branch2-visible
   $ cat ../push-dest/.hg/cache/branch2-served
--- a/tests/test-rebase-conflicts.t	Tue May 02 22:27:44 2017 +0200
+++ b/tests/test-rebase-conflicts.t	Tue May 02 18:57:52 2017 +0200
@@ -306,9 +306,7 @@
   bundle2-input-bundle: 0 parts total
   updating the branch cache
   invalid branchheads cache (served): tip differs
-  history modification detected - truncating revision branch cache to revision 9
   rebase completed
-  truncating cache/rbc-revs-v1 to 72
 
 Test minimization of merge conflicts
   $ hg up -q null
--- a/tests/test-tags.t	Tue May 02 22:27:44 2017 +0200
+++ b/tests/test-tags.t	Tue May 02 18:57:52 2017 +0200
@@ -671,13 +671,14 @@
 Missing tags2* files means the cache wasn't written through the normal mechanism.
 
   $ ls tagsclient/.hg/cache
-  branch2-served
   checkisexec (execbit !)
   checklink (symlink !)
   checklink-target (symlink !)
+  branch2-base
+  checkisexec
+  checklink
+  checklink-target
   hgtagsfnodes1
-  rbc-names-v1
-  rbc-revs-v1
 
 Cache should contain the head only, even though other nodes have tags data
 
@@ -698,13 +699,14 @@
   0.1                                0:96ee1d7354c4
 
   $ ls tagsclient/.hg/cache
-  branch2-served
   checkisexec (execbit !)
   checklink (symlink !)
   checklink-target (symlink !)
+  branch2-base
+  checkisexec
+  checklink
+  checklink-target
   hgtagsfnodes1
-  rbc-names-v1
-  rbc-revs-v1
   tags2-visible
 
   $ f --size --hexdump tagsclient/.hg/cache/hgtagsfnodes1