blob: 1ece3b34606ef9f1013fec32483ce4de8def5ef2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!@BASH_PATH@
#
# Copyright 2016-2023 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
# diff fails with ec=2 if no predecessor is found;
# this uses '=' GNU extension to sed, if that's not available,
# one can use: hline=`echo "$${p}" | grep -Fn "$${hunk}" | cut -d: -f1`;
# XXX: use line information from hunk to avoid "not detected" for ambiguity
for p in $*; do
set $(echo "$p" | tr '-' ' ')
echo "### *-$2.rng vs. predecessor"
for v in *-"$2".rng; do
echo "#### $v vs. predecessor"
b=$(echo "$v" | cut -d- -f1)
old=$(./best-match.sh "$b" "$1")
p=$(diff -u "$old" "$v" 2>/dev/null)
case $? in
1)
echo "$p" | sed -n -e '/^@@ /!d;=;p' -e ':l;n;/^\([- ]\|+.*<[^ />]\+\([^/>]\+="ID\|>$$\)\)/bl;s/^[+ ]\(.*\)/\1/p' |
while read -r hline; do
if read -r h; then
read -r i
else
break
fi
iline=$(grep -Fn "$i" "$v" | cut -d: -f1)
if [ "$(echo "$iline" | wc -l)" = "1" ]; then
ctxt=$({ sed -n -e "1,$((iline - 1))p" "$v"
echo "<inject id=\"GOAL\"/>$i"
sed -n -e "$((iline + 1)),$ p" "$v"
} | xsltproc --param skip 1 context-of.xsl -)
else
ctxt="(not detected)"
fi
echo "$p" | sed -n -e "$((hline - 2)),$hline!d" -e '/^\(+++\|---\)/p'
echo "$h context: $ctxt"
echo "$p" | sed -n -e "1,${hline}d" -e '/^\(---\|@@ \)/be;p;d;:e;n;be'
done
;;
2)
echo "##### $v has no predecessor"
;;
esac
done
done
|