Skip to content

Commit 0c722b6

Browse files
committed
update generate tools
1 parent 42377dc commit 0c722b6

File tree

2 files changed

+43
-27
lines changed

2 files changed

+43
-27
lines changed

generate_patches/configure_alias_names.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/bin/bash
22

33
# It MUST be run using source in order to configure alias
4-
export local_patch_path="/Users/marion/dev/git_local/Code/patchrepo"
4+
export local_patch_path="/Users/marion/dev/git_local/Code/customization"
55

66
alias reset_workspace="${local_patch_path}/generate_patches/reset_workspace.sh"
77
alias generate_main="${local_patch_path}/generate_patches/main.sh"
8+
alias generate_dev="${local_patch_path}/generate_patches/dev.sh"
89

910
# method
1011
# start in directory with LoopWorkspace main branch

generate_patches/dev.sh

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
#set -x
33
set -e
44

5+
path_marion="/Users/marion/dev/git_local/Code/customization"
6+
path_jonas="../.."
7+
58
branch="dev"
9+
# this requires that Loop already have remotes configures
10+
# first arg goes with dosing-strategy-linear-ramp branch (i.e., marionbarker)
11+
# second arg goes with prep_irc and combined_1988_2008 (i.e., loopandlearn)
12+
repo1="marionbarker"
13+
repo2="loopandlearn"
614

715
function git_cleanup_submodule() {
816
local submodule_path=$1
@@ -27,12 +35,19 @@ function git_reset() {
2735

2836
# Fetch the branches
2937
cd Loop
30-
git fetch repo1
31-
git fetch repo2
38+
git fetch $repo1
39+
git fetch $repo2
3240
cd ..
3341
}
3442

35-
cd Loop_dev/LoopWorkspace
43+
# marion starts in LoopWorkspace
44+
thisFolder=$(pwd)
45+
if [[ thisFolder -ne "LoopWorkspace" ]]; then
46+
cd Loop_dev/LoopWorkspace
47+
path_to_use="$path_jonas"
48+
else
49+
path_to_use="$path_marion"
50+
fi
3651
git_reset
3752

3853
commit() {
@@ -71,7 +86,7 @@ create_submodule_branch() {
7186

7287
create_patch() {
7388
local patch_path="$1"
74-
git diff --submodule=diff | sed 's/[[:space:]]*$//' > "$patch_path"
89+
git diff --submodule=diff > "$patch_path"
7590
}
7691

7792
apply_diff() {
@@ -113,16 +128,16 @@ reverse_diff() {
113128
echo "1988"
114129
#############################
115130
create_submodule_branch Loop branch_1988
116-
apply_diff "dosing-strategy-linear-ramp" "repo1" Loop
117-
create_patch "../../1988/${branch}_1988.patch"
131+
apply_diff "dosing-strategy-linear-ramp" "$repo1" Loop
132+
create_patch "$path_to_use/1988/${branch}_1988.patch"
118133

119134

120135
#############################
121136
echo "2008"
122137
#############################
123138
create_submodule_branch Loop branch_2008
124-
apply_diff "prep_irc" "repo2" Loop
125-
create_patch "../../2008/${branch}_2008.patch"
139+
apply_diff "prep_irc" "$repo2" Loop
140+
create_patch "$path_to_use/2008/${branch}_2008.patch"
126141

127142

128143
#############################
@@ -132,10 +147,10 @@ echo "1988 based on 2008 = combined_1988_2008"
132147
cd Loop
133148
git checkout -b "branch_1988_2008" branch_2008
134149
stage_workspace
135-
reverse_diff "prep_irc" "repo2"
136-
apply_diff "combined_1988_2008" "repo2"
150+
reverse_diff "prep_irc" "$repo2"
151+
apply_diff "combined_1988_2008" "$repo2"
137152
cd ..
138-
create_patch "../../1988/${branch}_1988_2008.patch"
153+
create_patch "$path_to_use/1988/${branch}_1988_2008.patch"
139154

140155

141156
#############################
@@ -145,10 +160,10 @@ echo "2008 based on 1988 -> combined_1988_2008"
145160
cd Loop
146161
git checkout -b "branch_2008_1988" branch_1988
147162
stage_workspace
148-
reverse_diff "dosing-strategy-linear-ramp" "repo1"
149-
apply_diff "combined_1988_2008" "repo2"
163+
reverse_diff "dosing-strategy-linear-ramp" "$repo1"
164+
apply_diff "combined_1988_2008" "$repo2"
150165
cd ..
151-
create_patch "../../2008/${branch}_2008_1988.patch"
166+
create_patch "$path_to_use/2008/${branch}_2008_1988.patch"
152167

153168

154169
#############################
@@ -157,23 +172,23 @@ echo "1988 over original cto"
157172
git_reset
158173

159174
#Set workspace cto original
160-
git apply ../../cto_original_LoopWorkspace.patch
175+
git apply "$path_to_use/customtypeone_looppatches/cto_original.patch"
161176
commit Loop LoopKit
162177
commit
163178

164179
#Remove original cto
165-
git apply --reverse ../../cto_original_LoopWorkspace.patch
180+
git apply --reverse "$path_to_use/customtypeone_looppatches/cto_original.patch"
166181
commit Loop LoopKit
167182

168183
# Apply 1988 changes
169-
apply_diff "dosing-strategy-linear-ramp" "repo1" Loop
184+
apply_diff "dosing-strategy-linear-ramp" "$repo1" Loop
170185

171186
#Add cto no switcher
172-
git apply ../../cto_no_switcher_LoopWorkspace.patch
187+
git apply "$path_to_use/customtypeone_looppatches/cto_no_switcher.patch"
173188
commit Loop LoopKit
174189

175190
# Do a workspace level patch
176-
create_patch "../../1988/${branch}_1988_cto.patch"
191+
create_patch "$path_to_use/1988/${branch}_1988_cto.patch"
177192

178193

179194
#############################
@@ -182,20 +197,20 @@ echo "1988 over original cto + 2008"
182197
git_reset
183198

184199
# Stage workspace as 2008 + cto
185-
apply_diff "prep_irc" "repo2" Loop
186-
git apply ../../cto_original_LoopWorkspace.patch
200+
apply_diff "prep_irc" "$repo2" Loop
201+
git apply "$path_to_use/customtypeone_looppatches/cto_original.patch"
187202
commit Loop LoopKit
188203
commit
189204

190205
# Remove 2008 + cto
191-
reverse_diff "prep_irc" "repo2" Loop
192-
git apply --reverse ../../cto_original_LoopWorkspace.patch
206+
reverse_diff "prep_irc" "$repo2" Loop
207+
git apply --reverse "$path_to_use/customtypeone_looppatches/cto_original.patch"
193208
commit Loop LoopKit
194209

195210
# Apply combined_1988_2008 + cto no switch
196-
apply_diff "combined_1988_2008" "repo2" Loop
197-
git apply ../../cto_no_switcher_LoopWorkspace.patch
211+
apply_diff "combined_1988_2008" "$repo2" Loop
212+
git apply "$path_to_use/customtypeone_looppatches/cto_no_switcher.patch"
198213
commit Loop LoopKit
199214

200215
# Do a workspace level patch
201-
create_patch "../../1988/${branch}_1988_2008_cto.patch"
216+
create_patch "$path_to_use/1988/${branch}_1988_2008_cto.patch"

0 commit comments

Comments
 (0)