Skip to content

Commit

Permalink
[issue5] add branch check to cleanup script
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickFerber committed Jul 20, 2020
1 parent 01a28d7 commit e9e40c2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions run-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ source "${VIRTUALENV}/bin/activate"
export HGRCPATH=
export HGPLAIN=


REGEX_BRANCHES="^$(hg branches --template "{branch}|" | \
sed "s/|$//g" | sed "s/\-/\\\-/g" | sed "s/\./\\\./g")$"
if [[ ! "issue323" =~ ${REGEX_BRANCHES} ]] || \
[[ ! "ipc-2011-fixes" =~ ${REGEX_BRANCHES} ]]; then
echo "Your repository is missing the branches 'issue323' and 'ipc-2011-fixes' for the conversion."
exit 3
fi

hg \
--config extensions.renaming_mercurial_source="${BASE}/renaming_mercurial_source.py" \
--config extensions.hgext.convert= \
Expand Down

1 comment on commit e9e40c2

@maltehelmert
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests the symptoms that Florian mentioned, not what we actually want to test (that all commits from hg.fast-downward.org are present). For example, there are other branches that we also expect to be there, and just because all branches we expect to be there are there, it doesn't mean that we have the right commits. The error message is also not very helpful about telling people what they can do to address the problem. I would instead test the return value of hg incoming http://hg.fast-downward.org to check if the repository has all commits from that repository. From the help page (and some minimal testing on my side), it looks like you can test this with

if hg incoming http://hg.fast-downward.org; then
    echo 1>&2 "Your repository is missing commits from http://hg.fast-downward.org."
    echo 1>&2 "You must pull from http://hg.fast-downward.org first."
    exit 3
fi```

(BTW, using an exit code of 3 seems unusual to me; "1" would be more customary.)

Please sign in to comment.