# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1679627853 0
#      Fri Mar 24 03:17:33 2023 +0000
# Node ID 82be58f322667eec09111d06b8ec37ffe0b1d95c
# Parent  a48d60872a0dbdf08c763cf055b66fe2139b756c
# EXP-Topic pull-out-of-order.pdb
last timed

diff --git a/suites/hg/benchmarks/pull-out-of-order.pbd b/suites/hg/benchmarks/pull-out-of-order.pbd
--- a/suites/hg/benchmarks/pull-out-of-order.pbd
+++ b/suites/hg/benchmarks/pull-out-of-order.pbd
@@ -8,10 +8,16 @@
 
 [simple-command]
 command="""
-ls -1 pull-nodes/out-of-order-$ROUNDS-$STEPS-$OOO_COUNT/pull-round-????.nodes | sort |
-while read file_path; do
-    hg $ISSUE6528_ARG $PULLED_DELTA_REUSE_CFG pull -R temporary-pull-source "$MAIN_REPO" `cat $file_path`;
-done;
+if [ "$TIMED_STEP" = "last" ]; then
+    hg $ISSUE6528_ARG $PULLED_DELTA_REUSE_CFG pull -R temporary-pull-source \
+    "$MAIN_REPO" `cat last-pull-step.nodes`;
+else
+    ls -1 pull-nodes/out-of-order-$ROUNDS-$STEPS-$OOO_COUNT/pull-round-????.nodes \
+    | sort | while read file_path; do
+        hg $ISSUE6528_ARG $PULLED_DELTA_REUSE_CFG \
+          pull -R temporary-pull-source "$MAIN_REPO" `cat $file_path`;
+    done;
+fi
 """
 prepare-run = """
 rm -rf temporary-pull-source;
@@ -26,6 +32,18 @@
          --config extensions.strip= strip \
          --no-backup \
          'nodefromfile("striproots")';
+    if [ "$TIMED_STEP" = "last" ]; then
+        echo "pulling out of order (but the last pull)"
+        ls -1 pull-nodes/out-of-order-$ROUNDS-$STEPS-$OOO_COUNT/pull-round-????.nodes | \
+        sort | head -n -1 | \
+        while read file_path; do
+            hg $ISSUE6528_ARG $PULLED_DELTA_REUSE_CFG \
+              -R wip-pull-source \
+              pull "$MAIN_REPO" `cat $file_path`;
+        cp `ls -1 pull-nodes/out-of-order-$ROUNDS-$STEPS-$OOO_COUNT/pull-round-????.nodes \
+        | sort | tail -n 1` last-pull-step.nodes ;
+    done;
+    fi
     echo "warming cache"
     hg -R wip-pull-source debugupdatecache;
     echo "reference repo ready"
@@ -55,6 +73,12 @@
 environment.PULLED_DELTA_REUSE_CFG="--config 'paths.*:pulled-delta-reuse-policy=forced'"
 constraints.compatible-revision-range="f35cf52acabd::"
 
+[simple-command.variants.dimensions.timed-step.all]
+default=true
+
+[simple-command.variants.dimensions.timed-step.last]
+environment.TIMED_STEP="last"
+
 
 [simple-command.variants.dimensions.rounds.5]
 default=true