diff --git a/contrib/heptapod-ci.yml b/contrib/heptapod-ci.yml --- a/contrib/heptapod-ci.yml +++ b/contrib/heptapod-ci.yml @@ -1,12 +1,13 @@ stages: - tests + - phabricator image: registry.heptapod.net/mercurial/ci-images/mercurial-core # The runner made a clone as root. # We make a new clone owned by user used to run the step. before_script: - - hg clone . /tmp/mercurial-ci/ --noupdate + - hg clone . /tmp/mercurial-ci/ --noupdate --config phases.publish=no - hg -R /tmp/mercurial-ci/ update `hg log --rev '.' --template '{node}'` - cd /tmp/mercurial-ci/ - ls -1 tests/test-check-*.* > /tmp/check-tests.txt @@ -22,12 +23,6 @@ - echo "$RUNTEST_ARGS" - HGMODULEPOLICY="$TEST_HGMODULEPOLICY" "$PYTHON" tests/run-tests.py --color=always $RUNTEST_ARGS -checks-py3: - <<: *runtests - variables: - RUNTEST_ARGS: "--time --test-list /tmp/check-tests.txt" - PYTHON: python3 - rust-cargo-test-py3: stage: tests script: @@ -35,3 +30,15 @@ - make rust-tests variables: PYTHON: python3 + +phabricator-refresh: + stage: phabricator + script: + - hg version -v + - hg log -r . + - hg phase -r . + - hg log --rev '.#stack and ::.' -T '\nONE-REV\n' | grep 'ONE-REV' | wc -l + - hg log --rev '.#stack and ::. and desc("re:\nDifferential Revision\x3A [^\n]+D\d+$")' -T '\nONE-REV\n' | grep 'ONE-REV' | wc -l + - hg log --rev '.#stack and ::.' -T '\nONE-REV\n' + - hg log --rev '.#stack and ::. and desc("re:\nDifferential Revision\x3A [^\n]+D\d+$")' -T '\nONE-REV\n' + - ./contrib/phab-refresh-stack.sh diff --git a/contrib/phab-refresh-stack.sh b/contrib/phab-refresh-stack.sh --- a/contrib/phab-refresh-stack.sh +++ b/contrib/phab-refresh-stack.sh @@ -1,32 +1,34 @@ #!/bin/bash -revision_in_stack=`hg log --rev '.#stack' -T '\nONE-REV\n' | grep 'ONE-REV' | wc -l` -revision_on_phab=`hg log --rev '.#stack and desc("re:\nDifferential Revision: [^\n]+D\d+$")' -T '\nONE-REV\n' | grep 'ONE-REV' | wc -l` +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 fi -if [[ $revision_in_phab -eq 0 ]]; then +if [[ $revision_on_phab -eq 0 ]]; then echo "no tracked diff in this stack" >&2 exit 0 fi -if [[ $revision_in_phab -lt $revision_in_stack ]]; then - echo "not all stack changesets (${revision_in_stack}) have matching Phabricator Diff (${revision_in_phab})" >&2 +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 fi if [[ "$PHABRICATOR_TOKEN" == "" ]]; then - echo 'missing $PHABRICATOR_TOKEN variable' >&2 + echo 'missing $PHABRICATOR_TOKEN variable' >&2 exit 2 fi hg \ --config extensions.phabricator= \ -phabricator.url=https://phab.mercurial-scm.org/ \ -phabricator.callsign=HG \ -auth.phabricator.schemes=https \ -auth.phabricator.prefix=phab.mercurial-scm.org \ -auth.hg.phabtoken=$PHABRICATOR_TOKEN \ -phabsend --rev '.#stack' +--config phabricator.url=https://phab.mercurial-scm.org/ \ +--config phabricator.callsign=HG \ +--config auth.phabricator.schemes=https \ +--config auth.phabricator.prefix=phab.mercurial-scm.org \ +--config auth.phabricator.phabtoken=$PHABRICATOR_TOKEN \ +phabsend --rev '.#stack and ::.'