Parcourir la source

Improve existing git helper scripts

Scott Lahteine il y a 7 ans
Parent
révision
7b4c245de3

+ 4
- 0
buildroot/share/git/mfinfo Voir le fichier

@@ -37,4 +37,8 @@ case "$#" in
37 37
   * ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
38 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 44
 echo "$ORG $FORK $REPO $TARG $BRANCH"

+ 10
- 2
buildroot/share/git/mfinit Voir le fichier

@@ -2,7 +2,15 @@
2 2
 #
3 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 Voir le fichier

@@ -2,20 +2,15 @@
2 2
 #
3 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 8
 MFINFO=$(mfinfo) || exit
9 9
 IFS=' ' read -a INFO <<< "$MFINFO"
10 10
 TARG=${INFO[3]}
11 11
 
12
-if [[ ${INFO[4]} == "(no" ]]; then
13
-  echo "Branch is unavailable!"
14
-  exit 1
15
-fi
16
-
17 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 14
   1 ) BRANCH=$1 ;;
20 15
   * ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
21 16
 esac

+ 0
- 5
buildroot/share/git/mfpr Voir le fichier

@@ -15,11 +15,6 @@ REPO=${INFO[2]}
15 15
 TARG=${INFO[3]}
16 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 18
 if [[ ! -z "$1" ]]; then { BRANCH=$1 ; git checkout $1 || exit 1; } fi
24 19
 
25 20
 if [[ $BRANCH == $TARG ]]; then

+ 0
- 5
buildroot/share/git/mfrb Voir le fichier

@@ -8,11 +8,6 @@
8 8
 MFINFO=$(mfinfo) || exit
9 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 11
 case "$#" in
17 12
   0 ) ;;
18 13
   * ) echo "Usage: `basename $0`" 1>&2 ; exit 1 ;;

+ 0
- 5
buildroot/share/git/mfup Voir le fichier

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

Chargement…
Annuler
Enregistrer