瀏覽代碼

Improve existing git helper scripts

Scott Lahteine 8 年之前
父節點
當前提交
7b4c245de3

+ 4
- 0
buildroot/share/git/mfinfo 查看文件

37
   * ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
37
   * ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
38
 esac
38
 esac
39
 
39
 
40
+if [[ $BRANCH == "(no" ]]; then
41
+  echo "Git is busy with merge, rebase, etc." 1>&2 ; exit 1
42
+fi
43
+
40
 echo "$ORG $FORK $REPO $TARG $BRANCH"
44
 echo "$ORG $FORK $REPO $TARG $BRANCH"

+ 10
- 2
buildroot/share/git/mfinit 查看文件

2
 #
2
 #
3
 # mfinit
3
 # mfinit
4
 #
4
 #
5
-# Create the upstream repository for Marlin
5
+# Create the upstream remote for a forked repository
6
 #
6
 #
7
 
7
 
8
-git remote add upstream git@github.com:MarlinFirmware/Marlin.git
8
+REPO=$(git remote get-url origin 2>/dev/null | sed -E 's/.*\/(.*)\.git/\1/')
9
+
10
+if [[ -z $REPO ]]; then
11
+  echo "`basename $0`: No 'origin' remote found." 1>&2 ; exit 1
12
+fi
13
+
14
+git remote add upstream "git@github.com:MarlinFirmware/$REPO.git"
15
+
16
+git fetch upstream

+ 2
- 7
buildroot/share/git/mfnew 查看文件

2
 #
2
 #
3
 # mfnew
3
 # mfnew
4
 #
4
 #
5
-# Create a new branch based on RCBugFix or dev a given branch name
5
+# Create a new branch from the default target with the given name
6
 #
6
 #
7
 
7
 
8
 MFINFO=$(mfinfo) || exit
8
 MFINFO=$(mfinfo) || exit
9
 IFS=' ' read -a INFO <<< "$MFINFO"
9
 IFS=' ' read -a INFO <<< "$MFINFO"
10
 TARG=${INFO[3]}
10
 TARG=${INFO[3]}
11
 
11
 
12
-if [[ ${INFO[4]} == "(no" ]]; then
13
-  echo "Branch is unavailable!"
14
-  exit 1
15
-fi
16
-
17
 case "$#" in
12
 case "$#" in
18
-  0 ) BRANCH=pr_for_$TARG-$(date +"%G-%d-%m|%H:%M:%S") ;;
13
+  0 ) BRANCH=pr_for_$TARG-$(date +"%G-%m-%d_%H.%M.%S") ;;
19
   1 ) BRANCH=$1 ;;
14
   1 ) BRANCH=$1 ;;
20
   * ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
15
   * ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
21
 esac
16
 esac

+ 0
- 5
buildroot/share/git/mfpr 查看文件

15
 TARG=${INFO[3]}
15
 TARG=${INFO[3]}
16
 BRANCH=${INFO[4]}
16
 BRANCH=${INFO[4]}
17
 
17
 
18
-if [[ $BRANCH == "(no" ]]; then
19
-  echo "Git is busy with merge, rebase, etc."
20
-  exit 1
21
-fi
22
-
23
 if [[ ! -z "$1" ]]; then { BRANCH=$1 ; git checkout $1 || exit 1; } fi
18
 if [[ ! -z "$1" ]]; then { BRANCH=$1 ; git checkout $1 || exit 1; } fi
24
 
19
 
25
 if [[ $BRANCH == $TARG ]]; then
20
 if [[ $BRANCH == $TARG ]]; then

+ 0
- 5
buildroot/share/git/mfrb 查看文件

8
 MFINFO=$(mfinfo) || exit
8
 MFINFO=$(mfinfo) || exit
9
 IFS=' ' read -a INFO <<< "$MFINFO"
9
 IFS=' ' read -a INFO <<< "$MFINFO"
10
 
10
 
11
-if [[ ${INFO[4]} == "(no" ]]; then
12
-  echo "Branch is unavailable!"
13
-  exit 1
14
-fi
15
-
16
 case "$#" in
11
 case "$#" in
17
   0 ) ;;
12
   0 ) ;;
18
   * ) echo "Usage: `basename $0`" 1>&2 ; exit 1 ;;
13
   * ) echo "Usage: `basename $0`" 1>&2 ; exit 1 ;;

+ 0
- 5
buildroot/share/git/mfup 查看文件

15
 TARG=${INFO[3]}
15
 TARG=${INFO[3]}
16
 OLDBRANCH=${INFO[4]}
16
 OLDBRANCH=${INFO[4]}
17
 
17
 
18
-if [[ $OLDBRANCH == "(no" ]]; then
19
-  echo "Branch is unavailable!"
20
-  exit 1
21
-fi
22
-
23
 case "$#" in
18
 case "$#" in
24
   0 ) BRANCH=$OLDBRANCH ;;
19
   0 ) BRANCH=$OLDBRANCH ;;
25
   1 ) BRANCH=$1 ;;
20
   1 ) BRANCH=$1 ;;

Loading…
取消
儲存