-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbranch_hopper.sh
More file actions
executable file
·49 lines (36 loc) · 1.15 KB
/
branch_hopper.sh
File metadata and controls
executable file
·49 lines (36 loc) · 1.15 KB
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
#!/bin/bash
source common.sh
gr.msg "This will change GRBL_ to GURU_ and 'grbl' to 'guru, not clean but should produce functional output."
gr.msg "There is obvious risk if files or folders contains 'grbl/guru' word, specially when cross module file names are used."
gr.ask "Continue" || exit 0
module_file=$(readlink -f $1)
shift
if ! [[ $module_file ]]; then
gr.msg "no such file"
exit 0
fi
branch="release/0.7.5"
[[ $1 ]] && branch=$1
if ! git branch | grep -q $branch; then
gr.msg "available branches:"
git branch
exit 1
fi
temp="/tmp/${module_file##*/}"
[[ -f $temp ]] && rm $temp
[[ -f $module_file ]] || exit 1
cp $module_file $temp
sed -i -e 's/grbl/guru/g' $temp
sed -i -e 's/GRBL_/GURU_/g' $temp
git checkout $branch || exit 2
gr.msg "saving original $branch branch file to to '${temp}_original'.."
cp $module_file "${temp}_original" || exit 1
gr.msg "please go trough all 'guru' words manually and check that changes are valid'. "
subl $temp
if gr.ask "make changes and when ready, replace $module_file with $temp"; then
gr.ask "really OVERWRITE $module_file" \
&& cp $temp $module_file \
|| gr.msg -e1 "not performed"
else
gr.msg "canceling.."
fi