File pop-add-auto-refresh.patch of Package quilt

From: Jean Delvare <jdelvare@suse.de>
Subject: pop: Add --refresh option
Upstream: Submitted (2014-10-01)

Add an option to automatically refresh each patch before it gets
unapplied.
---
 quilt/pop.in           |   11 +++++++++--
 test/auto-refresh.test |   27 +++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 2 deletions(-)

--- a/quilt/pop.in
+++ b/quilt/pop.in
@@ -19,7 +19,7 @@ fi
 
 usage()
 {
-	printf $"Usage: quilt pop [-afRqv] [num|patch]\n"
+	printf $"Usage: quilt pop [-afRqv] [--refresh] [num|patch]\n"
 	if [ x$1 = x-h ]
 	then
 		printf $"
@@ -41,6 +41,9 @@ completion can be used.
 -q	Quiet operation.
 
 -v	Verbose operation.
+
+--refresh
+	Automatically refresh every patch before it gets unapplied.
 "
 		exit 0
 	else
@@ -163,7 +166,7 @@ remove_patch()
 	return $status
 }
 
-options=`getopt -o fRqvah -- "$@"`
+options=`getopt -o fRqvah --long refresh -- "$@"`
 
 if [ $? -ne 0 ]
 then
@@ -194,6 +197,9 @@ do
 		shift ;;
 	-h)
 		usage -h ;;
+	--refresh)
+		opt_refresh=1
+		shift ;;
 	--)
 		shift
 		break ;;
@@ -239,6 +245,7 @@ fi
 
 for patch in $patches
 do
+	[ -z "$opt_refresh" ] || quilt_command refresh $QUILT_REFRESH_ARGS
 	if ! remove_patch "$patch"
 	then
 		exit 1
--- /dev/null
+++ b/test/auto-refresh.test
@@ -0,0 +1,27 @@
+$ mkdir patches
+
+$ echo a > a
+$ echo b > b
+
+$ quilt new a.patch
+> Patch patches/a.patch is now on top
+$ quilt add a
+> File a added to patch patches/a.patch
+$ echo A > a
+
+$ quilt new b.patch
+> Patch patches/b.patch is now on top
+$ quilt add b
+> File b added to patch patches/b.patch
+$ echo B > b
+
+$ quilt pop -a --refresh
+> Refreshed patch patches/b.patch
+> Removing patch patches/b.patch
+> Restoring b
+>
+> Refreshed patch patches/a.patch
+> Removing patch patches/a.patch
+> Restoring a
+>
+> No patches applied
openSUSE Build Service is sponsored by