# HG changeset patch # User Anton Shestakov # Date 1590025884 -28800 # Node ID 3c5bcb8ecf3a366aa1b652ff5630a799f53f15a2 # Parent a6e2bb90db2496c6cff8e8d9f388b455f046315f packaging: move check-compat-strings.sh to tests/testlib/ Since we're not including contrib/ in pip packages, this test failed when trying to run not from evolve repo. diff -r a6e2bb90db24 -r 3c5bcb8ecf3a contrib/check-compat-strings.sh --- a/contrib/check-compat-strings.sh Sat May 16 16:44:29 2020 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -unset GREP_OPTIONS - -# This script finds compatibility-related comments with a node hash specified -# in all files in a given directory (. by default) and looks up the hash in a -# repo (~/hg by default) to determine if each of the comments is correct and, -# if not, it suggests the correct release. This can prevent accidentally -# removing a piece of code that was misattributed to a different (earlier) -# release of core hg. - -# Usage: $0 WDIR HGREPO where WDIR is usually evolve/hgext3rd/ and HGREPO is -# the place with core Mercurial repo (not just checkout). Said repo has to be -# sufficiently up-to-date, otherwise this script may not work correctly. - -workdir=${1:-'.'} -hgdir=${2:-~/hg} -grep -Ern 'hg <= [0-9.]+ \([0-9a-f+]+\)' "$workdir" | while read -r line; do - bashre='hg <= ([0-9.]+) \(([0-9a-f+]+)\)' - if [[ $line =~ $bashre ]]; then - expected=${BASH_REMATCH[1]} - revset=${BASH_REMATCH[2]} - tagrevset="max(tag('re:^[0-9]\\.[0-9]$') - ($revset)::)" - lastrel=$(HGPLAIN=1 hg --cwd "$hgdir" log -r "$tagrevset" -T '{tags}') - if [[ "$lastrel" != "$expected" ]]; then - echo "$line" - echo "actual last major release without $revset is $lastrel" - echo - fi - fi -done diff -r a6e2bb90db24 -r 3c5bcb8ecf3a tests/test-check-compat-strings.t --- a/tests/test-check-compat-strings.t Sat May 16 16:44:29 2020 +0800 +++ b/tests/test-check-compat-strings.t Thu May 21 09:51:24 2020 +0800 @@ -5,4 +5,4 @@ > evolution = all > EOF - $ $TESTDIR/../contrib/check-compat-strings.sh "$TESTDIR/../hgext3rd/" "$RUNTESTDIR/.." + $ $TESTDIR/testlib/check-compat-strings.sh "$TESTDIR/../hgext3rd/" "$RUNTESTDIR/.." diff -r a6e2bb90db24 -r 3c5bcb8ecf3a tests/testlib/check-compat-strings.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/testlib/check-compat-strings.sh Thu May 21 09:51:24 2020 +0800 @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -euo pipefail + +unset GREP_OPTIONS + +# This script finds compatibility-related comments with a node hash specified +# in all files in a given directory (. by default) and looks up the hash in a +# repo (~/hg by default) to determine if each of the comments is correct and, +# if not, it suggests the correct release. This can prevent accidentally +# removing a piece of code that was misattributed to a different (earlier) +# release of core hg. + +# Usage: $0 WDIR HGREPO where WDIR is usually evolve/hgext3rd/ and HGREPO is +# the place with core Mercurial repo (not just checkout). Said repo has to be +# sufficiently up-to-date, otherwise this script may not work correctly. + +workdir=${1:-'.'} +hgdir=${2:-~/hg} +grep -Ern 'hg <= [0-9.]+ \([0-9a-f+]+\)' "$workdir" | while read -r line; do + bashre='hg <= ([0-9.]+) \(([0-9a-f+]+)\)' + if [[ $line =~ $bashre ]]; then + expected=${BASH_REMATCH[1]} + revset=${BASH_REMATCH[2]} + tagrevset="max(tag('re:^[0-9]\\.[0-9]$') - ($revset)::)" + lastrel=$(HGPLAIN=1 hg --cwd "$hgdir" log -r "$tagrevset" -T '{tags}') + if [[ "$lastrel" != "$expected" ]]; then + echo "$line" + echo "actual last major release without $revset is $lastrel" + echo + fi + fi +done