git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[GUILT PATCH 4/5] get_series: return guarded patches only

From
ELEric Lesh <eclesh@ucla.edu>
Date
Jul 31, 2007, 03:11 UTC
Message-ID
<11858514813702-git-send-email-eclesh@ucla.edu>
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
Previous: Eric LeshNext: Eric Lesh
Message 14 of 16 in “Add guards to guilt”
  1. 0/5 Add guards to guiltEric Lesh, Jul 31, 2007
  2. 1/5 get_series: Remove comments from end of series linesEric Lesh, Jul 31, 2007
  3. Josef SipekJul 31, 2007
  4. 2/5 guilt-guard: Assign guards to patches in seriesEric Lesh, Jul 31, 2007
  5. Josef SipekJul 31, 2007
  6. Eric LeshAug 9, 2007
  7. David KastrupAug 9, 2007
  8. Thomas AdamAug 9, 2007
  9. David KastrupAug 9, 2007
  10. Eric LeshAug 9, 2007
  11. Eric LeshAug 9, 2007
  12. Josef SipekAug 9, 2007
  13. 3/5 guilt-select: Select guards to apply when pushing patchesEric Lesh, Jul 31, 2007
  14. 4/5 get_series: return guarded patches onlyEric Lesh, Jul 31, 2007
  15. 5/5 Guards test suiteEric Lesh, Jul 31, 2007
  16. Josef SipekJul 31, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.