Browse Source

🔨 Fix mfprep string test

Scott Lahteine 2 years ago
parent
commit
e88fabafc8
1 changed files with 14 additions and 13 deletions
  1. 14
    13
      buildroot/share/git/mfprep

+ 14
- 13
buildroot/share/git/mfprep View File

@@ -18,32 +18,33 @@ DRYRUN=0
18 18
 TAG1=$1
19 19
 TAG2=${2:-"HEAD"}
20 20
 
21
+DEST=2.1.x
22
+
21 23
 # Validate that the required tags exist
22 24
 
23 25
 MTAG=`git tag | grep -e "^bf-$TAG1\$"`
24
-[[ -n $MTAG ]] || { echo "Can't find tag bf-$TAG1" ; exit 1 ; }
26
+[[ -n "$MTAG" ]] || { echo "Can't find tag bf-$TAG1" ; exit 1 ; }
25 27
 MTAG=`git tag | grep -e "^$TAG1\$"`
26
-[[ -n $MTAG ]] || { echo "Can't find tag $TAG1" ; exit 1 ; }
28
+[[ -n "$MTAG" ]] || { echo "Can't find tag $TAG1" ; exit 1 ; }
27 29
 
28
-# Generate log of recent commits for bugfix-2.0.x and 2.0.x
30
+# Generate log of recent commits for bugfix-2.0.x and DEST
29 31
 
30 32
 TMPDIR=`mktemp -d`
31 33
 LOGB="$TMPDIR/log-bf.txt"
32
-LOG2="$TMPDIR/log-20x.txt"
34
+LOG2="$TMPDIR/log-2x.txt"
33 35
 TMPF="$TMPDIR/tmp.txt"
34
-SCRF="$TMPDIR/update-20x.sh"
36
+SCRF="$TMPDIR/update-$DEST.sh"
35 37
 
36 38
 git checkout bugfix-2.0.x
37 39
 git log --pretty="[%h] %s" bf-$TAG1..$TAG2 | grep -v '\[cron\]' | $SED '1!G;h;$!d' >"$LOGB"
38 40
 
39
-git checkout 2.0.x
41
+git checkout $DEST
40 42
 git log --pretty="[%h] %s" $TAG1..$TAG2 | $SED '1!G;h;$!d' >"$LOG2" || { echo "Can't find tag bf-$TAG1" ; exit 1 ; }
41 43
 
42
-# Go through commit text from 2.0.x removing all matches from the bugfix log
44
+# Go through commit text from DEST removing all matches from the bugfix log
43 45
 
44 46
 cat "$LOG2" | while read line; do
45
-  #echo "... $line"
46
-  if [[ $line =~ \(((#[0-9]{5}),* *)((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?\)$ ]]; then
47
+  if [[ $line =~ \(((#[0-9]{5}),* *)((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?((#[0-9]{5}),* *)?\)$ ]]; then
47 48
     PATT=""
48 49
     for i in ${!BASH_REMATCH[@]}; do
49 50
       if ((i > 0 && (i % 2 == 0))); then
@@ -54,16 +55,16 @@ cat "$LOG2" | while read line; do
54 55
       fi
55 56
     done
56 57
     #echo "... $PATT"
57
-    [[ -n $PATT ]] && { grep -vE "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; }
58
+    [[ -n "$PATT" ]] && { grep -vE "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; }
58 59
   else
59 60
     PATT=$( $SED -E 's/^\[[0-9a-f]{10}\]( . )?(.+)$/\2/' <<<"$line" )
60
-    [[ -n $PATT ]] && { grep -v "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; }
61
+    [[ -n "$PATT" ]] && { grep -v "$PATT" "$LOGB" >"$TMPF" ; cp "$TMPF" "$LOGB" ; }
61 62
   fi
62 63
 done
63 64
 
64 65
 # Convert remaining commits into git commands
65 66
 
66
-echo -e "#!/usr/bin/env bash\nset -e\ngit checkout 2.0.x\n" >"$TMPF"
67
+echo -e "#!/usr/bin/env bash\nset -e\ngit checkout ${DEST}\n" >"$TMPF"
67 68
 cat "$LOGB" | while read line; do
68 69
   if [[ $line =~ ^\[([0-9a-f]{10})\]\ *(.*)$ ]]; then
69 70
     CID=${BASH_REMATCH[1]}
@@ -74,6 +75,6 @@ cat "$LOGB" | while read line; do
74 75
   fi
75 76
 done
76 77
 mv "$TMPF" "$SCRF"
77
-chmod ug+x "$SCRF"
78
+chmod +x "$SCRF"
78 79
 
79 80
 ((DRYRUN)) && rm -r "$TMPDIR" || open "$TMPDIR"

Loading…
Cancel
Save