[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] patch - list all changed files in all applied patches
From: |
Dean Roehrich |
Subject: |
[Quilt-dev] patch - list all changed files in all applied patches |
Date: |
Tue, 27 Jul 2004 11:49:50 -0500 |
I often want to list all the modified files in all the applied patches.
Sometimes I want to see all the patches currently applied to each file. The
following simplifies some find/grep/awk/sort commandlines that I'm tired of
using.
The basics:
quilt files -a # list all files in all applied patches
quilt files -l # print [patchname] before listing filenames
So, with these I have the following favorite commandlines:
quilt fi -al | sort +1 # Show all files in all applied patches,
# and for each file list all patches that
# affect it.
quilt fi -a | sort -u # Show all files in all applied patches,
# listing each file just once.
And some people might like this one:
quilt fi -av # Show all files in all applied patches,
# by patch. Prints [patchname] as a header
# before each set of files.
I thought about making files.in do the filtering, too, but I was never happy
with the code so I decided to leave the sort on the commandline.
Dean
Index: work20040727/quilt/files.in
===================================================================
--- work20040727.orig/quilt/files.in 2004-07-27 11:30:48.000000000 -0500
+++ work20040727/quilt/files.in 2004-07-27 11:31:39.000000000 -0500
@@ -19,12 +19,16 @@ fi
usage()
{
- printf $"Usage: quilt files [-v] [patch]\n"
+ printf $"Usage: quilt files [-v] [-a] [-l] [patch]\n"
if [ x$1 = x-h ]
then
printf $"
Print the list of files that the topmost or specified patch changes.
+-a List all files in all applied patches.
+
+-l Add patch name to output.
+
-v Verbose, more user friendly output.
"
exit 0
@@ -33,7 +37,7 @@ Print the list of files that the topmost
fi
}
-options=`getopt -o vh -- "$@"`
+options=`getopt -o vhal -- "$@"`
if [ $? -ne 0 ]
then
@@ -48,6 +52,12 @@ do
-v)
opt_verbose=1
shift ;;
+ -a)
+ opt_all=1
+ shift ;;
+ -l)
+ opt_labels=1
+ shift ;;
-h)
usage -h ;;
--)
@@ -69,6 +79,8 @@ then
printf $"Patch %s is not in series\n" "$opt_patch" >&2
exit 1
fi
+ unset opt_all
+ all_patches=$patch
else
patch=$(top_patch)
if [ -z "$patch" ]
@@ -76,6 +88,11 @@ else
printf $"No patches applied\n" >&2
exit 1
fi
+ all_patches=$patch
+ if [ -n "$opt_all" ]
+ then
+ all_patches=$(applied_patches)
+ fi
fi
if ! is_applied $patch
@@ -90,28 +107,52 @@ then
fi
fi
-for file in $(files_in_patch_ordered $patch)
-do
- status=" "
- if [ -s $(backup_file_name $patch $file) ]
+list_files_in_patch()
+{
+ local patch=$1
+ local status
+
+ if [ -n "$opt_all" ] && [ -n "$opt_verbose" ] && [ -z "$opt_labels" ]
then
- if ! [ -s $file ]
+ echo "[$patch]"
+ fi
+ for file in $(files_in_patch_ordered $patch)
+ do
+ status=" "
+ if [ -n "$opt_labels" ]
then
- status="-"
+ status="."
fi
- else
- if [ -s $file ]
+ if [ -s $(backup_file_name $patch $file) ]
then
- status="+"
+ if ! [ -s $file ]
+ then
+ status="-"
+ fi
+ else
+ if [ -s $file ]
+ then
+ status="+"
+ fi
fi
- fi
- if [ -z "$opt_verbose" ]
- then
- echo "$file"
- else
- echo "$status $file"
- fi
+ if [ -n "$opt_labels" ]
+ then
+ echo -n "[$patch] "
+ fi
+ if [ -z "$opt_verbose" ]
+ then
+ echo "$file"
+ else
+ echo "$status $file"
+ fi
+ done
+}
+
+for patch in $all_patches
+do
+ list_files_in_patch $patch
done
+
### Local Variables:
### mode: shell-script
### End:
- [Quilt-dev] patch - list all changed files in all applied patches,
Dean Roehrich <=