]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs-apply: minor improvements
authorEric Sandeen <sandeen@redhat.com>
Thu, 12 Jan 2017 20:12:42 +0000 (14:12 -0600)
committerEric Sandeen <sandeen@redhat.com>
Thu, 12 Jan 2017 20:12:42 +0000 (14:12 -0600)
Three quick improvements to libxfs-apply:

- Skip already-cross-merged commits, based on the
  "Source XXX commit" line in the commitlog.

- Be clearer about which patch failed if it does

- Clean up guilt better after a failed application

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
tools/libxfs-apply

index 5cf08793252d4636a3f54fde7b5493aa035e4a92..e7d7e0abcbf4af8d9ea1072c55301e85a47c325c 100755 (executable)
@@ -288,6 +288,7 @@ apply_patch()
        local _current_commit=$3
        local _new_patch=`mktemp`
        local _source="kernel"
+       local _target="xfsprogs"
 
        # filter just the libxfs parts of the patch
        if [ $SOURCE == "xfsprogs" ]; then
@@ -301,6 +302,7 @@ apply_patch()
 
                filter_kernel_patch $_patch > $_new_patch
                _source="xfsprogs"
+               _target="kernel"
        elif [ $SOURCE == "kernel" ]; then
 
                [ -n "$VERBOSE" ] || lsdiff $_patch | grep -q "[ab]/fs/xfs/libxfs/"
@@ -315,6 +317,13 @@ apply_patch()
                fail "Unknown source repo type: $SOURCE"
        fi
 
+       grep -q "Source $_target commit: " $_patch
+       if [ "$?" -eq "0" ]; then
+               echo "$_patch_name already synced up"
+               echo "$_skipping commit $_current_commit"
+               return
+       fi
+
        # now munge the header to be in the correct format.
        fixup_header_format $_source $_new_patch > $_new_patch.2
 
@@ -338,14 +347,15 @@ apply_patch()
                if [ $? -eq 0 ]; then
                        guilt refresh
                else
-                       echo "Guilt push failed!"
+                       echo "Guilt push of $_current_commit $_patch_name 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"
                                fail "Manual cleanup required!"
                        else
-                               echo "Skipping. Manual series file cleanup needed!"
+                               echo "Skipping."
+                               guilt delete -f $_patch_name
                        fi
                fi
        elif [ $STGIT -eq 1 ]; then