Skip to content

Instantly share code, notes, and snippets.

@karkhaz
Created November 30, 2016 01:44
Show Gist options
  • Save karkhaz/8efaf882ce6f979871fcfa2be4451f41 to your computer and use it in GitHub Desktop.
Save karkhaz/8efaf882ce6f979871fcfa2be4451f41 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Generates a patchset from Gábor Horvath's ctu-master branch, ignoring
# all patches that are merged in from upstream master---i.e., generates
# only those patches authored by Gábor and his team.
#
# https://github.com/dkrupp/clang/tree/ctu-master
#
# Current as of 1bb3636.
# The ranges of commits that we want to generate patches from. The first
# range is the oldest. Within each range, the first commit is the
# oldest. The range is EXCLUSIVE of the first commit and INCLUSIVE of
# the second, i.e. we apply every commit from the child of the first
# commit up to and including the second commit.
RANGES=""
# Start just before Daniel Krupp's first commit.
RANGES="$RANGES 46257d7..7b737c4"
# 78f799e (Kareem's support for Atomic nodes) already merged upstream.
RANGES="$RANGES 4e3d949..02cbe96"
# Skip upstream 1f062cd - c30dc1c
# Don't replay be5fc19 - 1be9584
RANGES="$RANGES 1be9584..13e359a"
# Skip upstream b9a1fd1 - dde9099
RANGES="$RANGES 1b4ff45..c107200"
# Skip merge 205326c
RANGES="$RANGES 205326c..ctu-master"
OUT_DIR=patches
START_NUMBER=0
mkdir -p $OUT_DIR
rm -r $OUT_DIR/*
for range in $RANGES; do
git format-patch --start-number $START_NUMBER -o $OUT_DIR $range
echo
echo
START_NUMBER=$(ls $OUT_DIR | tail -n 1 | awk -F - '{print $1 + 1}' | bc)
done
## Alternative version. This sequence generates a new branch with all the
## commits. It's a bit slower.
#
#git checkout old-master
#git checkout -B gabor-squash
#for range in $RANGES; do
# git cherry-pick $range
#done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment