tools: Add script to see PRs as authors intended.

This commit is contained in:
Rohitt Vashishtha 2017-06-01 23:29:52 +05:30 committed by Tim Abbott
parent 47ec9fbbe2
commit 443e31e348
1 changed files with 16 additions and 0 deletions

16
tools/fetch-pull-request Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
set -e
set -x
if ! git diff-index --quiet HEAD; then
set +x
echo "There are uncommitted changes:"
git status --short
echo "Doing nothing to avoid losing your work."
exit 1
fi
request_id="$1"
remote=${2:-"upstream"}
git fetch "$remote" "pull/$request_id/head"
git checkout -B "review-original-${request_id}"
git reset --hard FETCH_HEAD