This patch adds a "-r" option to "quilt files", to print filenames
relative to the working directory.
Maybe relative_to_subdir() should take an argument rather than work as a
filter.
Index: scripts/patchfns.in
===================================================================
--- scripts/patchfns.in.orig
+++ scripts/patchfns.in
@@ -494,6 +494,28 @@ filenames_in_patch()
fi
}
+relative_to_subdir()
+{
+ local path subdir relpath rm_common
+ rm_common=1
+ while read path ; do
+ subdir="$SUBDIR"
+ relpath="${path#$SUBDIR}"
+ [ "$relpath" != "$path" ] && { echo "$relpath" ; return ; }
+ while [ -n "$subdir" ] ; do
+ path="${relpath}"
+ test "$rm_common" && {
+ relpath="${relpath#${subdir%%/*}/}"
+ } || {
+ relpath="../${relpath}"
+ }
+ [ "$relpath" = "$path" ] && rm_common=""
+ subdir="${subdir#*/}"
+ done
+ echo "$relpath"
+ done
+}
+
files_in_patch_ordered()
{
local patch=$1
Index: quilt/files.in
===================================================================
--- quilt/files.in.orig
+++ quilt/files.in
@@ -19,7 +19,7 @@ fi
usage()
{
- printf $"Usage: quilt files [-v] [-a] [-l] [--combine patch] [patch]\n"
+ printf $"Usage: quilt files [-v] [-a] [-l] [-r] [--combine patch]
[patch]\n"
if [ x$1 = x-h ]
then
printf $"
@@ -29,6 +29,8 @@ Print the list of files that the topmost
-l Add patch name to output.
+-r Print filenames relative to the working directory.
+
-v Verbose, more user friendly output.
--combine patch
@@ -43,7 +45,7 @@ Print the list of files that the topmost
fi
}
-options=`getopt -o vhal --long combine: -- "$@"`
+options=`getopt -o vhalr --long combine: -- "$@"`
if [ $? -ne 0 ]
then
@@ -64,6 +66,9 @@ do
-l)
opt_labels=1
shift ;;
+ -r)
+ opt_relative=1
+ shift ;;
-h)
usage -h ;;
--combine)
@@ -167,6 +172,10 @@ list_files_in_patch()
echo -n "$patch "
fi
fi
+ if [ -n "$opt_relative" ]
+ then
+ file="$(echo $file | relative_to_subdir)"
+ fi
if [ -z "$use_status" ]
then
echo "$file"
--
Olaf Dabrunz (od/odabrunz), SUSE Linux Products GmbH, Nürnberg
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev