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
```
--- 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