summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--quilt.changes6
-rw-r--r--quilt/diff.in2
-rw-r--r--quilt/new.in26
3 files changed, 30 insertions, 4 deletions
diff --git a/quilt.changes b/quilt.changes
index 9e12b37..1229445 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Wed Nov 25 18:36:12 CET 2009 - agruen@suse.de
+
+- new command: Add -p ... option (equivalent to diff -p ...).
+ (Based on a patch from Egbert Eich <eich@freedesktop.org>.)
+
+-------------------------------------------------------------------
Wed Nov 25 15:03:38 CET 2009 - agruen@suse.de
- Make sure the series file is a regular file (or a symlink to a
diff --git a/quilt/diff.in b/quilt/diff.in
index 86da3f5..2824c96 100644
--- a/quilt/diff.in
+++ b/quilt/diff.in
@@ -229,7 +229,7 @@ case "$opt_strip_level" in
0 | 1 | ab)
;;
*)
- printf $"Cannot diff patches with -p%s, please specify -p0 or -p1 instead\n" \
+ printf $"Cannot diff patches with -p%s, please specify -p0, -p1, or -pab instead\n" \
"$opt_strip_level" >&2
die 1
;;
diff --git a/quilt/new.in b/quilt/new.in
index 5741534..51b9ad8 100644
--- a/quilt/new.in
+++ b/quilt/new.in
@@ -19,13 +19,19 @@ fi
usage()
{
- printf $"Usage: quilt new {patchname}\n"
+ printf $"Usage: quilt new [-p n|-p ab] {patchname}\n"
if [ x$1 = x-h ]
then
printf $"
Create a new patch with the specified file name, and insert it after the
topmost patch.
+-p n Create a -p n style patch (-p0 or -p1 are supported).
+
+-p ab Create a -p1 style patch, but use a/file and b/file as the
+ original and new filenames instead of the default
+ dir.orig/file and dir/file names.
+
Quilt can be used in sub-directories of a source tree. It determines the
root of a source tree by searching for a %s directory above the
current working directory. Create a %s directory in the intended root
@@ -38,7 +44,7 @@ in the directory tree.
fi
}
-options=`getopt -o h -- "$@"`
+options=`getopt -o p:h -- "$@"`
if [ $? -ne 0 ]
then
@@ -50,6 +56,8 @@ eval set -- "$options"
while true
do
case "$1" in
+ -p) opt_strip_level=$2
+ shift 2 ;;
-h)
usage -h ;;
--)
@@ -58,6 +66,18 @@ do
esac
done
+case "$opt_strip_level" in
+'' | 1)
+ opt_strip_level= ;;
+0 | ab)
+ ;;
+*)
+ printf $"Cannot create patches with -p%s, please specify -p0, p1, or -pab instead\n" \
+ "$opt_strip_level" >&2
+ exit 1
+ ;;
+esac
+
if [ $# -ne 1 ]
then
usage
@@ -75,7 +95,7 @@ create_db
rm -rf "$QUILT_PC/$patch"
mkdir -p "$QUILT_PC/$patch"
-if ! insert_in_series $patch || \
+if ! insert_in_series $patch ${opt_strip_level:+-p$opt_strip_level} || \
! add_to_db $patch
then
printf $"Failed to create patch %s\n" "$(print_patch $patch)" >&2