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

Re: [GUILT PATCH 3/4] guilt-select: Select guards to apply when pushing patches

From
JSJosef Sipek <jsipek@fsl.cs.sunysb.edu>
Date
Jul 30, 2007, 04:12 UTC
Message-ID
<20070730041231.GE22017@filer.fsl.cs.sunysb.edu>
In-Reply-To
<11856954182318-git-send-email-eclesh@ucla.edu>
On Sun, Jul 29, 2007 at 12:50:17AM -0700, Eric Lesh wrote:
Show 18 quoted lines
> guilt-select chooses guards that alter which patches will be applied
> with a guilt-push.  The selected guards are stored in
> .git/patches/$branch/guards.
> 
> Signed-off-by: Eric Lesh <eclesh@ucla.edu>
> ---
>  Documentation/guilt-select.txt |   42 ++++++++++++++++++++++++++++++++++++++++
>  guilt                          |    1 +
>  guilt-select                   |   36 ++++++++++++++++++++++++++++++++++
>  3 files changed, 79 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/guilt-select.txt
>  create mode 100755 guilt-select
> 
> diff --git a/Documentation/guilt-select.txt b/Documentation/guilt-select.txt
> new file mode 100644
> index 0000000..8e18f26
> --- /dev/null
> +++ b/Documentation/guilt-select.txt

You might want to update the guilt(7) page's description of the patch directory.

Show 72 quoted lines
> @@ -0,0 +1,42 @@
> +guilt-select(1)
> +===============
> +
> +NAME
> +----
> +guilt-select - Select guards to apply when pushing patches
> +
> +SYNOPSIS
> +--------
> +include::usage-guilt-select.txt[]
> +
> +DESCRIPTION
> +-----------
> +Select guards to apply when pushing patches.
> +
> +Guards are selected without the + or - prefix.  Patches are applied in
> +the following way:
> +
> +An unguarded patch is always applied.
> +
> +A patch with a positive guard is applied *only* if the guard is
> +selected with guilt-select.
> +
> +A patch with a negative guard is applied *unless* the guard is
> +selected with guilt-select.
> +
> +OPTIONS
> +-------
> +-n|--none::
> +        Remove all selected guards
> +-s|--series::
> +        List all guards listed in the series file
> +
> +Author
> +------
> +Written by Eric Lesh <eclesh@ucla.edu>
> +
> +Documentation
> +-------------
> +Documentation by Eric Lesh <eclesh@ucla.edu>
> +
> +include::footer.txt[]
> diff --git a/guilt b/guilt
> index b2767ea..3882962 100755
> --- a/guilt
> +++ b/guilt
> @@ -641,6 +641,7 @@ fi
>  # very useful files
>  series="$GUILT_DIR/$branch/series"
>  applied="$GUILT_DIR/$branch/status"
> +guards_file="$GUILT_DIR/$branch/guards"
>  
>  # determine an editor to use for anything interactive (fall back to vi)
>  editor="vi"
> diff --git a/guilt-select b/guilt-select
> new file mode 100755
> index 0000000..f237ef0
> --- /dev/null
> +++ b/guilt-select
> @@ -0,0 +1,36 @@
> +#!/bin/sh
> +#
> +# Copyright (c) Eric Lesh, 2007
> +#
> +
> +USAGE="[-n|--none] [-s|--series] [<guard>]"
> + . `dirname $0`/guilt
> +
> +if [ $# == 0 ]; then
> +	if [ -s "$guards_file" ]; then
> +		cat "$guards_file"

Later on, for the -s option processing, you sort (presumably to have uniq do the right thing), should we sort here too to be consitent?

> +	else
> +		echo "No guards applied"

I think outputing this message to stderr might be better; it'll allow for redirection more easily.

Show 8 quoted lines
> +	fi
> +	exit 0
> +fi
> +
> +case $1 in
> +	-n|--none)
> +		rm -f "$guards_file"
> +		touch "$guards_file"

Since guilt-init doesn't create the guards file, I'm thinking that this should be just a rm -f ...

Show 17 quoted lines
> +		;;
> +	-s|--series)
> +		(get_series | while read patch; do
> +			get_guards "$patch"
> +		done) | sed -e 's/ /\n/g' | sort | uniq
> +		;;
> +	*)
> +		for x in "$@"; do
> +			if [ $(echo $x | grep -e "^[+-]") ]; then
> +				die "'$x' is not a valid guard name"
> +			fi
> +		done
> +		echo "$@" | sed -e 's/ /\n/g' | sort | uniq > "$guards_file"
> +		;;
> +esac
> -- 
> 1.5.2
-- 
The box said "Windows XP or better required". So I installed Linux.
Previous: Eric LeshNext: Eric Lesh
Message 12 of 20 in “Add guards to guilt”
  1. 0/4 Add guards to guiltEric Lesh, Jul 29, 2007
  2. 1/4 get_series: Remove comments from end of series linesEric Lesh, Jul 29, 2007
  3. Josef SipekJul 30, 2007
  4. Eric LeshJul 30, 2007
  5. Josef SipekJul 30, 2007
  6. Eric LeshJul 30, 2007
  7. 2/4 guilt-guard: Assign guards to patches in seriesEric Lesh, Jul 29, 2007
  8. Josef SipekJul 30, 2007
  9. Eric LeshJul 30, 2007
  10. Josef SipekJul 30, 2007
  11. 3/4 guilt-select: Select guards to apply when pushing patchesEric Lesh, Jul 29, 2007
  12. Josef SipekJul 30, 2007
  13. Eric LeshJul 30, 2007
  14. Josef SipekJul 30, 2007
  15. 4/4 Use guards information and functionsEric Lesh, Jul 29, 2007
  16. Josef SipekJul 30, 2007
  17. Eric LeshJul 30, 2007
  18. Josef SipekJul 30, 2007
  19. Eric LeshJul 30, 2007
  20. Josef SipekJul 30, 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.