Mercurial > evolve
comparison tests/testlib/check-compat-strings.sh @ 5467:d04a9bf34b79 mercurial-4.7
test-compat: merge mercurial-4.8 into mercurial-4.7
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Fri, 31 Jul 2020 19:14:30 +0800 |
parents | 3c5bcb8ecf3a |
children |
comparison
equal
deleted
inserted
replaced
5317:011b53a9d03c | 5467:d04a9bf34b79 |
---|---|
1 #!/usr/bin/env bash | |
2 set -euo pipefail | |
3 | |
4 unset GREP_OPTIONS | |
5 | |
6 # This script finds compatibility-related comments with a node hash specified | |
7 # in all files in a given directory (. by default) and looks up the hash in a | |
8 # repo (~/hg by default) to determine if each of the comments is correct and, | |
9 # if not, it suggests the correct release. This can prevent accidentally | |
10 # removing a piece of code that was misattributed to a different (earlier) | |
11 # release of core hg. | |
12 | |
13 # Usage: $0 WDIR HGREPO where WDIR is usually evolve/hgext3rd/ and HGREPO is | |
14 # the place with core Mercurial repo (not just checkout). Said repo has to be | |
15 # sufficiently up-to-date, otherwise this script may not work correctly. | |
16 | |
17 workdir=${1:-'.'} | |
18 hgdir=${2:-~/hg} | |
19 grep -Ern 'hg <= [0-9.]+ \([0-9a-f+]+\)' "$workdir" | while read -r line; do | |
20 bashre='hg <= ([0-9.]+) \(([0-9a-f+]+)\)' | |
21 if [[ $line =~ $bashre ]]; then | |
22 expected=${BASH_REMATCH[1]} | |
23 revset=${BASH_REMATCH[2]} | |
24 tagrevset="max(tag('re:^[0-9]\\.[0-9]$') - ($revset)::)" | |
25 lastrel=$(HGPLAIN=1 hg --cwd "$hgdir" log -r "$tagrevset" -T '{tags}') | |
26 if [[ "$lastrel" != "$expected" ]]; then | |
27 echo "$line" | |
28 echo "actual last major release without $revset is $lastrel" | |
29 echo | |
30 fi | |
31 fi | |
32 done |