-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathget-upstream-changes
executable file
·36 lines (24 loc) · 1 KB
/
get-upstream-changes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# This is the date I last performed the merge. It is NOT the date of the last commit that was merged
lastdate=2018-04-15
mkdir -p patch
patchdir="$(readlink -f patch)"
temp=/tmp/upstream
while ! mkdir -m 0700 $temp 2>/dev/null; do
temp=/tmp/upstream-$$-$RANDOM
done
trap 'rm -rf $temp' EXIT
cd $temp || exit 1
git clone -n https://go.googlesource.com/go
cd go || exit 1
commits="$(git rev-list --since="$lastdate" master -- src/text/tabwriter src/go/printer src/cmd/gofmt | tac)"
n=1
for com in $commits; do
git format-patch -o "$patchdir" --start-number $n -1 $com -- src/text/tabwriter/ src/go/printer/ src/cmd/gofmt/
n=$(($n + 1))
done
sed -i 's%src/text/tabwriter%tabwriter%g;s%src/go/printer%printer%g;s%src/cmd/gofmt%goformat%g' "$patchdir"/*.patch
echo "git am --reject --ignore-space-change --ignore-whitespace" "$patchdir"/'*'.patch
echo "Fix any conflicts by manually applying remaining hunks from *.rej files"
echo "Then 'git add' any modified files to index"
echo "git am --continue"