Changeset View
Changeset View
Standalone View
Standalone View
contrib/source-control-tools/autopatch.sh
#!/usr/bin/env bash | #!/usr/bin/env bash | ||||
# Copyright (c) 2019-2020 The Bitcoin developers | # Copyright (c) 2019-2020 The Bitcoin developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
export LC_ALL=C.UTF-8 | export LC_ALL=C.UTF-8 | ||||
set -euxo pipefail | set -euxo pipefail | ||||
# --force is necessary to skip the "sanity check" step, which conflicts with | # --force is necessary to skip the "sanity check" step, which conflicts with | ||||
# stacked revisions that contain already-landed dependencies. | # stacked revisions that contain already-landed dependencies. | ||||
DEFAULT_PATCH_ARGS="--skip-dependencies --force --nobranch" | DEFAULT_PATCH_ARGS="--skip-dependencies --force --nobranch" | ||||
DEFAULT_REMOTE="origin" | DEFAULT_REMOTE="origin" | ||||
DEFAULT_BRANCH="master" | DEFAULT_BRANCH="master" | ||||
help_message() { | help_message() { | ||||
set +x | cat <<EOF | ||||
echo "Apply a patch from Phabricator cleanly on latest master." | Apply a patch from Phabricator cleanly on latest master. | ||||
echo "" | |||||
echo "Options:" | Options: | ||||
echo "-b, --branch The git branch to fetch and rebase onto. Default: '${DEFAULT_BRANCH}'" | -b, --branch The git branch to fetch and rebase onto. Default: '${DEFAULT_BRANCH}' | ||||
echo "-h, --help Display this help message." | -h, --help Display this help message. | ||||
echo "-o, --remote The git remote to fetch latest from. Default: '${DEFAULT_REMOTE}'" | -o, --remote The git remote to fetch latest from. Default: '${DEFAULT_REMOTE}' | ||||
echo "-p, --patch-args Args to pass to 'arc patch'. Default: '${DEFAULT_PATCH_ARGS}'" | -p, --patch-args Args to pass to 'arc patch'. Default: '${DEFAULT_PATCH_ARGS}' | ||||
echo "-r, --revision The Differential revision ID used in Phabricator that you want to land. (ex: D1234)" | -r, --revision The Differential revision ID used in Phabricator that you want to land. (ex: D1234) | ||||
echo " This argument is required if --patch-args does not specify a revision or diff ID." | This argument is required if --patch-args does not specify a revision or diff ID. | ||||
set -x | EOF | ||||
} | } | ||||
BRANCH="${DEFAULT_BRANCH}" | BRANCH="${DEFAULT_BRANCH}" | ||||
PATCH_ARGS="${DEFAULT_PATCH_ARGS}" | PATCH_ARGS="${DEFAULT_PATCH_ARGS}" | ||||
REMOTE="${DEFAULT_REMOTE}" | REMOTE="${DEFAULT_REMOTE}" | ||||
REVISION="" | REVISION="" | ||||
# Parse command line arguments | # Parse command line arguments | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |