Changeset View
Changeset View
Standalone View
Standalone View
tools/tools/git/git-arc.sh
Show First 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | elif [ $(echo "$diff" | wc -l) -ne 1 ]; then | ||||
err "found multiple reviews with the same title" | err "found multiple reviews with the same title" | ||||
fi | fi | ||||
echo $diff | echo $diff | ||||
} | } | ||||
create_one_review() | create_one_review() | ||||
{ | { | ||||
local childphid commit dir doprompt msg parent parentphid reviewers | local childphid commit doprompt msg parent parentphid reviewers | ||||
local subscribers | local subscribers | ||||
commit=$1 | commit=$1 | ||||
reviewers=$2 | reviewers=$2 | ||||
subscribers=$3 | subscribers=$3 | ||||
parent=$4 | parent=$4 | ||||
doprompt=$5 | doprompt=$5 | ||||
if [ "$doprompt" ] && ! show_and_prompt $commit; then | if [ "$doprompt" ] && ! show_and_prompt $commit; then | ||||
return 1 | return 1 | ||||
fi | fi | ||||
git checkout -q $commit | git checkout -q $commit | ||||
dir=$(git rev-parse --git-dir)/arc | msg=$(mktemp) | ||||
mkdir -p "$dir" | |||||
msg=${dir}/create-message | |||||
git show -s --format='%B' $commit > $msg | git show -s --format='%B' $commit > $msg | ||||
printf "\nTest Plan:\n" >> $msg | printf "\nTest Plan:\n" >> $msg | ||||
printf "\nReviewers:\n" >> $msg | printf "\nReviewers:\n" >> $msg | ||||
printf "${reviewers}\n" >> $msg | printf "${reviewers}\n" >> $msg | ||||
printf "\nSubscribers:\n" >> $msg | printf "\nSubscribers:\n" >> $msg | ||||
printf "${subscribers}\n" >> $msg | printf "${subscribers}\n" >> $msg | ||||
yes | env EDITOR=true \ | yes | env EDITOR=true \ | ||||
arc diff --never-apply-patches --create --allow-untracked $BROWSE HEAD~ | arc diff --message-file $msg --never-apply-patches --create --allow-untracked $BROWSE HEAD~ | ||||
[ $? -eq 0 ] || err "could not create Phabricator diff" | [ $? -eq 0 ] || err "could not create Phabricator diff" | ||||
if [ -n "$parent" ]; then | if [ -n "$parent" ]; then | ||||
diff=$(commit2diff $commit) | diff=$(commit2diff $commit) | ||||
[ -n "$diff" ] || err "failed to look up review ID for $commit" | [ -n "$diff" ] || err "failed to look up review ID for $commit" | ||||
childphid=$(diff2phid $diff) | childphid=$(diff2phid $diff) | ||||
parentphid=$(diff2phid $parent) | parentphid=$(diff2phid $parent) | ||||
echo '{ | echo '{ | ||||
"objectIdentifier": "'${childphid}'", | "objectIdentifier": "'${childphid}'", | ||||
"transactions": [ | "transactions": [ | ||||
{ | { | ||||
"type": "parents.add", | "type": "parents.add", | ||||
"value": ["'${parentphid}'"] | "value": ["'${parentphid}'"] | ||||
} | } | ||||
]}' | | ]}' | | ||||
arc call-conduit -- differential.revision.edit >&3 | arc call-conduit -- differential.revision.edit >&3 | ||||
fi | fi | ||||
rm -f $msg | |||||
return 0 | return 0 | ||||
} | } | ||||
# Get a list of reviewers who accepted the specified diff. | # Get a list of reviewers who accepted the specified diff. | ||||
diff2reviewers() | diff2reviewers() | ||||
{ | { | ||||
local diff phid reviewid userids | local diff phid reviewid userids | ||||
▲ Show 20 Lines • Show All 323 Lines • Show Last 20 Lines |