##// END OF EJS Templates
phab-refresh: do not error out when the stack is empty...
marmoute -
r46637:372409eb default
parent child Browse files
Show More
@@ -1,34 +1,34 b''
1 #!/bin/bash
1 #!/bin/bash
2 set -eu
2 set -eu
3
3
4 revision_in_stack=`hg log --rev '.#stack and ::.' -T '\nONE-REV\n' | grep 'ONE-REV' | wc -l`
4 revision_in_stack=`hg log --rev '.#stack and ::.' -T '\nONE-REV\n' | grep 'ONE-REV' | wc -l`
5 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`
5 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`
6
6
7 if [[ $revision_in_stack -eq 0 ]]; then
7 if [[ $revision_in_stack -eq 0 ]]; then
8 echo "stack is empty" >&2
8 echo "stack is empty" >&2
9 exit 1
9 exit 0
10 fi
10 fi
11
11
12 if [[ $revision_on_phab -eq 0 ]]; then
12 if [[ $revision_on_phab -eq 0 ]]; then
13 echo "no tracked diff in this stack" >&2
13 echo "no tracked diff in this stack" >&2
14 exit 0
14 exit 0
15 fi
15 fi
16
16
17 if [[ $revision_on_phab -lt $revision_in_stack ]]; then
17 if [[ $revision_on_phab -lt $revision_in_stack ]]; then
18 echo "not all stack changesets (${revision_in_stack}) have matching Phabricator Diff (${revision_on_phab})" >&2
18 echo "not all stack changesets (${revision_in_stack}) have matching Phabricator Diff (${revision_on_phab})" >&2
19 exit 2
19 exit 2
20 fi
20 fi
21
21
22 if [[ "$PHABRICATOR_TOKEN" == "" ]]; then
22 if [[ "$PHABRICATOR_TOKEN" == "" ]]; then
23 echo 'missing $PHABRICATOR_TOKEN variable' >&2
23 echo 'missing $PHABRICATOR_TOKEN variable' >&2
24 exit 2
24 exit 2
25 fi
25 fi
26
26
27 hg \
27 hg \
28 --config extensions.phabricator= \
28 --config extensions.phabricator= \
29 --config phabricator.url=https://phab.mercurial-scm.org/ \
29 --config phabricator.url=https://phab.mercurial-scm.org/ \
30 --config phabricator.callsign=HG \
30 --config phabricator.callsign=HG \
31 --config auth.phabricator.schemes=https \
31 --config auth.phabricator.schemes=https \
32 --config auth.phabricator.prefix=phab.mercurial-scm.org \
32 --config auth.phabricator.prefix=phab.mercurial-scm.org \
33 --config auth.phabricator.phabtoken=$PHABRICATOR_TOKEN \
33 --config auth.phabricator.phabtoken=$PHABRICATOR_TOKEN \
34 phabsend --rev '.#stack and ::.'
34 phabsend --rev '.#stack and ::.'
General Comments 0
You need to be logged in to leave comments. Login now