forked from twisted/twisted
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Script for converting a forked PR into a branch in the Twisted repo.
- Loading branch information
Wilfredo Sánchez Vega
committed
Jan 4, 2017
1 parent
29599b1
commit 23d1ee7
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
set -u | ||
|
||
|
||
# Usage | ||
|
||
usage() { | ||
program=$(basename "$0"); | ||
|
||
if [ $# != 0 ]; then echo "$@"; echo ""; fi; | ||
|
||
echo "${program}: usage:"; | ||
echo " ${program} <pull_request_number> <trac_ticket_number> <branch_name>"; | ||
|
||
} | ||
|
||
|
||
# Options | ||
|
||
while [ $# != 0 ]; do | ||
case "$1" in | ||
--help) | ||
usage; | ||
exit 0; | ||
;; | ||
--|*) break; ;; | ||
esac; | ||
done; | ||
|
||
if [ $# != 3 ]; then | ||
usage "Invalid arguments: $*"; | ||
exit 1; | ||
fi; | ||
|
||
PR_NUMBER="$1"; shift; | ||
TICKET_NUMBER="$1"; shift; | ||
BRANCH_NAME="$1"; shift; | ||
|
||
|
||
# Do The Right Thing | ||
|
||
#repo="https://github.com/twisted/twisted.git"; | ||
repo="git@github.com:twisted/twisted.git"; | ||
|
||
clone="$(mktemp -d -t twisted)"; | ||
|
||
git clone --progress "${repo}" "${clone}"; | ||
|
||
cd "${clone}"; | ||
|
||
git fetch origin "refs/pull/${PR_NUMBER}/head"; | ||
git push origin "FETCH_HEAD:refs/heads/${TICKET_NUMBER}-${BRANCH_NAME}"; | ||
|
||
rm -fr "${clone}"; |