summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--quilt/pop.in17
-rw-r--r--test/auto-refresh.test30
2 files changed, 45 insertions, 2 deletions
diff --git a/quilt/pop.in b/quilt/pop.in
index 16a4964..ba3069e 100644
--- 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 ;;
@@ -205,6 +211,12 @@ then
usage
fi
+if [ -n "$opt_force" -a -n "$opt_refresh" ]
+then
+ printf $"Options %s and %s are mutually exclusive\n" "-f" "--refresh"
+ exit 1
+fi
+
if [ $# -eq 1 ]
then
if is_numeric "$1"
@@ -246,6 +258,7 @@ fi
for patch in $patches
do
+ [ -z "$opt_refresh" ] || quilt_command refresh $QUILT_REFRESH_ARGS
if ! remove_patch "$patch"
then
exit 1
diff --git a/test/auto-refresh.test b/test/auto-refresh.test
new file mode 100644
index 0000000..9658b71
--- /dev/null
+++ b/test/auto-refresh.test
@@ -0,0 +1,30 @@
+$ 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 -fa --refresh
+> Options -f and --refresh are mutually exclusive
+
+$ 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