From a6987289e594d5bf0492fce7067723bc2ceb2cfc Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 12 Nov 2014 23:19:24 +0100 Subject: push: Add --refresh option Add an option to automatically refresh each patch after is was successfully applied. --- quilt/push.in | 17 +++++++++++++++-- test/auto-refresh.test | 25 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/quilt/push.in b/quilt/push.in index e907089..366cc9b 100644 --- a/quilt/push.in +++ b/quilt/push.in @@ -21,7 +21,7 @@ setup_colors usage() { - printf $"Usage: quilt push [-afqv] [--merge[=merge|diff3]] [--leave-rejects] [--color[=always|auto|never]] [num|patch]\n" + printf $"Usage: quilt push [-afqv] [--merge[=merge|diff3]] [--leave-rejects] [--color[=always|auto|never]] [--refresh] [num|patch]\n" if [ x$1 = x-h ] then printf $" @@ -53,6 +53,9 @@ be used. --color[=always|auto|never] Use syntax coloring (auto activates it only if the output is a tty). + +--refresh + Automatically refresh every patch after it was successfully applied. " exit 0 else @@ -294,7 +297,7 @@ check_duplicate_patches() return 1 } -options=`getopt -o fqvam::h --long fuzz:,merge::,leave-rejects,color:: -- "$@"` +options=`getopt -o fqvam::h --long fuzz:,merge::,leave-rejects,color::,refresh -- "$@"` if [ $? -ne 0 ] then @@ -352,6 +355,9 @@ do usage ;; esac shift 2 ;; + --refresh) + opt_refresh=1 + shift ;; --) shift break ;; @@ -363,6 +369,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" @@ -417,6 +429,7 @@ do then exit 1 fi + [ -z "$opt_refresh" ] || quilt_command refresh $QUILT_REFRESH_ARGS [ -n "$opt_quiet" ] || echo done \ | cleanup_patch_output \ diff --git a/test/auto-refresh.test b/test/auto-refresh.test index 9658b71..1367a82 100644 --- a/test/auto-refresh.test +++ b/test/auto-refresh.test @@ -28,3 +28,28 @@ $ quilt pop -a --refresh > Restoring a > > No patches applied + +$ quilt push -a --refresh +> Applying patch patches/a.patch +> patching file a +> Patch patches/a.patch is unchanged +> +> Applying patch patches/b.patch +> patching file b +> Patch patches/b.patch is unchanged +> +> Now at patch patches/b.patch + +$ quilt push -fa --refresh +> Options -f and --refresh are mutually exclusive + +$ quilt pop -a --refresh +> Patch patches/b.patch is unchanged +> Removing patch patches/b.patch +> Restoring b +> +> Patch patches/a.patch is unchanged +> Removing patch patches/a.patch +> Restoring a +> +> No patches applied -- cgit