Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport scripts #335

Merged
merged 32 commits into from Jan 25, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1d1d941
Backport scripts
Mte90 Jan 16, 2019
b1bc080
replace reference to ticket to changeset
Mte90 Jan 18, 2019
fc30cc4
use the full url for the changeset detection and another parameter fo…
Mte90 Jan 18, 2019
49fd3e9
better detection of the changeset
Mte90 Jan 18, 2019
b472f96
use local CP git and find the WP remote
Mte90 Jan 18, 2019
8f7a17e
remove branch if already exist
Mte90 Jan 18, 2019
0d4debe
linting
Mte90 Jan 18, 2019
833befe
fixed parameter usage
Mte90 Jan 18, 2019
12a122f
silence output and add messages
Mte90 Jan 18, 2019
89c7bdb
bugfix
Mte90 Jan 18, 2019
17e50e7
tested and works
Mte90 Jan 18, 2019
9a745ae
Error handling, other fixes
nylen Jan 19, 2019
7c21f25
Automatically edit the commit message
nylen Jan 19, 2019
0ecee35
Fix the branch search
nylen Jan 19, 2019
d46618d
Check for modified files before running this script
nylen Jan 19, 2019
b57a432
Further message text improvements
nylen Jan 19, 2019
35608ad
Remove unnecessary second script
nylen Jan 19, 2019
f67f1a1
Rename script
nylen Jan 19, 2019
5074a4d
Use longer hashes
nylen Jan 19, 2019
c9f2f0a
Forgot to add the main reason for editing the commit message!
nylen Jan 19, 2019
69917d9
Allow porting a commit onto the current branch
nylen Jan 19, 2019
6119956
Improve argument parsing; implement --verbose option
nylen Jan 21, 2019
f94b4a0
Make setting variables to the empty string clearer
nylen Jan 21, 2019
6f17876
Colorize key output when there is a conflict
nylen Jan 22, 2019
0af307c
Show more progress messages during `git fetch`
nylen Jan 22, 2019
df0e5c5
Hide output for a couple more commands by default
nylen Jan 22, 2019
3ed8603
Remove extra blank lines
nylen Jan 22, 2019
768d390
Avoid running an extra command
nylen Jan 22, 2019
be3a776
Colorize another output message
nylen Jan 22, 2019
6470c76
Add an extra progress message
nylen Jan 22, 2019
c8e8df0
Don't use `read i` in non-interactive context
nylen Jan 22, 2019
8f764f6
Use a special exit code to indicate conflict
nylen Jan 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions bin/rename-wp-commit.sh
@@ -0,0 +1,16 @@
#/usr/bin/env bash

# First parameter is the ticket number

# To save the changes
git commit

# Get the data to print
commit=`git log wp/master --grep=$1 --oneline --pretty=format:'%h' -n 1`
Mte90 marked this conversation as resolved.
Show resolved Hide resolved
OLD_MSG=`git log --format=%B -n1`
changeset=`echo $OLD_MSG | tail -n1 | cut -d "@" -f2 | cut -d " " -f1`
message=$(printf "#WP-$1: $OLD_MSG\n\n----\nMerges https:\/\/core.trac.wordpress.org\/changeset\/$changeset \/ WordPress\/wordpress-develop@$commit to ClassicPress.")
git commit --amend -m"$message"

# Push the branch and get ready for the pull request!
git push origin merge/wp-r$1
40 changes: 40 additions & 0 deletions bin/wp-merge-to-cp.sh
@@ -0,0 +1,40 @@
#/usr/bin/env bash

nylen marked this conversation as resolved.
Show resolved Hide resolved
# First parameter is your fork
# Second parameter is the ticket merged
Mte90 marked this conversation as resolved.
Show resolved Hide resolved

if [ ! -d "ClassicPress" ]; then
# Download ClassicPress from your fork
git clone git@github.com:$1/ClassicPress.git
cd ClassicPress

# Download original ClassicPress
git remote add cp git@github.com:ClassicPress/ClassicPress.git

# Download WordPress dev
nylen marked this conversation as resolved.
Show resolved Hide resolved
git remote add wp https://github.com/WordPress/wordpress-develop
else
cd ClassicPress
fi
git fetch cp
git fetch wp
Mte90 marked this conversation as resolved.
Show resolved Hide resolved

# Switch to ClassicPress branch
git fetch origin
git checkout develop

# Sync your fork with the original
git merge cp/develop
git push origin develop
git checkout origin/develop -B develop

# Create branch with the patch from WordPress
git checkout -b merge/wp-r$2

# Get the commit from WP git log
commit=`git log wp/master --grep=$2 --oneline --pretty=format:'%h' -n 1`
Mte90 marked this conversation as resolved.
Show resolved Hide resolved
if [ -z "$var" ]; then
git cherry-pick $commit
else
echo "Commit not found"
fi