forked from nipy/heudiconv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-compare-two-versions.sh
executable file
·50 lines (40 loc) · 1.25 KB
/
test-compare-two-versions.sh
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
#!/bin/bash
# A script which is for now very ad-hoc and to be ran outside of this codebase and
# assumes having two repos of heudiconv -- one under heudiconv and another heudiconv-master
# with virtualenvs setup inside under venvs/dev.
# Was used for https://github.com/nipy/heudiconv/pull/129
PS1=+
set -eu
outdir=${OUTDIR:=compare-versions}
RUN=echo
RUN=
#if [ -e $outdir ]; then
# # just fail if exists already
# echo "$outdir exists already -- remove if you want to run the comparison" >&2
# exit 1
#fi
mkdir -p $outdir
function run() {
heudiconvdir="$1"
out=$outdir/$2
shift
shift
source $heudiconvdir/venvs/dev/bin/activate
whichheudiconv=$(which heudiconv)
# just do full conversion
echo "Running $whichheudiconv with log in $out.log"
$RUN heudiconv --random-seed 1 -c dcm2niix -o $out --datalad --bids "$@" >| $out.log 2>&1
}
other=other
run heudiconv $other "$@"
run heudiconv-master master "$@"
cd $outdir
#git remote add rolando "$outdir/rolando"
#git fetch rolando
# git diff --stat rolando/master..
if diff -Naur --exclude=.git --ignore-matching-lines='^\s*id\s*=.*' $other master >| diff.patch; then
echo "Results are identical"
else
echo "Results differ: $PWD/diff.patch"
cat diff.patch | diffstat
fi