changeset 5081:17fac26833da stable

contrib: make merge-test-compat.sh more topic-friendly
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 23 Jan 2020 11:01:46 +0100
parents 6db9e2350948
children f1ed956b2a90 946ebd8f08ea
files contrib/merge-test-compat.sh
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/merge-test-compat.sh	Mon Jan 20 22:43:11 2020 +0700
+++ b/contrib/merge-test-compat.sh	Thu Jan 23 11:01:46 2020 +0100
@@ -5,9 +5,21 @@
 
 compatbranches=$(hg branches --quiet | grep 'mercurial-' | grep -v ':' | sort -n --reverse)
 prev='stable'
+topic=${1:-'test-compat'}
 for branch in $compatbranches; do
-    hg up "$branch"
-    hg merge "$prev"
+    # Logic in the revsets below:
+    # 1. There is target topic on stable or compatibility branch: merge all
+    # those commits, they are related to our work and need to pass tests on all
+    # compatibility branches.
+    # 2. There is no target topic: avoid any commits that have topic set, they
+    # are definitely unrelated to what we're doing.
+    # In other words, if you want to test certain commits, assign them all to
+    # one topic and provide that topic as the first argument to this script.
+    uptarget="first(max(branch('$branch') and topic('$topic')) or max(branch('$branch') and not topic()))"
+    hg up -r "$uptarget"
+    hg topic "$topic"
+    mergetarget="first(max(branch('$prev') and topic('$topic')) or max(branch('$prev') and not topic()))"
+    hg merge -r "$mergetarget"
     hg commit -m "test-compat: merge $prev into $branch"
     prev=$branch
 done