Show More
@@ -1,40 +1,41 | |||||
1 | #!/bin/bash |
|
1 | #!/bin/bash | |
2 | set -eu |
|
2 | set -eu | |
3 |
|
3 | |||
4 | revision_in_stack=`hg log \ |
|
4 | revision_in_stack=`hg log \ | |
5 | --rev '.#stack and ::. and topic()' \ |
|
5 | --rev '.#stack and ::. and topic()' \ | |
6 | -T '\nONE-REV\n' \ |
|
6 | -T '\nONE-REV\n' \ | |
7 | | grep 'ONE-REV' | wc -l` |
|
7 | | grep 'ONE-REV' | wc -l` | |
8 | revision_on_phab=`hg log \ |
|
8 | revision_on_phab=`hg log \ | |
9 | --rev '.#stack and ::. and topic() and desc("re:\nDifferential Revision: [^\n]+D\d+$")'\ |
|
9 | --rev '.#stack and ::. and topic() and desc("re:\nDifferential Revision: [^\n]+D\d+$")'\ | |
10 | -T '\nONE-REV\n' \ |
|
10 | -T '\nONE-REV\n' \ | |
11 | | grep 'ONE-REV' | wc -l` |
|
11 | | grep 'ONE-REV' | wc -l` | |
12 |
|
12 | |||
13 | if [[ $revision_in_stack -eq 0 ]]; then |
|
13 | if [[ $revision_in_stack -eq 0 ]]; then | |
14 | echo "stack is empty" >&2 |
|
14 | echo "stack is empty" >&2 | |
15 | exit 0 |
|
15 | exit 0 | |
16 | fi |
|
16 | fi | |
17 |
|
17 | |||
18 | if [[ $revision_on_phab -eq 0 ]]; then |
|
18 | if [[ $revision_on_phab -eq 0 ]]; then | |
19 | echo "no tracked diff in this stack" >&2 |
|
19 | echo "no tracked diff in this stack" >&2 | |
20 | exit 0 |
|
20 | exit 0 | |
21 | fi |
|
21 | fi | |
22 |
|
22 | |||
23 | if [[ $revision_on_phab -lt $revision_in_stack ]]; then |
|
23 | if [[ $revision_on_phab -lt $revision_in_stack ]]; then | |
24 | echo "not all stack changesets (${revision_in_stack}) have matching Phabricator Diff (${revision_on_phab})" >&2 |
|
24 | echo "not all stack changesets (${revision_in_stack}) have matching Phabricator Diff (${revision_on_phab})" >&2 | |
25 | exit 2 |
|
25 | exit 2 | |
26 | fi |
|
26 | fi | |
27 |
|
27 | |||
28 | if [[ "$PHABRICATOR_TOKEN" == "" ]]; then |
|
28 | if [[ "$PHABRICATOR_TOKEN" == "" ]]; then | |
29 | echo 'missing $PHABRICATOR_TOKEN variable' >&2 |
|
29 | echo 'missing $PHABRICATOR_TOKEN variable' >&2 | |
30 | exit 2 |
|
30 | exit 2 | |
31 | fi |
|
31 | fi | |
32 |
|
32 | |||
33 | hg \ |
|
33 | hg \ | |
34 | --config extensions.phabricator= \ |
|
34 | --config extensions.phabricator= \ | |
35 | --config phabricator.url=https://phab.mercurial-scm.org/ \ |
|
35 | --config phabricator.url=https://phab.mercurial-scm.org/ \ | |
36 | --config phabricator.callsign=HG \ |
|
36 | --config phabricator.callsign=HG \ | |
37 | --config auth.phabricator.schemes=https \ |
|
37 | --config auth.phabricator.schemes=https \ | |
38 | --config auth.phabricator.prefix=phab.mercurial-scm.org \ |
|
38 | --config auth.phabricator.prefix=phab.mercurial-scm.org \ | |
39 | --config auth.phabricator.phabtoken=$PHABRICATOR_TOKEN \ |
|
39 | --config auth.phabricator.phabtoken=$PHABRICATOR_TOKEN \ | |
40 | phabsend --rev '.#stack and ::. and topic()' \ |
|
40 | phabsend --rev '.#stack and ::. and topic()' \ | |
|
41 | "$@" |
General Comments 0
You need to be logged in to leave comments.
Login now