Last active
June 28, 2024 02:06
-
-
Save peterwilsoncc/eb93b5c5faec599b96b2741f176665ce to your computer and use it in GitHub Desktop.
Backport a WP commit without having to check out the entire repo.
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
#!/bin/bash | |
# Use: | |
# backport.sh 12345 | |
# | |
# Based on https://gist.github.com/johnbillion/22dcc4ae736a3e8d022c | |
# Modifications | |
# - Uses the format recommended in the handbook | |
# - Pulls the current branch from `svn info` rather than using the directory basename | |
# | |
# Note: The commit message created will need some edits: | |
# - move the merges and reviewd by line above props, followed by a line break | |
# - add the username of the person who provided dev-review | |
# | |
# The commit message is copied in to your clipboard, probably. | |
REV=$1 | |
svn up --ignore-externals . > /dev/null | |
svn merge -c$REV '^/trunk' . | |
LOG=$(svn log -r$REV '^/trunk' | grep -v '\-------' | tail -n +3) | |
BRANCH=$(svn info | grep '^URL:' | egrep -o '(tags|branches)/[^/]+|trunk' | egrep -o '[^/]+$') | |
echo -en "$LOG\n\nReviewed by \nMerges [$REV] to the $BRANCH branch." | pbcopy | |
echo "" | |
pbpaste | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment