changeset 46618:dde86beca388

copies: tests and fix parallel computation of changed file information The code was mixing variable name and misbehaving in some case. This changeset fix it and also add a tests to validate it does not regress. Without the fix, the parallel-upgrade misbehavior in random ways. Differential Revision: https://phab.mercurial-scm.org/D10084
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 01 Mar 2021 20:08:26 +0100
parents 87f8b3add56b
children f2fc34e88238
files mercurial/metadata.py tests/test-copies-chain-merge.t
diffstat 2 files changed, 61 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/metadata.py	Fri Jan 29 13:07:00 2021 +0100
+++ b/mercurial/metadata.py	Mon Mar 01 20:08:26 2021 +0100
@@ -882,14 +882,14 @@
         data = {}, False
         if util.safehasattr(revlog, b'filteredrevs'):  # this is a changelog
             # Is the data previously shelved ?
-            sidedata = staging.pop(rev, None)
-            if sidedata is None:
+            data = staging.pop(rev, None)
+            if data is None:
                 # look at the queued result until we find the one we are lookig
                 # for (shelve the other ones)
                 r, data = sidedataq.get()
                 while r != rev:
                     staging[r] = data
-                    r, sidedata = sidedataq.get()
+                    r, data = sidedataq.get()
             tokens.release()
         sidedata, has_copies_info = data
         new_flag = 0
--- a/tests/test-copies-chain-merge.t	Fri Jan 29 13:07:00 2021 +0100
+++ b/tests/test-copies-chain-merge.t	Mon Mar 01 20:08:26 2021 +0100
@@ -1,4 +1,4 @@
-#testcases filelog compatibility changeset sidedata upgraded
+#testcases filelog compatibility changeset sidedata upgraded upgraded-parallel
 
 =====================================================
 Test Copy tracing for chain of copies involving merge
@@ -1486,6 +1486,44 @@
   
 #endif
 
+#if upgraded-parallel
+  $ cat >> $HGRCPATH << EOF
+  > [format]
+  > exp-use-side-data = yes
+  > exp-use-copies-side-data-changeset = yes
+  > [experimental]
+  > worker.repository-upgrade=yes
+  > [worker]
+  > enabled=yes
+  > numcpus=8
+  > EOF
+  $ hg debugformat -v
+  format-variant     repo config default
+  fncache:            yes    yes     yes
+  dotencode:          yes    yes     yes
+  generaldelta:       yes    yes     yes
+  share-safe:          no     no      no
+  sparserevlog:       yes    yes     yes
+  sidedata:            no    yes      no
+  persistent-nodemap:  no     no      no
+  copies-sdc:          no    yes      no
+  plain-cl-delta:     yes    yes     yes
+  compression:        * (glob)
+  compression-level:  default default default
+  $ hg debugupgraderepo --run --quiet
+  upgrade will perform the following actions:
+  
+  requirements
+     preserved: * (glob)
+     added: exp-copies-sidedata-changeset, exp-sidedata-flag
+  
+  processed revlogs:
+    - all-filelogs
+    - changelog
+    - manifest
+  
+#endif
+
 
 #if no-compatibility no-filelog no-changeset
 
@@ -3172,18 +3210,21 @@
     a (filelog !)
     a (sidedata !)
     a (upgraded !)
+    a (upgraded-parallel !)
 
   $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAE,Km")' f
   A f
     a (filelog !)
     a (sidedata !)
     a (upgraded !)
+    a (upgraded-parallel !)
 
   $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mK,AEm")' f
   A f
     a (filelog !)
     a (sidedata !)
     a (upgraded !)
+    a (upgraded-parallel !)
 
 
 The result from mEAm is the same for the subsequent merge:
@@ -3193,18 +3234,21 @@
     a (filelog !)
     b (sidedata !)
     b (upgraded !)
+    b (upgraded-parallel !)
 
   $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEA,Jm")' f
   A f
     a (filelog !)
     b (sidedata !)
     b (upgraded !)
+    b (upgraded-parallel !)
 
   $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mJ,EAm")' f
   A f
     a (filelog !)
     b (sidedata !)
     b (upgraded !)
+    b (upgraded-parallel !)
 
 Subcase: chaining conflicting rename resolution
 ```````````````````````````````````````````````
@@ -3221,18 +3265,21 @@
     r (filelog !)
     p (sidedata !)
     p (upgraded !)
+    p (upgraded-parallel !)
 
   $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mPQ,Tm")' v
   A v
     r (filelog !)
     p (sidedata !)
     p (upgraded !)
+    p (upgraded-parallel !)
 
   $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mT,PQm")' v
   A v
     r (filelog !)
     p (sidedata !)
     p (upgraded !)
+    p (upgraded-parallel !)
 
 
 The result from mQPm is the same for the subsequent merge:
@@ -3250,6 +3297,7 @@
     r (filelog !)
     r (sidedata !)
     r (upgraded !)
+    r (upgraded-parallel !)
 
 
 Subcase: chaining salvage information during a merge
@@ -3330,11 +3378,13 @@
     a (filelog !)
     h (sidedata !)
     h (upgraded !)
+    h (upgraded-parallel !)
   $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGFm")' d
   A d
     a (filelog !)
     a (sidedata !)
     a (upgraded !)
+    a (upgraded-parallel !)
 
 Chained output
 
@@ -3343,11 +3393,13 @@
     a (filelog !)
     h (sidedata !)
     h (upgraded !)
+    h (upgraded-parallel !)
   $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mFG,Om")' d
   A d
     a (filelog !)
     h (sidedata !)
     h (upgraded !)
+    h (upgraded-parallel !)
 
 
   $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGF,Nm")' d
@@ -3373,12 +3425,14 @@
     a (filelog !)
     a (sidedata !)
     a (upgraded !)
+    a (upgraded-parallel !)
 
   $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAE-change,Km")' f
   A f
     a (filelog !)
     a (sidedata !)
     a (upgraded !)
+    a (upgraded-parallel !)
 
   $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mK,AE-change-m")' f
   A f
@@ -3392,15 +3446,18 @@
     a (filelog !)
     b (sidedata !)
     b (upgraded !)
+    b (upgraded-parallel !)
 
   $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEA-change,Jm")' f
   A f
     a (filelog !)
     b (sidedata !)
     b (upgraded !)
+    b (upgraded-parallel !)
 
   $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mJ,EA-change-m")' f
   A f
     a (filelog !)
     b (sidedata !)
     b (upgraded !)
+    b (upgraded-parallel !)