[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] [PATCH/RFC] quilt delete any_nonconflicting_patch
From: |
Randy Dunlap |
Subject: |
[Quilt-dev] [PATCH/RFC] quilt delete any_nonconflicting_patch |
Date: |
Tue, 22 Dec 2009 16:12:08 -0800 |
From: Randy Dunlap <address@hidden>
Implement "quilt delete <any non-conflicting patch in series>".
This patch allows patches that do not collide (at the file level)
to be deleted from the quilt stack. *Any* other patch that
touches the same file(s) is detected as a conflict and prevents
the target patch from being deleted. E.g.:
$ quilt delete docum-iomapping-ioremap-type.patch
Patch docum-iomapping-ioremap-type.patch is not independent of other applied
patches.
Common files are:
Documentation/IO-mapping.txt
Perhaps it would be better to list the conflicting patch file names
instead of the conflicting source file names. (?)
Previously only the topmost patch could be deleted.
Based somewhat on the "quilt commit" patch from Hugo Mills <address@hidden>.
Signed-off-by: Randy Dunlap <address@hidden>
Cc: Hugo Mills <address@hidden>
---
quilt/delete | 52 ++++++++++++++++++++++++++++++++++++-------------
1 file changed, 39 insertions(+), 13 deletions(-)
--- quilt-0.48.orig/quilt/delete
+++ quilt-0.48/quilt/delete
@@ -24,8 +24,7 @@ usage()
then
printf $"
Remove the specified or topmost patch from the series file. If the
-patch is applied, quilt will attempt to remove it first. (Only the
-topmost patch can be removed right now.)
+patch is applied, quilt will attempt to unapply it first.
-n Delete the next patch after topmost, rather than the specified
or topmost patch.
@@ -43,6 +42,26 @@ topmost patch can be removed right now.)
fi
}
+find_common_applied_files()
+{
+ # We can find all the files that are touched by some patch not
+ # this one by listing all of the unique files touched by the other
+ # patches, concatenating with all of the unique files touched by
+ # this patch, and finding duplicates.
+ local patch=$1
+ (
+ for other_patch in $(applied_patches)
+ do
+ if [ "$other_patch" != "$patch" ]
+ then
+ files_in_patch $other_patch
+ fi
+ done | sort | uniq ; \
+ files_in_patch $patch | sort | uniq
+ ) | sort | uniq -d
+}
+
+
options=`getopt -o nrh --long backup -- "$@"`
if [ $? -ne 0 ]
@@ -96,19 +115,26 @@ then
find_top_patch > /dev/null
exit 1
fi
-if is_applied "$patch"; then
- if [ "$patch" != "$(top_patch)" ]
- then
- printf $"Patch %s is currently applied\n" \
- "$(print_patch "$patch")" >&2
- exit 1
- fi
- if ! quilt_command pop -fq
- then
- exit 1
- fi
+
+# Verify that the list of files in this patch is disjoint from the
+# set of files in all the other currently-applied patches.
+common_files=$(find_common_applied_files "$patch")
+if [ -n "$common_files" ]
+then
+ echo "Patch $patch is not independent of other applied patches." >&2
+ echo "Common files are:" >&2
+ echo $common_files >&2
+ exit 1
fi
+printf $"Removing patch %s\n" "$(print_patch $patch)"
+$QUILT_LIB/backup-files $silent -r -t -B $QUILT_PC/$patch/ -
+
+# Remove the patch from the patch stack
+remove_from_db "$patch" || return 1
+rm -rf $QUILT_PC/$patch/
+rm -f $QUILT_PC/$patch~refresh
+
if remove_from_series "$patch"
then
printf $"Removed patch %s\n" "$(print_patch "$patch")"
- [Quilt-dev] [PATCH/RFC] quilt delete any_nonconflicting_patch,
Randy Dunlap <=