heptapod-ci: add a script to map evolve branch to mercurial revision for tests stable
authorAnton Shestakov <av6@dwimlabs.net>
Thu, 21 Nov 2019 14:18:35 +0700
branchstable
changeset 4966 4f3c87584a4a
parent 4960 4941bb6d179c
child 4967 844c9eb2400f
child 4973 f3faafa1e064
heptapod-ci: add a script to map evolve branch to mercurial revision for tests map-hg-rev.sh can be tested using this command: ```sh for i in $(hg log -T '{branch}\n' | sort -u); do echo $i $(testlib/map-hg-rev.sh $i) done ```
.gitlab-ci.yml
tests/testlib/map-hg-rev.sh
--- a/.gitlab-ci.yml	Mon Nov 18 12:55:44 2019 +0100
+++ b/.gitlab-ci.yml	Thu Nov 21 14:18:35 2019 +0700
@@ -7,26 +7,30 @@
     image: octobus/ci-py2-hgext3rd
     script:
         - hg pull -R /ci/repos/mercurial/
-        - hg -R /ci/repos/mercurial/ update `hg log -r . -T '{branch}'`
+        - hg_rev=$(tests/testlib/map-hg-rev.sh "$(hg log -r . -T '{branch}')")
+        - hg -R /ci/repos/mercurial/ update "$hg_rev"
         - (cd tests; /ci/repos/mercurial/tests/run-tests.py --color=always)
 
 tests-py2-pure:
     image: octobus/ci-py2-hgext3rd
     script:
         - hg pull -R /ci/repos/mercurial/
-        - hg -R /ci/repos/mercurial/ update `hg log -r . -T '{branch}'`
+        - hg_rev=$(tests/testlib/map-hg-rev.sh "$(hg log -r . -T '{branch}')")
+        - hg -R /ci/repos/mercurial/ update "$hg_rev"
         - (cd tests; /ci/repos/mercurial/tests/run-tests.py --color=always --pure)
 
 tests-py3-cext:
     image: octobus/ci-py3-hgext3rd
     script:
         - hg pull -R /ci/repos/mercurial/
-        - hg -R /ci/repos/mercurial/ update `hg log -r . -T '{branch}'`
+        - hg_rev=$(tests/testlib/map-hg-rev.sh "$(hg log -r . -T '{branch}')")
+        - hg -R /ci/repos/mercurial/ update "$hg_rev"
         - (cd tests; python3 /ci/repos/mercurial/tests/run-tests.py --color=always)
 
 tests-py3-pure:
     image: octobus/ci-py3-hgext3rd
     script:
         - hg pull -R /ci/repos/mercurial/
-        - hg -R /ci/repos/mercurial/ update `hg log -r . -T '{branch}'`
+        - hg_rev=$(tests/testlib/map-hg-rev.sh "$(hg log -r . -T '{branch}')")
+        - hg -R /ci/repos/mercurial/ update "$hg_rev"
         - (cd tests; python3 /ci/repos/mercurial/tests/run-tests.py --color=always --pure)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/testlib/map-hg-rev.sh	Thu Nov 21 14:18:35 2019 +0700
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -eu
+
+case $1 in
+    default)
+        echo default
+        ;;
+    mercurial-*)
+        exp=$(echo "$1" | cut -d- -f2 | sed 's#\.#\\.#g')
+        echo 'max(tag("re:^'"$exp"'"))'
+        ;;
+    *)
+        echo stable
+        ;;
+esac