On Fri, Mar 21, 2014 at 08:32:03AM +0100, Per Cederqvist wrote:
> This makes it easier to script operations on the entire queue, for
> example run the test suite on each patch in the queue:
> 
>     guilt pop -a;while guilt push; do make test||break; done
> 
> This brings "guilt push" in line with the push operation in Mercurial
> Queues (hg qpush), which fails when there are no patches to apply.
> 
> Updated the test suite.
> 
> "guilt push -a" still does not fail.  (It successfully manages to
> ensure that all patches are pushed, even if it did not have to do
> anything to make it so.)
> 
> Signed-off-by: Per Cederqvist <ced...@opera.com>
> ---
>  guilt-push           | 14 ++++-----
>  regression/t-020.out | 89 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  regression/t-020.sh  | 13 +++++++-
>  3 files changed, 108 insertions(+), 8 deletions(-)
> 
> diff --git a/guilt-push b/guilt-push
> index 67687e7..2222350 100755
> --- a/guilt-push
> +++ b/guilt-push
> @@ -55,6 +55,7 @@ fi
>  
>  patch="$1"
>  [ ! -z "$all" ] && patch="-a"
> +[ -z "$patch" ] && { patch=1; num=t; }

I don't think there's any other place in the repo that does this.  Instead
you see a lot of if-then-fi.  To keep it consistent, I'd suggest:

if [ -z "$patch" ] ; then
        patch=1
        num=t
fi

Ah, this took me a while to figure out.  The above turns:

$ guilt push

into 

$ guilt push -n 1

I'd throw in a comment.

(Note to self, this file is a huge mess and could use a bit of cleanup.)

> @@ -78,11 +79,6 @@ elif [ ! -z "$num" ]; then
>       # clamp to minimum
>       [ $tidx -lt $eidx ] && eidx=$tidx
>  
> -elif [ -z "$patch" ]; then
> -     # we are supposed to push only the next patch onto the stack
> -
> -     eidx=`wc -l < "$applied"`
> -     eidx=`expr $eidx + 1`
>  else
>       # we're supposed to push only up to a patch, make sure the patch is
>       # in the series
> @@ -109,7 +105,11 @@ if [ "$sidx" -gt "$eidx" ]; then
>       else
>               disp "File series fully applied, ends at patch `get_series | 
> tail -n 1`"
>       fi
> -     exit 0
> +     if [ -n "$all" ]; then
> +             exit 0
> +     else
> +             exit 1
> +     fi

This changes the output on stdout.  E.g.,

$ guilt pu
$ guilt pu -n 1
File series fully applied, ends at patch crashdump

With this patch, both will print the message. Right?

>  fi
>  
>  get_series | sed -n -e "${sidx},${eidx}p" | while read p

Jeff.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to