-
Notifications
You must be signed in to change notification settings - Fork 0
/
cp-rb
executable file
·178 lines (161 loc) · 5.45 KB
/
cp-rb
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!/bin/bash
# cperl rebase all branches above master.
# before git push cp -f (update all dependent branches)
# now also with cp-rbi functionality with -i
# ./cp-rb 1 (does 1 skip)
# ./cp-rb 1 "op: add OpFIRST,LAST,OTHER macros"
# does skip one commit if it matches the substring $2
if [ x$1 = x-f ]; then force=1; shift; fi
if [ x$1 = x--hard ]; then hard=1; shift; fi
if [ x$1 = x-i ]; then interactive=--interactive; shift; fi
case $1 in
[0-9]*)
rbs=$1
if [ x$1 == x1 -a -n "$2" ]; then
match="$2"
shift
shift
fi
;;
esac
#set -e
function rb {
b=$1
m=$2
echo git rebase $m --onto $b
if [ -n $force ]; then git checkout -f $b; fi
git checkout $b && git rebase $interactive $m
if [ x$? != x0 ]; then
# if the rb exit happens in an old to be merged commit, do a --skip (g rbs),
# optionally execute ARG1 skips ($rbs)
# if it happens in the new branch, resolve it manually
# TODO:
# * check log (max 20, back to master) is the conflicting subject was
# already applied before. skip if so.
# * check optional string arg for a matching CONFLICT filename.
# 'cp-rb 1 MANIFEST' will only skip if the CONFLICT is in this file.
if [ -n "$match" -a x$rbs == x1 ]; then
if [[ "`git log -n1 --pretty=format:%s`" == *"$match"* ]]; then
echo git rebase --skip $match
git rebase --skip
fi
else
if [ x$rbs != x ]; then
echo git rebase --skip $rbs x
for i in `seq 1 $rbs`; do
git rebase --skip
done
fi
fi
if [ -e .git/rebase-apply/patch ]; then
if [ -n "`grep a/.git-rr-cache .git/rebase-apply/patch`" \
-a `git status | grep -c "both modified"` == 1 ]
then
git reset .git-rr-cache
git submodule update --init
git rebase --skip
else
exit
fi
fi
fi
git checkout branch-point
}
function rbb {
rb $1 branch-point
}
# merge-upstream - master - branch-point
# we work above branch-point and move stable tress to master
# not yet merged features or bugfixes, branched of from branch-point or merge-upstream
git checkout branch-point
rb branch-point master
for b in `git branch --list --no-color|cut -c3- \
| egrep '^(bugfix|compiler|feature)/'`
do
if [ -n $hard ]; then git reset --hard; fi
rb $b branch-point
done
# eXtended features, based on other feature branches
# memory
rb featurex/CM-367-cperl-warnings-xs-carp feature/CM-367-cperl-carp-builtin
# based on signatures (speed)
#for b in `git branch --list --no-color | cut -c3- | grep '^featurex/gh7-'`
#do
# rb $b feature/gh7-signatures
#done
#rb featurex/gh16-multi branch-point
#git checkout smoke/gh7-signatures
#git reset --hard feature/gh7-signatures
#rb smoke/gh121-storable-u64 branch-point
#rb smoke/gh121+gh123-sizes smoke/gh121-storable-u64
#rb featurex/gh21-exact_arith feature/gh21-locale-hints
#rb featurex/gh21-exact_arith1 feature/gh21-locale-hints
#rb feature/gh21-exact_arith_num feature/gh21-locale-hints
for b in `git branch --list --no-color | cut -c3- | grep '^featurex/gh21-'`
do
rb $b feature/gh21-locale-hints
done
# based on feature/gh24-base-hash
rb featurex/gh24-hash-loop feature/gh24-base-hash
for b in `git branch --list --no-color | cut -c3- | grep '^featurex/gh24-'`
do
if [ $b == featurex/gh24-array_he ]; then
rb $b featurex/gh24-hash-loop
elif [ $b == featurex/gh24-hash-loop+utf8 ]; then
rb $b featurex/gh24-hash-loop
elif [ $b == featurex/gh24-one-word-ahe ]; then
rb $b featurex/gh24-array_he
elif [ $b == featurex/gh24-open-hash ]; then
rb $b featurex/gh24-array_he
elif [ $b == featurex/gh24-hopscotch-hash ]; then
rb $b featurex/gh24-open-hash
else
rb $b feature/gh24-base-hash
fi
done
#rb featurex/gh24-array_he featurex/gh24-hash-loop
#rb featurex/gh24-hash-loop+utf8 featurex/gh24-hash-loop
#rb featurex/gh24-one-word-ahe featurex/gh24-array_he
for b in `git branch --list --no-color | cut -c3- \
| grep '^smoke/' | grep -v 'smoke/maint-5'`
do
if [ -n $hard ]; then git reset --hard; fi
if [ $b == smoke/gh24-base-hash ]; then
git checkout $b
git reset --hard feature/gh24-base-hash
elif [ $b == smoke/gh24-hash-loop ]; then
git checkout $b
git reset --hard featurex/gh24-hash-loop
elif [ $b == smoke/gh24-array_he ]; then
git checkout $b
git reset --hard featurex/gh24-array_he
elif [ $b == smoke/gh16-has ]; then
rb $b smoke/gh16-class
elif [ $b == smoke/master ]; then
rb $b branch-point
else
rb $b master
fi
done
# smoke/gh16-class -> featurex/gh16-multi, featurex/gh16-has
for b in `git branch --list --no-color | cut -c3- | grep '^featurex/gh16-'`
do
rb $b smoke/gh16-class
done
# (for later deeper subtrees)
#declare -a feat
#feat=(feature/gh7-signatures
# featurex/gh16-multi
# )
#N=${#feat[@]}
#for i in `seq 0 $(($N - 2))`; do
# n=$(($i + 1))
# rb ${feat[$n]} ${feat[$i]}
#done
# defunct:
#rb old/gh7-signatures3-gh25-nl feature/gh7-signatures
#rb old/gh7-signatures3-gh25-nl1 feature/gh7-signatures
git checkout coverity
git reset --hard master
git checkout master
git branch | egrep 'branch-point|master|bugfix/|feature|smoke/|win/'