[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] Re: [PATCH 3/4] Add WD relative option to quilt files
From: |
Don Mullis |
Subject: |
[Quilt-dev] Re: [PATCH 3/4] Add WD relative option to quilt files |
Date: |
Sun, 11 Apr 2010 20:43:49 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Add -r (relative) option. Lists file paths relative to $PWD rather
than the parent of patches/ -- consistent with `quilt remove' and
`quilt add'.
---
quilt/files.in | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
Index: quilt/quilt/files.in
===================================================================
--- quilt.orig/quilt/files.in 2010-04-03 09:13:04.000000000 -0700
+++ quilt/quilt/files.in 2010-04-04 11:29:17.000000000 -0700
@@ -31,6 +31,9 @@ Print the list of files that the topmost
-v Verbose, more user friendly output.
+-r List file paths relative to PWD rather than the parent of patches/ --
+ as required by \`quilt remove' and \`quilt add'.
+
--combine patch
Create a listing for all patches between this patch and
the topmost or specified patch. A patch name of \`-' is
@@ -43,7 +46,7 @@ Print the list of files that the topmost
fi
}
-options=`getopt -o vhal --long combine: -- "$@"`
+options=`getopt -o vrhal --long combine: -- "$@"`
if [ $? -ne 0 ]
then
@@ -58,6 +61,9 @@ do
-v)
opt_verbose=1
shift ;;
+ -r)
+ opt_relative=1
+ shift ;;
-a)
opt_all=1
shift ;;
@@ -112,6 +118,22 @@ else
patches=( $last_patch )
fi
+shortest_relative_path()
+{
+ local file=$1
+ local subdir=$SUBDIR
+ local up=$SUBDIR_DOWN
+
+ # remove as many initial matching dir names as possible
+ while [ "${file%%/*}" = "${subdir%%/*}" ]
+ do
+ file=${file#*/}
+ subdir=${subdir#*/}
+ up=${up#*/}
+ done
+ echo $up$file
+}
+
list_files_in_patch()
{
local patch=$1
@@ -141,6 +163,10 @@ list_files_in_patch()
echo -n "$patch "
fi
fi
+ if [ -n "$opt_relative" ]
+ then
+ file=$(shortest_relative_path $file)
+ fi
if [ -z "$use_status" ]
then
echo "$file"