git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCHv3 08/10] log --cherry: a synonym
Date: Thu, 10 Mar 2011 15:45:01 +0100	[thread overview]
Message-ID: <e5a72f0ddc0ddc9b6087c08143b188043f3bea1f.1299767413.git.git@drmicha.warpmail.net> (raw)
In-Reply-To: <4D78AC8B.7010308@drmicha.warpmail.net>
In-Reply-To: <cover.1299767412.git.git@drmicha.warpmail.net>

At the Porcelain level, because by definition there are many more contributors
than integrators, it makes sense to give a handy short-hand for --right-only
used with --cherry-mark and --no-merges.  Make it so.

In other words, this provides "git cherry with rev-list interface".

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 Documentation/rev-list-options.txt |    8 ++++++++
 revision.c                         |   13 +++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 4755b83..95d209c 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -337,6 +337,14 @@ commits from `B` which are in `A` or are patch-equivalent to a commit in
 More precisely, `--cherry-pick --right-only --no-merges` gives the exact
 list.
 
+--cherry::
+
+	A synonym for `--right-only --cherry-mark --no-merges`; useful to
+	limit the output to the commits on our side and mark those that
+	have been applied to the other side of a forked history with
+	`git log --cherry upstream...mybranch`, similar to
+	`git cherry upstream mybranch`.
+
 -g::
 --walk-reflogs::
 
diff --git a/revision.c b/revision.c
index 864bc9b..4881263 100644
--- a/revision.c
+++ b/revision.c
@@ -1288,16 +1288,25 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 		revs->left_right = 1;
 	} else if (!strcmp(arg, "--left-only")) {
 		if (revs->right_only)
-			die("--left-only is incompatible with --right-only");
+			die("--left-only is incompatible with --right-only"
+			    " or --cherry");
 		revs->left_only = 1;
 	} else if (!strcmp(arg, "--right-only")) {
 		if (revs->left_only)
 			die("--right-only is incompatible with --left-only");
 		revs->right_only = 1;
+	} else if (!strcmp(arg, "--cherry")) {
+		if (revs->left_only)
+			die("--cherry is incompatible with --left-only");
+		revs->cherry_mark = 1;
+		revs->cherry_pick = 1;
+		revs->right_only = 1;
+		revs->no_merges = 1;
+		revs->limited = 1;
 	} else if (!strcmp(arg, "--count")) {
 		revs->count = 1;
 	} else if (!strcmp(arg, "--cherry-mark")) {
-		if (revs->cherry_pick && !revs->cherry-mark)
+		if (revs->cherry_pick && !revs->cherry_mark)
 			die("--cherry-mark is incompatible with --cherry-pick");
 		revs->cherry_mark = 1;
 		revs->cherry_pick = 1;
-- 
1.7.4.1.317.gf445f

  parent reply	other threads:[~2011-03-10 14:49 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-07 12:31 [PATCHv2 0/9] --left/right-only and --cherry-mark Michael J Gruber
2011-03-07 12:31 ` [PATCHv2 1/9] revlist.c: introduce --left/right-only for unsymmetric picking Michael J Gruber
2011-03-07 12:31 ` [PATCHv2 2/9] t6007: Make sure we test --cherry-pick Michael J Gruber
2011-03-07 12:31 ` [PATCHv2 3/9] rev-list: documentation and test for --left/right-only Michael J Gruber
2011-03-07 12:31 ` [PATCHv2 4/9] rev-list: --left/right-only are mutually exclusive Michael J Gruber
2011-03-07 12:31 ` [PATCHv2 5/9] rev-list/log: factor out revision mark generation Michael J Gruber
2011-03-07 12:31 ` [PATCHv2 6/9] revision.c: introduce --cherry-mark Michael J Gruber
2011-03-09 21:29   ` Junio C Hamano
2011-03-10  8:23     ` [PATCHv2+ " Michael J Gruber
2011-03-07 12:31 ` [PATCHv2 7/9] rev-list: documentation and test for --cherry-mark Michael J Gruber
2011-03-07 12:31 ` [PATCHv2 8/9] log --cherry: a synonym Michael J Gruber
2011-03-07 12:31 ` [PATCHv2 9/9] t6007: test rev-list --cherry Michael J Gruber
2011-03-09 21:49 ` [PATCHv2 0/9] --left/right-only and --cherry-mark Junio C Hamano
2011-03-10  8:08   ` Michael J Gruber
2011-03-10  9:56     ` Junio C Hamano
2011-03-10 10:48       ` Michael J Gruber
2011-03-10 14:44         ` [PATCHv3 00/10] " Michael J Gruber
2011-03-10 14:44           ` [PATCHv3 01/10] revlist.c: introduce --left/right-only for unsymmetric picking Michael J Gruber
2011-03-10 14:44           ` [PATCHv3 02/10] t6007: Make sure we test --cherry-pick Michael J Gruber
2011-03-10 14:44           ` [PATCHv3 03/10] rev-list: documentation and test for --left/right-only Michael J Gruber
2011-03-10 14:44           ` [PATCHv3 04/10] rev-list: --left/right-only are mutually exclusive Michael J Gruber
2011-03-10 14:44           ` [PATCHv3 05/10] rev-list/log: factor out revision mark generation Michael J Gruber
2011-03-10 14:44           ` [PATCHv3 06/10] revision.c: introduce --cherry-mark Michael J Gruber
2011-03-10 14:45           ` [PATCHv3 07/10] rev-list: documentation and test for --cherry-mark Michael J Gruber
2011-03-10 14:45           ` Michael J Gruber [this message]
2011-03-10 14:45           ` [PATCHv3 09/10] t6007: test rev-list --cherry Michael J Gruber
2011-03-10 14:45           ` [PATCHv3 10/10] git-log: put space after commit mark Michael J Gruber
2011-03-10 18:22         ` [PATCHv2 0/9] --left/right-only and --cherry-mark Junio C Hamano
2011-03-11  7:52           ` Michael J Gruber
2011-03-11  8:02             ` Junio C Hamano

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=e5a72f0ddc0ddc9b6087c08143b188043f3bea1f.1299767413.git.git@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).