]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs-apply: port to stgit
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 10 Jan 2017 02:16:33 +0000 (20:16 -0600)
committerEric Sandeen <sandeen@redhat.com>
Tue, 10 Jan 2017 02:16:33 +0000 (20:16 -0600)
Teach libxfs-apply how to talk to a stgit repository
and fix a minor typo in the guilt hunk of apply_patch.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
tools/libxfs-apply

index 8df1a49dc4cc275b24eca8a345e40f4b3814a038..5cf08793252d4636a3f54fde7b5493aa035e4a92 100755 (executable)
@@ -66,6 +66,7 @@ PATCH=
 COMMIT_ID=
 VERBOSE=
 GUILT=0
+STGIT=0
 
 while [ $# -gt 0 ]; do
        case "$1" in
@@ -95,6 +96,12 @@ if [ $? -eq 0 ]; then
        GUILT=1
 fi
 
+# Are we using stgit? This works even if no patch is applied.
+stg top &> /dev/null
+if [ $? -eq 0 ]; then
+       STGIT=1
+fi
+
 #this is pulled from the guilt code to handle commit ids sanely.
 # usage: munge_hash_range <hash range>
 #
@@ -332,7 +339,27 @@ apply_patch()
                        guilt refresh
                else
                        echo "Guilt push failed!"
-                       read -r -p "Skip of Fail [s|F]? " response
+                       read -r -p "Skip or Fail [s|F]? " response
+                       if [ -z "$response" -o "$response" != "s" ]; then
+                               echo "Force push patch, fix and refresh."
+                               echo "Restart from commit $_current_commit"
+                               fail "Manual cleanup required!"
+                       else
+                               echo "Skipping. Manual series file cleanup needed!"
+                       fi
+               fi
+       elif [ $STGIT -eq 1 ]; then
+               [ -n "$VERBOSE" ] || echo "$REPO looks like a stgit directory."
+               PATCHES=`stg series | wc -l`
+               if [ -n "$VERBOSE" -a $PATCHES -gt 0 ]; then
+                       echo -n "Top patch is: "
+                       stg top
+               fi
+
+               stg import -n $_patch_name $_new_patch.2
+               if [ $? -ne 0 ]; then
+                       echo "stgit push failed!"
+                       read -r -p "Skip or Fail [s|F]? " response
                        if [ -z "$response" -o "$response" != "s" ]; then
                                echo "Force push patch, fix and refresh."
                                echo "Restart from commit $_current_commit"