changeset 48978:c80544aa4971

branching: merge stable into default
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 21 Mar 2022 10:55:50 +0100
parents 6b31c0676147 (current diff) bd752712ccaf (diff)
children f3aafd785e65
files contrib/heptapod-ci.yml mercurial/cmdutil.py
diffstat 5 files changed, 39 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/heptapod-ci.yml	Fri Mar 18 17:39:06 2022 +0100
+++ b/contrib/heptapod-ci.yml	Mon Mar 21 10:55:50 2022 +0100
@@ -7,7 +7,7 @@
 variables:
     PYTHON: python
     TEST_HGMODULEPOLICY: "allow"
-    HG_CI_IMAGE_TAG: "latest"
+    HG_CI_IMAGE_TAG: "v1.0"
     TEST_HGTESTS_ALLOW_NETIO: "0"
 
 .all_template: &all
--- a/mercurial/cmdutil.py	Fri Mar 18 17:39:06 2022 +0100
+++ b/mercurial/cmdutil.py	Mon Mar 21 10:55:50 2022 +0100
@@ -2905,7 +2905,14 @@
         filestoamend = {f for f in wctx.files() if matcher(f)}
 
         changes = len(filestoamend) > 0
-        if changes:
+        changeset_copies = (
+            repo.ui.config(b'experimental', b'copies.read-from')
+            != b'filelog-only'
+        )
+        # If there are changes to amend or if copy information needs to be read
+        # from the changeset extras, we cannot take the fast path of using
+        # filectxs from the old commit.
+        if changes or changeset_copies:
             # Recompute copies (avoid recording a -> b -> a)
             copied = copies.pathcopies(base, wctx, matcher)
             if old.p2:
@@ -2926,19 +2933,19 @@
 
             def filectxfn(repo, ctx_, path):
                 try:
+                    # Return None for removed files.
+                    if path in wctx.removed():
+                        return None
+
                     # If the file being considered is not amongst the files
-                    # to be amended, we should return the file context from the
+                    # to be amended, we should use the file context from the
                     # old changeset. This avoids issues when only some files in
                     # the working copy are being amended but there are also
                     # changes to other files from the old changeset.
-                    if path not in filestoamend:
-                        return old.filectx(path)
-
-                    # Return None for removed files.
-                    if path in wctx.removed():
-                        return None
-
-                    fctx = wctx[path]
+                    if path in filestoamend:
+                        fctx = wctx[path]
+                    else:
+                        fctx = old.filectx(path)
                     flags = fctx.flags()
                     mctx = context.memfilectx(
                         repo,
--- a/rust/hg-core/src/dirstate_tree/status.rs	Fri Mar 18 17:39:06 2022 +0100
+++ b/rust/hg-core/src/dirstate_tree/status.rs	Mon Mar 21 10:55:50 2022 +0100
@@ -47,6 +47,17 @@
     ignore_files: Vec<PathBuf>,
     options: StatusOptions,
 ) -> Result<(DirstateStatus<'on_disk>, Vec<PatternFileWarning>), StatusError> {
+    // Force the global rayon threadpool to not exceed 16 concurrent threads.
+    // This is a stop-gap measure until we figure out why using more than 16
+    // threads makes `status` slower for each additional thread.
+    // We use `ok()` in case the global threadpool has already been
+    // instantiated in `rhg` or some other caller.
+    // TODO find the underlying cause and fix it, then remove this.
+    rayon::ThreadPoolBuilder::new()
+        .num_threads(16)
+        .build_global()
+        .ok();
+
     let (ignore_fn, warnings, patterns_changed): (IgnoreFnType, _, _) =
         if options.list_ignored || options.list_unknown {
             let mut hasher = Sha1::new();
--- a/tests/test-copies-in-changeset.t	Fri Mar 18 17:39:06 2022 +0100
+++ b/tests/test-copies-in-changeset.t	Mon Mar 21 10:55:50 2022 +0100
@@ -316,6 +316,15 @@
   a -> k
 #endif
 
+Existing copy information is preserved by amend
+  $ hg cp a l
+  $ hg ci -m 'copy a to l'
+  $ hg showcopies
+  a -> l
+  $ hg ci --amend -m 'new description'
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob)
+  $ hg showcopies
+  a -> l
   $ cd ..
 
 Test rebasing a commit with copy information
--- a/tests/test-racy-mutations.t	Fri Mar 18 17:39:06 2022 +0100
+++ b/tests/test-racy-mutations.t	Mon Mar 21 10:55:50 2022 +0100
@@ -14,14 +14,7 @@
   >     f="\${WAITLOCK_FILE}"
   >     start=\`date +%s\`
   >     timeout=5
-  >     while [ \\( ! -f \$f \\) -a \\( ! -L \$f \\) ]; do
-  >         now=\`date +%s\`
-  >         if [ "\`expr \$now - \$start\`" -gt \$timeout ]; then
-  >             echo "timeout: \$f was not created in \$timeout seconds (it is now \$(date +%s))"
-  >             exit 1
-  >         fi
-  >         sleep 0.1
-  >     done
+  >     $RUNTESTDIR/testlib/wait-on-file "\$timeout" "\$f"
   >     if [ \$# -gt 1 ]; then
   >         cat "\$@"
   >     fi