Thread (61 messages) flat view 61 messages, 3 authors, 2016-06-15

Re: [GUILT 25/28] "guilt push" now fails when there are no more patches to push.

From: Per Cederqvist <hidden>
Date: 2016-06-15 23:01:03

On Thu, May 8, 2014 at 12:04 AM, Jeff Sipek [off-list ref] wrote:
On Fri, Mar 21, 2014 at 08:32:03AM +0100, Per Cederqvist wrote:
quoted
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 <redacted>
---
 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
Ok.
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.
Will do.
(Note to self, this file is a huge mess and could use a bit of cleanup.)
quoted
@@ -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?
Yes. Personally, I think that is a good change. It feels
strange that "guilt push" silently does nothing when
there is no patch to apply.

    /ceder
quoted
 fi

 get_series | sed -n -e "${sidx},${eidx}p" | while read p
Jeff.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help