From: Neil Brown Date: Tue, 13 Jun 2006 12:57:00 +0000 (+1000) Subject: Don't allow patch reviewing and patch applying to overlap X-Git-Tag: v0.7~18 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=fb08742b3f87c1cf2ea4f54536fe2a054ce92cef;p=wiggle.git Don't allow patch reviewing and patch applying to overlap Otherwise we get into a mess Signed-off-by: Neil Brown --- diff --git a/p b/p index 905091f..eaab2d3 100755 --- a/p +++ b/p @@ -564,7 +564,7 @@ case $cmd in review ) # there are some patches in .removed that may be included in the current source # we try to backout each one. If it backs out successfully, we move it to - # .reviewed and conitnue, else we abort + # .reviewed and continue, else we abort # Once this has been done often enough, 'reviewed' should be run to # move stuff to 'included' and to revert those patches force= @@ -572,10 +572,21 @@ case $cmd in force=yes; shift fi make_diff; get_meta - if [ -s .patches/path ] + if [ -s .patches/patch ] then echo >&2 Patch $name already open, please deal with it; exit 1; fi + if [ -f .patches/in-review ] + then : + else + applied=`ls .patches/applied` + if [ -n "$applied" ] + then + echo >&2 Cannot review patches while any are applied. + exit 1; + fi + > .patches/in-review + fi if [ $# -eq 0 ] then echo "Pending patches are:" @@ -644,6 +655,11 @@ case $cmd in # all the currently applied patches are patches that have been # reviewed as included. # rip them out and stick them (reversed) into included. + if [ ! -f .patches/in-review ] + then + echo >&2 Not currently reviewing patches! + exit 1; + fi while p open last do make_diff -R @@ -653,6 +669,7 @@ case $cmd in all_files discard_one rm -f .patches/name .patches/status .patches/notes done + rm .patches/in-review ;; list ) echo "Applied patches are:" @@ -663,6 +680,11 @@ case $cmd in exit 0 ;; apply ) + if [ -f .patches/in-review ] + then + echo >&2 Cannot apply patches while reviewing other - use p reviewed + exit 1 + fi force= append= if [ " $1" = " -f" ]; then force=yes; shift