git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Lesh <eclesh@ucla.edu>
To: jsipek@cs.sunysb.edu
Cc: git@vger.kernel.org, Eric Lesh <eclesh@ucla.edu>
Subject: [GUILT PATCH 4/5] get_series: return guarded patches only
Date: Mon, 30 Jul 2007 20:11:20 -0700	[thread overview]
Message-ID: <11858514813702-git-send-email-eclesh@ucla.edu> (raw)
In-Reply-To: <1185851481190-git-send-email-eclesh@ucla.edu>

This renames get_guarded_series to get_series, and introduces
get_full_series for when the full series is needed.  Many guilt
scripts Just Work with that change.  Those that don't are fixed up.

With this patch, guards are respected everywhere in guilt.

Signed-off-by: Eric Lesh <eclesh@ucla.edu>
---
 guilt        |    6 +++---
 guilt-export |    2 +-
 guilt-guard  |    6 +++---
 guilt-header |    4 ++--
 guilt-push   |    4 ++--
 guilt-select |    2 +-
 guilt-series |    6 ++++--
 7 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/guilt b/guilt
index b289026..d618980 100755
--- a/guilt
+++ b/guilt
@@ -171,7 +171,7 @@ get_prev()
 	fi
 }
 
-get_series()
+get_full_series()
 {
 	# ignore all lines matching:
 	#	- empty lines
@@ -187,9 +187,9 @@ get_series()
 		" $series
 }
 
-get_guarded_series()
+get_series()
 {
-	get_series | while read p
+	get_full_series | while read p
 	do
 		check_guards "$p" && echo "$p"
 	done
diff --git a/guilt-export b/guilt-export
index 2c0a9fd..c872d7f 100755
--- a/guilt-export
+++ b/guilt-export
@@ -18,7 +18,7 @@ fi
 trap "rm -rf \"$target_dir\"" 0
 mkdir -p "$target_dir"
 
-get_series | tee "$target_dir/series" | while read p; do
+get_full_series | tee "$target_dir/series" | while read p; do
 	silent mkdir -p "`dirname $target_dir/$p`" || true
 	cp "$GUILT_DIR/$branch/$p" "$target_dir/$p"
 done
diff --git a/guilt-guard b/guilt-guard
index a0cac2e..a427e25 100755
--- a/guilt-guard
+++ b/guilt-guard
@@ -13,7 +13,7 @@ print_guards()
 }
 
 if [ "$1" == "-l" ] || [ "$1" == "--list" ]; then
-	get_series | while read patch; do
+	get_full_series | while read patch; do
 		print_guards "$patch"
 	done
 	exit 0
@@ -35,7 +35,7 @@ case $# in
 		;;
 	1)
 		if [ -z $(printf %s "$1" | grep -e '^[+-]') ]; then
-			if [ -z $(get_series | grep -e "^$1\$") ]; then
+			if [ -z $(get_full_series | grep -e "^$1\$") ]; then
 				die "Patch $1 does not exist."
 			else
 				print_guards "$1"
@@ -51,7 +51,7 @@ case $# in
 		;;
 	*)
 		if [ -z $(printf %s "$1" | grep -e '^[+-]') ]; then
-			if [ -z $(get_series | grep -e "^$1\$") ]; then
+			if [ -z $(get_full_series | grep -e "^$1\$") ]; then
 				die "Patch $1 does not exist."
 			else
 				patch="$1"
diff --git a/guilt-header b/guilt-header
index 5716265..540cf2a 100755
--- a/guilt-header
+++ b/guilt-header
@@ -31,8 +31,8 @@ esac
 [ -z "$patch" ] && die "No patches applied."
 
 # check that patch exists in the series
-ret=`get_series | grep -ne "^$patch\$" | cut -d: -f1`
-if [ $ret -eq 0 ]; then
+ret=`get_full_series | grep -ne "^$patch\$" | cut -d: -f1`
+if [ -z "$ret" ]; then
 	die "Patch $patch is not in the series"
 fi
 
diff --git a/guilt-push b/guilt-push
index ad3616b..e4004e0 100755
--- a/guilt-push
+++ b/guilt-push
@@ -26,7 +26,7 @@ if [ "$patch" = "--all" ] || [ "$patch" = "-a" ]; then
 
 	eidx=`get_series | wc -l`
 	if [ $eidx -eq 0 ]; then
-		die "There are no patches to push"
+		die "There are no patches to push."
 	fi
 elif [ -z "$patch" ]; then
 	# we are supposed to push only the next patch onto the stack
@@ -39,7 +39,7 @@ else
 
 	eidx=`get_series | grep -ne "^$patch\$" | cut -d: -f1`
 	if [ -z "$eidx" ]; then
-		die "Patch $patch is not in the series"
+		die "Patch $patch is not in the series or is guarded."
 	fi
 fi
 
diff --git a/guilt-select b/guilt-select
index 378ca98..57373c7 100755
--- a/guilt-select
+++ b/guilt-select
@@ -42,7 +42,7 @@ case $1 in
 		guilt-push "$top"
 		;;
 	-s|--series)
-		(get_series | while read patch; do
+		(get_full_series | while read patch; do
 			get_guards "$patch"
 		done) | sed -e 's/ /\n/g' | sort | uniq
 		;;
diff --git a/guilt-series b/guilt-series
index 9c34a08..85ef15d 100755
--- a/guilt-series
+++ b/guilt-series
@@ -36,12 +36,12 @@ elif [ ! -z "$gui" ]; then
 
 	gitk $range
 elif [ -z "$verbose" ]; then
-	get_series
+	get_full_series
 else
 	prefix="+"
 	top=`get_top`
 
-	get_series |
+	get_full_series |
 	while read patch; do
 		if [ -z "$top" ]; then
 			echo "  $patch"
@@ -49,6 +49,8 @@ else
 			if [ "$patch" = "$top" ]; then
 				echo "= $patch"
 				prefix=" "
+                        elif [ $(check_guards "$patch"; echo $?) -eq 1 ]; then
+				echo "  $patch"
 			else
 				echo "$prefix $patch"
 			fi
-- 
1.5.2

  parent reply	other threads:[~2007-07-31  3:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-31  3:11 [GUILT PATCH v2 0/5] Add guards to guilt Eric Lesh
2007-07-31  3:11 ` [GUILT PATCH 1/5] get_series: Remove comments from end of series lines Eric Lesh
2007-07-31  3:50   ` Josef Sipek
2007-07-31  3:11 ` [GUILT PATCH 2/5] guilt-guard: Assign guards to patches in series Eric Lesh
2007-07-31  4:05   ` Josef Sipek
2007-08-09  7:34     ` Eric Lesh
2007-08-09  8:17       ` David Kastrup
2007-08-09  8:22         ` Thomas Adam
2007-08-09  8:43           ` David Kastrup
2007-08-09  8:53           ` Eric Lesh
2007-08-09  9:01         ` Eric Lesh
2007-08-09 13:47       ` Josef Sipek
2007-07-31  3:11 ` [GUILT PATCH 3/5] guilt-select: Select guards to apply when pushing patches Eric Lesh
2007-07-31  3:11 ` Eric Lesh [this message]
2007-07-31  3:11 ` [GUILT PATCH 5/5] Guards test suite Eric Lesh
2007-07-31  3:42 ` [GUILT PATCH v2 0/5] Add guards to guilt Josef Sipek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11858514813702-git-send-email-eclesh@ucla.edu \
    --to=eclesh@ucla.edu \
    --cc=git@vger.kernel.org \
    --cc=jsipek@cs.sunysb.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).