From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCHv2 2/2] rev-list: documentation and test for --left/right-only
Date: Mon, 21 Feb 2011 17:09:12 +0100 [thread overview]
Message-ID: <c0fce67ba8ab8e4ead233950d74048a95d3b64a6.1298304396.git.git@drmicha.warpmail.net> (raw)
In-Reply-To: <4D625972.4090500@drmicha.warpmail.net>
In-Reply-To: <a3224c4269b26c366bb5b5df691f22f17b767f83.1298304396.git.git@drmicha.warpmail.net>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
Notes:
v2 adjusts to the new naming and tests both left and right.
Documentation/git-rev-list.txt | 2 ++
Documentation/rev-list-options.txt | 13 +++++++++++++
t/t6007-rev-list-cherry-pick-file.sh | 32 ++++++++++++++++++++++++++++----
3 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index 8e1e329..5f47a13 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -31,6 +31,8 @@ SYNOPSIS
[ \--parents ]
[ \--timestamp ]
[ \--left-right ]
+ [ \--left-only ]
+ [ \--right-only ]
[ \--cherry-pick ]
[ \--encoding[=<encoding>] ]
[ \--(author|committer|grep)=<pattern> ]
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 44a2ef1..1e67d95 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -319,6 +319,19 @@ from the other branch (for example, "3rd on b" may be cherry-picked
from branch A). With this option, such pairs of commits are
excluded from the output.
+--left-only::
+--right-only::
+
+ List only commits on the respective side of a symmetric range,
+ i.e. only those which would be marked `<` resp. `>` by
+ `--left-right`.
++
+For example, `--cherry-pick --right-only A...B` omits those
+commits from `B` which are in `A` or are patch-equivalent to a commit in
+`A`. In other words, this lists the `{plus}` commits from `git cherry A B`.
+More precisely, `--cherry-pick --right-only --ignore-merges` gives the
+exact list.
+
-g::
--walk-reflogs::
diff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh
index 64b72a3..cd089a9 100755
--- a/t/t6007-rev-list-cherry-pick-file.sh
+++ b/t/t6007-rev-list-cherry-pick-file.sh
@@ -4,14 +4,14 @@ test_description='test git rev-list --cherry-pick -- file'
. ./test-lib.sh
-# A---B---D
+# A---B---D---F
# \
# \
# C---E
#
# B changes a file foo.c, adding a line of text. C changes foo.c as
# well as bar.c, but the change in foo.c was identical to change B.
-# D and C change bar in the same way, E differently.
+# D and C change bar in the same way, E and F differently.
test_expect_success setup '
echo Hallo > foo &&
@@ -40,7 +40,12 @@ test_expect_success setup '
git add bar &&
test_tick &&
git commit -m "D" &&
- git tag D
+ git tag D &&
+ echo Nello > bar &&
+ git add bar &&
+ test_tick &&
+ git commit -m "F" &&
+ git tag F
'
cat >expect <<EOF
@@ -83,11 +88,30 @@ test_expect_success 'bar does not come up empty' '
'
cat >expect <<EOF
+<tags/F
>tags/E
EOF
test_expect_success '--cherry-pick bar does not come up empty (II)' '
- git rev-list --left-right --cherry-pick D...E -- bar > actual &&
+ git rev-list --left-right --cherry-pick F...E -- bar > actual &&
+ git name-rev --stdin --name-only --refs="*tags/*" \
+ < actual > actual.named &&
+ test_cmp actual.named expect
+'
+
+cat >expect <<EOF
+tags/E
+EOF
+
+test_expect_success '--cherry-pick --right-only' '
+ git rev-list --cherry-pick --right-only F...E -- bar > actual &&
+ git name-rev --stdin --name-only --refs="*tags/*" \
+ < actual > actual.named &&
+ test_cmp actual.named expect
+'
+
+test_expect_success '--cherry-pick --left-only' '
+ git rev-list --cherry-pick --left-only E...F -- bar > actual &&
git name-rev --stdin --name-only --refs="*tags/*" \
< actual > actual.named &&
test_cmp actual.named expect
--
1.7.4.1.74.gf39475.dirty
next prev parent reply other threads:[~2011-02-21 16:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-18 12:34 [PATCH 1/3] revlist.c: introduce --cherry for unsymmetric picking Michael J Gruber
2011-02-18 12:34 ` [PATCH 2/3] t6007: Make sure we test --cherry-pick Michael J Gruber
2011-02-18 12:34 ` [PATCH 3/3] rev-list: documentation and test for --cherry Michael J Gruber
2011-02-18 19:42 ` [PATCH 1/3] revlist.c: introduce --cherry for unsymmetric picking Junio C Hamano
2011-02-19 14:47 ` Jay Soffian
2011-02-21 12:24 ` Michael J Gruber
2011-02-21 16:09 ` [PATCHv2 1/2] revlist.c: introduce --left/right-only " Michael J Gruber
2011-02-21 16:09 ` Michael J Gruber [this message]
2011-02-21 17:37 ` [PATCHv2 2/2] rev-list: documentation and test for --left/right-only Jay Soffian
2011-02-22 7:23 ` Michael J Gruber
2011-02-22 0:48 ` [PATCHv2 1/2] revlist.c: introduce --left/right-only for unsymmetric picking Junio C Hamano
2011-02-22 1:17 ` Junio C Hamano
2011-02-22 1:19 ` Junio C Hamano
2011-02-22 13:36 ` [PATCH (n+1)/n] t6007: test rev-list --cherry Michael J Gruber
2011-02-21 19:49 ` [PATCH 1/3] revlist.c: introduce --cherry for unsymmetric picking 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=c0fce67ba8ab8e4ead233950d74048a95d3b64a6.1298304396.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).