-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreview-diff-each
More file actions
executable file
·40 lines (32 loc) · 882 Bytes
/
Copy pathreview-diff-each
File metadata and controls
executable file
·40 lines (32 loc) · 882 Bytes
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
#!/bin/bash
set -e; set -o pipefail; source __review-shared.sh
if [[ $# -lt 1 ]]; then
error "usage: $(basename $0) [name] <version>"
fi
name=$1
version=$2
check_prep
tag=$(get_review_tag $name)
if ! rev_exists $tag; then
error "review for '$name' not started"
fi
msgid="$(get_review_msgid $name)"
if ! is_valid_msgid "$msgid"; then
version=${version:-1}
fi
if [[ -z "$version" ]]; then
tmpdir="$(get_temp_dir)"
cleanup_dir_on_exit $tmpdir
mbox_path=$(retrieve_mbox $name $msgid $tmpdir quiet)
version="$(get_latest_revision ${mbox_path})"
fi
branch="$(get_review_branch $name $version)"
if ! rev_exists $branch; then
error "Cannot find review branch '$branch' for '$name' at version $version"
fi
from=$(get_ref_hash "$tag")
to=$(get_ref_hash "$branch")
curr_ref="$(get_curr_ref)"
git checkout -q $to
git rebase --exec "git show" $from
git checkout -q "${curr_ref}"