-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiff_prepare-310
executable file
·37 lines (30 loc) · 1.27 KB
/
diff_prepare-310
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
#!/bin/bash
# Prepare a file listing files/dirs not in the target Moodle version that were
# in previous versions, the versions the target version can directly upgrade
# from (example: for Moodle 3.10 all the files in Moodle 3.5 to 3.9 that aren't
# in Moodle 3.10). Results are placed in /tmp/not_in_$target_branch.
target_branch=MOODLE_310_STABLE
tempdir=`mktemp -d`
if [ "$?" -ne "0" ]; then
>&2 echo "Error: Unable to create temporary directory."
exit 1
fi
# I have a reference repo in /usr/share/repos/moodle
git clone --reference-if-able /usr/share/repos/moodle \
git://git.moodle.org/moodle.git $tempdir/moodle
# Order is important here: target version first then other branches.
for branch in $target_branch MOODLE_{35..39}_STABLE; do \
git checkout $branch
find | sort > $tempdir/find-$branch
diff --changed-group-format='%<' --unchanged-group-format='' \
$tempdir/find-$branch $tempdir/find-$target_branch \
> $tempdir/diff-$branch
cp $tempdir/find-$target_branch $tempdir/$target_branch.diff
if [ "$branch" != "$target_branch" ]; then
comm -3 $tempdir/$target_branch.diff $tempdir/diff-$branch \
> $tempdir/$target_branch.diff
fi
done
sed -i 's/^\s\+.//' $tempdir/$target_branch.diff
mv $tempdir/$target_branch.diff /tmp/not_in_$target_branch
rm -r $tempdir