-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreview-diff-pair
More file actions
executable file
·54 lines (43 loc) · 1.46 KB
/
Copy pathreview-diff-pair
File metadata and controls
executable file
·54 lines (43 loc) · 1.46 KB
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
#!/bin/bash
set -e; set -o pipefail; source __review-shared.sh
if [[ $# -lt 2 ]]; then
error "usage: $(basename $0) [prev name] [curr name] <prev version> <curr version>"
fi
prev_name=$1
curr_name=$2
prev_version=$3
curr_version=$4
check_prep
if ! has_review_started ${prev_name}; then
error "review for '${prev_name}' not started"
fi
if ! has_review_started ${curr_name}; then
error "review for '${curr_name}' not started"
fi
prev_msgid="$(get_review_msgid ${prev_name})"
curr_msgid="$(get_review_msgid ${curr_name})"
if ! is_valid_msgid "${prev_msgid}"; then
prev_version=${prev_version:-1}
fi
if ! is_valid_msgid "${curr_msgid}"; then
curr_version=${curr_version:-1}
fi
tmpdir="$(get_temp_dir)"
cleanup_dir_on_exit $tmpdir
prev_mbox_path=$(retrieve_mbox "${prev_name}" ${prev_msgid} $tmpdir quiet)
if [[ -z ${prev_mbox_path} ]]; then
error "could not retrieve mbox for '${prev_name}'"
fi
curr_mbox_path=$(retrieve_mbox "${curr_name}" ${curr_msgid} $tmpdir quiet)
if [[ -z ${curr_mbox_path} ]]; then
error "could not retrieve mbox for '${curr_name}'"
fi
if [[ -z "${prev_version}" ]]; then
prev_version=${prev_version:-"$(get_latest_revision ${prev_mbox_path})"}
fi
if [[ -z "${curr_version}" ]]; then
curr_version=${curr_version:-"$(get_latest_revision ${curr_mbox_path})"}
fi
prev_mbox_path=${prev_mbox_path:-stub}
curr_mbox_path=${curr_mbox_path:-stub}
review_range_diff ${prev_name} ${curr_name} ${prev_mbox_path} ${curr_mbox_path} $tmpdir ${prev_version} ${curr_version}