-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Expand file tree
/
Copy pathwf
More file actions
executable file
·89 lines (73 loc) · 1.82 KB
/
Copy pathwf
File metadata and controls
executable file
·89 lines (73 loc) · 1.82 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
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
#!/usr/bin/env bash
MF_ORIGIN_URL=https://github.com/musescore/muse_framework.git
MF_FORK_URL=""
TASK=""
BRANCH=""
while [[ "$#" -gt 0 ]]; do
case $1 in
-f|--fork) MF_FORK_URL="$2"; shift ;;
-t|--task) TASK="$2"; shift ;;
-b|--branch) BRANCH="$2"; shift ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done
if [ -z "$MF_FORK_URL" ]; then MF_FORK_URL=$(cat mf_fork_url.local); fi
if [ -z "$MF_FORK_URL" ]; then echo "error: not set MF_FORK_URL"; exit 1; fi
if [ -z "$TASK" ]; then echo "error: not set TASK"; exit 1; fi
echo "MF_FORK_URL: $MF_FORK_URL"
echo "TASK: $TASK"
function use_fork() {
git submodule set-url muse $MF_FORK_URL
cd muse
git remote set-url origin $MF_FORK_URL
git remote remove upstream
git remote add upstream $MF_ORIGIN_URL
git remote -v
cd ..
}
function use_origin() {
git submodule set-url muse $MF_ORIGIN_URL
git submodule update --init
cd muse
git remote set-url origin $MF_ORIGIN_URL
git remote remove upstream
git remote -v
cd ..
}
function make_branch() {
name=$1
# switch to origin
use_origin
# update
git checkout main
git fetch upstream
git rebase upstream/main
git submodule update --init --remote ./muse
# switch to fork
use_fork
# create branch
git checkout -b $name
cd muse
git checkout -b $name
git status
cd ..
git status
}
case "$TASK" in
"use-fork")
use_fork
;;
"make-branch")
if [ -z "$BRANCH" ]; then echo "error: not set BRANCH"; exit 1; fi
make_branch $BRANCH
;;
"use-origin")
use_origin
;;
"sync-origin")
use_origin
git submodule update --init --remote ./muse
;;
*) echo "Unknown task: $TASK"; exit 1 ;;
esac