Commit 84e9df31 authored by Pierre-Yves David's avatar Pierre-Yves David 🐙
Browse files

contrib: add a small script to refresh all diff in the current stack

This will be useful to introduce automatic refresh through heptapod.

Differential Revision:
parent b0a70255c86a
set -eu
revision_in_stack=`hg log --rev '.#stack and ::.' -T '\nONE-REV\n' | grep 'ONE-REV' | wc -l`
revision_on_phab=`hg log --rev '.#stack and ::. and desc("re:\nDifferential Revision: [^\n]+D\d+$")' -T '\nONE-REV\n' | grep 'ONE-REV' | wc -l`
if [[ $revision_in_stack -eq 0 ]]; then
echo "stack is empty" >&2
exit 1
if [[ $revision_on_phab -eq 0 ]]; then
echo "no tracked diff in this stack" >&2
exit 0
if [[ $revision_on_phab -lt $revision_in_stack ]]; then
echo "not all stack changesets (${revision_in_stack}) have matching Phabricator Diff (${revision_on_phab})" >&2
exit 2
if [[ "$PHABRICATOR_TOKEN" == "" ]]; then
echo 'missing $PHABRICATOR_TOKEN variable' >&2
exit 2
hg \
--config extensions.phabricator= \
--config phabricator.url= \
--config phabricator.callsign=HG \
--config auth.phabricator.schemes=https \
--config \
--config auth.phabricator.phabtoken=$PHABRICATOR_TOKEN \
phabsend --rev '.#stack and ::.'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment