On Tue, Dec 22, 2009 at 04:12:08PM -0800, Randy Dunlap wrote:
> 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
^applied> 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. (?) That's hard to do efficiently from the find_common_applied_files function itself. There's no "(applied) patches for file" function that I can see, but repeated applications of next_patch_for_file until we hit an unapplied patch would work. It's going to be quite slow if you have lots of applied patches (it's O(patches^2 * conflict_files), I think). > Previously only the topmost patch could be deleted. > > Based somewhat on the "quilt commit" patch from Hugo Mills > <[email protected]>. > > Signed-off-by: Randy Dunlap <[email protected]> > Cc: Hugo Mills <[email protected]> > --- > 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 > +} Worth moving this function out to quilt/scripts/patchfns, since we're both going to be using it? > 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 How about something like (untested): for conflict_file in $common_files; do echo $conflict_file modified in top="" conflict_patch=$(next_patch_for_file $top) while is_applied $conflict_patch; do echo " "$conflict_patch conflict_patch=$(next_patch_for_file $top) done done which should get you the list of conflicting files, *and* the patches they were modified in? (This could also go in quilt/scripts/patchfns, as it would be useful in commit, too). Hugo. > + 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 mailing list > [email protected] > http://lists.nongnu.org/mailman/listinfo/quilt-dev -- === Hugo Mills: h...@... carfax.org.uk | darksatanic.net | lug.org.uk === PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk --- Well, you don't get to be a kernel hacker simply by looking --- good in Speedos. -- Rusty Russell
signature.asc
Description: Digital signature
_______________________________________________ Quilt-dev mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/quilt-dev
