summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7ed863a)
raw | patch | inline | side by side (parent: 7ed863a)
author | Michael J Gruber <git@drmicha.warpmail.net> | |
Mon, 21 Feb 2011 16:09:11 +0000 (17:09 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 22 Feb 2011 00:30:58 +0000 (16:30 -0800) |
The existing "--cherry-pick" does not work with unsymmetric ranges
(A..B) for obvious reasons.
Introduce "--left-only" and "--right-only" which limit the output to
commits on the respective sides of a symmetric range (i.e. only "<"
resp. ">" commits as per "--left-right").
This is especially useful for things like
git log --cherry-pick --right-only @{u}...
which is much more flexible (and descriptive) than
git cherry @{u} | sed -ne 's/^+ //p'
and potentially more useful than
git log --cherry-pick @{u}...
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
(A..B) for obvious reasons.
Introduce "--left-only" and "--right-only" which limit the output to
commits on the respective sides of a symmetric range (i.e. only "<"
resp. ">" commits as per "--left-right").
This is especially useful for things like
git log --cherry-pick --right-only @{u}...
which is much more flexible (and descriptive) than
git cherry @{u} | sed -ne 's/^+ //p'
and potentially more useful than
git log --cherry-pick @{u}...
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c | patch | blob | history | |
revision.h | patch | blob | history |
diff --git a/revision.c b/revision.c
index 7b9eaefae4ed03e994c2122453144b3c09591b9c..0681c7c309a81f9addef2a8d6bba7687dea637e7 100644 (file)
--- a/revision.c
+++ b/revision.c
return bottom;
}
+/* Assumes either left_only or right_only is set */
+static void limit_left_right(struct commit_list *list, struct rev_info *revs)
+{
+ struct commit_list *p;
+
+ for (p = list; p; p = p->next) {
+ struct commit *commit = p->item;
+
+ if (revs->right_only) {
+ if (commit->object.flags & SYMMETRIC_LEFT)
+ commit->object.flags |= SHOWN;
+ } else /* revs->left_only is set */
+ if (!(commit->object.flags & SYMMETRIC_LEFT))
+ commit->object.flags |= SHOWN;
+ }
+}
+
static int limit_list(struct rev_info *revs)
{
int slop = SLOP;
if (revs->cherry_pick)
cherry_pick_list(newlist, revs);
+ if (revs->left_only || revs->right_only)
+ limit_left_right(newlist, revs);
+
if (bottom) {
limit_to_ancestry(bottom, newlist);
free_commit_list(bottom);
@@ -1263,6 +1283,10 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
revs->boundary = 1;
} else if (!strcmp(arg, "--left-right")) {
revs->left_right = 1;
+ } else if (!strcmp(arg, "--left-only")) {
+ revs->left_only = 1;
+ } else if (!strcmp(arg, "--right-only")) {
+ revs->right_only = 1;
} else if (!strcmp(arg, "--count")) {
revs->count = 1;
} else if (!strcmp(arg, "--cherry-pick")) {
diff --git a/revision.h b/revision.h
index 05659c64acd7fe8eb7be011cee6174e397e57baf..d2ffde1ce67a555ec6ac8b00b3b225a7bdad2319 100644 (file)
--- a/revision.h
+++ b/revision.h
boundary:2,
count:1,
left_right:1,
+ left_only:1,
+ right_only:1,
rewrite_parents:1,
print_parents:1,
show_source:1,