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 3/4] guilt-select: Select guards to apply when pushing patches
Date: Sun, 29 Jul 2007 00:50:17 -0700	[thread overview]
Message-ID: <11856954182318-git-send-email-eclesh@ucla.edu> (raw)
In-Reply-To: <118569541814-git-send-email-eclesh@ucla.edu>

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
@@ -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"
+	else
+		echo "No guards applied"
+	fi
+	exit 0
+fi
+
+case $1 in
+	-n|--none)
+		rm -f "$guards_file"
+		touch "$guards_file"
+		;;
+	-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

  parent reply	other threads:[~2007-07-29  7:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-29  7:50 [GUILT PATCH 0/4] Add guards to guilt Eric Lesh
2007-07-29  7:50 ` [GUILT PATCH 1/4] get_series: Remove comments from end of series lines Eric Lesh
2007-07-30  3:54   ` Josef Sipek
2007-07-30  5:15     ` Eric Lesh
2007-07-30  5:26       ` Josef Sipek
2007-07-30  7:07         ` Eric Lesh
2007-07-29  7:50 ` [GUILT PATCH 2/4] guilt-guard: Assign guards to patches in series Eric Lesh
2007-07-30  4:06   ` Josef Sipek
2007-07-30  6:41     ` Eric Lesh
2007-07-30 19:28       ` Josef Sipek
2007-07-29  7:50 ` Eric Lesh [this message]
2007-07-30  4:12   ` [GUILT PATCH 3/4] guilt-select: Select guards to apply when pushing patches Josef Sipek
2007-07-30  7:02     ` Eric Lesh
2007-07-30 19:34       ` Josef Sipek
2007-07-29  7:50 ` [GUILT PATCH 4/4] Use guards information and functions Eric Lesh
2007-07-30  4:15   ` Josef Sipek
2007-07-30  7:06     ` Eric Lesh
2007-07-30  3:54 ` [GUILT PATCH 0/4] Add guards to guilt Josef Sipek
2007-07-30  8:32   ` Eric Lesh
2007-07-30 19:20     ` 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=11856954182318-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).