# HG changeset patch # User Pierre-Yves David # Date 2017-05-02 16:57:52 # Node ID 24f55686a63d02965291079bf33da8a7269cadff # Parent c2380b4482658d368d2bf03580e0d9327227fc31 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 diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -20,7 +20,6 @@ from .node import ( ) from . import ( - branchmap, dagutil, discovery, error, @@ -404,12 +403,6 @@ class cg1unpacker(object): 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 diff --git a/tests/test-acl.t b/tests/test-acl.t --- a/tests/test-acl.t +++ b/tests/test-acl.t @@ -147,7 +147,6 @@ Extension disabled for lack of acl.sourc 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 @@ No [acl.allow]/[acl.deny] 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 @@ Empty [acl.allow] 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 @@ fred is allowed inside foo/ 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 @@ Empty [acl.deny] 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 @@ fred is allowed inside foo/, but not foo 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 @@ fred is allowed inside foo/, but not foo 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 @@ fred is allowed inside foo/, but not foo 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 @@ barney is allowed everywhere 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 @@ wilma can change files with a .txt exten 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 @@ file specified by acl.config does not ex 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 @@ betty is allowed inside foo/ by a acl.co 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 @@ acl.config can set only [acl.allow]/[acl 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 @@ fred is always allowed 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 @@ no one is allowed inside foo/Bar/ 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 @@ OS-level groups 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 @@ OS-level groups 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: diff --git a/tests/test-hardlinks-whitelisted.t b/tests/test-hardlinks-whitelisted.t --- a/tests/test-hardlinks-whitelisted.t +++ b/tests/test-hardlinks-whitelisted.t @@ -216,9 +216,10 @@ r4 has hardlinks in the working dir (not $ 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 @@ Update back to revision 11 in r4 should $ 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 diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t --- a/tests/test-hardlinks.t +++ b/tests/test-hardlinks.t @@ -210,11 +210,15 @@ r4 has hardlinks in the working dir (not $ 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 @@ Update back to revision 11 in r4 should $ 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 diff --git a/tests/test-inherit-mode.t b/tests/test-inherit-mode.t --- a/tests/test-inherit-mode.t +++ b/tests/test-inherit-mode.t @@ -115,8 +115,6 @@ group can still write everything 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/ diff --git a/tests/test-phases.t b/tests/test-phases.t --- a/tests/test-phases.t +++ b/tests/test-phases.t @@ -181,6 +181,7 @@ head shadowed by the remote secret head. 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 @@ check that branch cache with "served" fi 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 diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t --- a/tests/test-rebase-conflicts.t +++ b/tests/test-rebase-conflicts.t @@ -306,9 +306,7 @@ Check that the right ancestors is used w 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 diff --git a/tests/test-tags.t b/tests/test-tags.t --- a/tests/test-tags.t +++ b/tests/test-tags.t @@ -671,13 +671,14 @@ Cloning should pull down hgtags fnodes m 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 @@ Running hg tags should produce tags2* fi 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