git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question about "git log --cherry"
@ 2013-09-26 16:35 Francis Moreau
  2013-09-26 20:21 ` John Keeping
  0 siblings, 1 reply; 7+ messages in thread
From: Francis Moreau @ 2013-09-26 16:35 UTC (permalink / raw)
  To: git@vger.kernel.org

Hello,

I'm trying to use "git log --cherry ..." in order to display new, kept
and removed commits between two branches A and B.

So commits which are only in B are considered new and should be marked
with '+'. Commits which are in both branches are marked with '=' but
only commit in branch B are shown. Eventually commits which are in A
but not in B anymore should be marked with '-'.

So far I found this solution:

  $ git log --cherry-mark --right-only A...B
  $ git log --cherry-pick  --left-only   A...B

but I have to call twice git-log. This can be annoying since depending
on A and B, calling git-log can take time.

Is there another option that I'm missing which would do the job but
with only one call to git-log ?

Thanks
-- 
Francis

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question about "git log --cherry"
  2013-09-26 16:35 Question about "git log --cherry" Francis Moreau
@ 2013-09-26 20:21 ` John Keeping
  2013-09-27  5:09   ` Francis Moreau
  0 siblings, 1 reply; 7+ messages in thread
From: John Keeping @ 2013-09-26 20:21 UTC (permalink / raw)
  To: Francis Moreau; +Cc: git@vger.kernel.org

On Thu, Sep 26, 2013 at 06:35:57PM +0200, Francis Moreau wrote:
> I'm trying to use "git log --cherry ..." in order to display new, kept
> and removed commits between two branches A and B.
> 
> So commits which are only in B are considered new and should be marked
> with '+'. Commits which are in both branches are marked with '=' but
> only commit in branch B are shown. Eventually commits which are in A
> but not in B anymore should be marked with '-'.
> 
> So far I found this solution:
> 
>   $ git log --cherry-mark --right-only A...B
>   $ git log --cherry-pick  --left-only   A...B
> 
> but I have to call twice git-log. This can be annoying since depending
> on A and B, calling git-log can take time.
> 
> Is there another option that I'm missing which would do the job but
> with only one call to git-log ?

Does this do what you want?

    git log --cherry-mark --left-right A...B |
    sed -e '/^commit / {
        y/<>/-+/
    }'

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question about "git log --cherry"
  2013-09-26 20:21 ` John Keeping
@ 2013-09-27  5:09   ` Francis Moreau
  2013-09-27  8:11     ` John Keeping
  0 siblings, 1 reply; 7+ messages in thread
From: Francis Moreau @ 2013-09-27  5:09 UTC (permalink / raw)
  To: John Keeping; +Cc: git@vger.kernel.org

Hi,

On Thu, Sep 26, 2013 at 10:21 PM, John Keeping <john@keeping.me.uk> wrote:
> On Thu, Sep 26, 2013 at 06:35:57PM +0200, Francis Moreau wrote:
>> I'm trying to use "git log --cherry ..." in order to display new, kept
>> and removed commits between two branches A and B.
>>
>> So commits which are only in B are considered new and should be marked
>> with '+'. Commits which are in both branches are marked with '=' but
>> only commit in branch B are shown. Eventually commits which are in A
>> but not in B anymore should be marked with '-'.
>>
>> So far I found this solution:
>>
>>   $ git log --cherry-mark --right-only A...B
>>   $ git log --cherry-pick  --left-only   A...B
>>
>> but I have to call twice git-log. This can be annoying since depending
>> on A and B, calling git-log can take time.
>>
>> Is there another option that I'm missing which would do the job but
>> with only one call to git-log ?
>
> Does this do what you want?
>
>     git log --cherry-mark --left-right A...B |
>     sed -e '/^commit / {
>         y/<>/-+/
>     }'

Nope because --left-right shows common commits (with '=' mark) that
belong to A *and* B, and I'd like to have only the ones in B.

Thanks
-- 
Francis

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question about "git log --cherry"
  2013-09-27  5:09   ` Francis Moreau
@ 2013-09-27  8:11     ` John Keeping
  2013-09-27  8:28       ` Francis Moreau
  0 siblings, 1 reply; 7+ messages in thread
From: John Keeping @ 2013-09-27  8:11 UTC (permalink / raw)
  To: Francis Moreau; +Cc: git@vger.kernel.org

On Fri, Sep 27, 2013 at 07:09:03AM +0200, Francis Moreau wrote:
> Hi,
> 
> On Thu, Sep 26, 2013 at 10:21 PM, John Keeping <john@keeping.me.uk> wrote:
> > On Thu, Sep 26, 2013 at 06:35:57PM +0200, Francis Moreau wrote:
> >> I'm trying to use "git log --cherry ..." in order to display new, kept
> >> and removed commits between two branches A and B.
> >>
> >> So commits which are only in B are considered new and should be marked
> >> with '+'. Commits which are in both branches are marked with '=' but
> >> only commit in branch B are shown. Eventually commits which are in A
> >> but not in B anymore should be marked with '-'.
> >>
> >> So far I found this solution:
> >>
> >>   $ git log --cherry-mark --right-only A...B
> >>   $ git log --cherry-pick  --left-only   A...B
> >>
> >> but I have to call twice git-log. This can be annoying since depending
> >> on A and B, calling git-log can take time.
> >>
> >> Is there another option that I'm missing which would do the job but
> >> with only one call to git-log ?
> >
> > Does this do what you want?
> >
> >     git log --cherry-mark --left-right A...B |
> >     sed -e '/^commit / {
> >         y/<>/-+/
> >     }'
> 
> Nope because --left-right shows common commits (with '=' mark) that
> belong to A *and* B, and I'd like to have only the ones in B.

I think the only way you can address this is to post-process the result,
I don't know any way to remove a left side commit only if it is
patch-identical to a right side commit.

It should be relatively easy to filter out any '=' commits that are in
the output of "git rev-list --left-only A...B".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question about "git log --cherry"
  2013-09-27  8:11     ` John Keeping
@ 2013-09-27  8:28       ` Francis Moreau
  2013-09-27  9:14         ` John Keeping
  0 siblings, 1 reply; 7+ messages in thread
From: Francis Moreau @ 2013-09-27  8:28 UTC (permalink / raw)
  To: John Keeping; +Cc: git@vger.kernel.org

On Fri, Sep 27, 2013 at 10:11 AM, John Keeping <john@keeping.me.uk> wrote:
> On Fri, Sep 27, 2013 at 07:09:03AM +0200, Francis Moreau wrote:
>> Hi,
>>
>> On Thu, Sep 26, 2013 at 10:21 PM, John Keeping <john@keeping.me.uk> wrote:
>> > On Thu, Sep 26, 2013 at 06:35:57PM +0200, Francis Moreau wrote:
>> >> I'm trying to use "git log --cherry ..." in order to display new, kept
>> >> and removed commits between two branches A and B.
>> >>
>> >> So commits which are only in B are considered new and should be marked
>> >> with '+'. Commits which are in both branches are marked with '=' but
>> >> only commit in branch B are shown. Eventually commits which are in A
>> >> but not in B anymore should be marked with '-'.
>> >>
>> >> So far I found this solution:
>> >>
>> >>   $ git log --cherry-mark --right-only A...B
>> >>   $ git log --cherry-pick  --left-only   A...B
>> >>
>> >> but I have to call twice git-log. This can be annoying since depending
>> >> on A and B, calling git-log can take time.
>> >>
>> >> Is there another option that I'm missing which would do the job but
>> >> with only one call to git-log ?
>> >
>> > Does this do what you want?
>> >
>> >     git log --cherry-mark --left-right A...B |
>> >     sed -e '/^commit / {
>> >         y/<>/-+/
>> >     }'
>>
>> Nope because --left-right shows common commits (with '=' mark) that
>> belong to A *and* B, and I'd like to have only the ones in B.
>
> I think the only way you can address this is to post-process the result,
> I don't know any way to remove a left side commit only if it is
> patch-identical to a right side commit.
>
> It should be relatively easy to filter out any '=' commits that are in
> the output of "git rev-list --left-only A...B".

yes that's what I'm doing but I was wondering if that's possible to do
that with only one run of git-log/git-rev-list.

Thanks
-- 
Francis

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question about "git log --cherry"
  2013-09-27  8:28       ` Francis Moreau
@ 2013-09-27  9:14         ` John Keeping
  2013-09-27  9:52           ` Francis Moreau
  0 siblings, 1 reply; 7+ messages in thread
From: John Keeping @ 2013-09-27  9:14 UTC (permalink / raw)
  To: Francis Moreau; +Cc: git@vger.kernel.org

On Fri, Sep 27, 2013 at 10:28:05AM +0200, Francis Moreau wrote:
> On Fri, Sep 27, 2013 at 10:11 AM, John Keeping <john@keeping.me.uk> wrote:
> > On Fri, Sep 27, 2013 at 07:09:03AM +0200, Francis Moreau wrote:
> >> Hi,
> >>
> >> On Thu, Sep 26, 2013 at 10:21 PM, John Keeping <john@keeping.me.uk> wrote:
> >> > On Thu, Sep 26, 2013 at 06:35:57PM +0200, Francis Moreau wrote:
> >> >> I'm trying to use "git log --cherry ..." in order to display new, kept
> >> >> and removed commits between two branches A and B.
> >> >>
> >> >> So commits which are only in B are considered new and should be marked
> >> >> with '+'. Commits which are in both branches are marked with '=' but
> >> >> only commit in branch B are shown. Eventually commits which are in A
> >> >> but not in B anymore should be marked with '-'.
> >> >>
> >> >> So far I found this solution:
> >> >>
> >> >>   $ git log --cherry-mark --right-only A...B
> >> >>   $ git log --cherry-pick  --left-only   A...B
> >> >>
> >> >> but I have to call twice git-log. This can be annoying since depending
> >> >> on A and B, calling git-log can take time.
> >> >>
> >> >> Is there another option that I'm missing which would do the job but
> >> >> with only one call to git-log ?
> >> >
> >> > Does this do what you want?
> >> >
> >> >     git log --cherry-mark --left-right A...B |
> >> >     sed -e '/^commit / {
> >> >         y/<>/-+/
> >> >     }'
> >>
> >> Nope because --left-right shows common commits (with '=' mark) that
> >> belong to A *and* B, and I'd like to have only the ones in B.
> >
> > I think the only way you can address this is to post-process the result,
> > I don't know any way to remove a left side commit only if it is
> > patch-identical to a right side commit.
> >
> > It should be relatively easy to filter out any '=' commits that are in
> > the output of "git rev-list --left-only A...B".
> 
> yes that's what I'm doing but I was wondering if that's possible to do
> that with only one run of git-log/git-rev-list.

I don't think it is.  But you only need to use the --cherry-mark option
with one of the runs, so the other one should be very quick - the added
work of calculating patch IDs slows down "git log" a lot.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question about "git log --cherry"
  2013-09-27  9:14         ` John Keeping
@ 2013-09-27  9:52           ` Francis Moreau
  0 siblings, 0 replies; 7+ messages in thread
From: Francis Moreau @ 2013-09-27  9:52 UTC (permalink / raw)
  To: John Keeping; +Cc: git@vger.kernel.org

On Fri, Sep 27, 2013 at 11:14 AM, John Keeping <john@keeping.me.uk> wrote:
> On Fri, Sep 27, 2013 at 10:28:05AM +0200, Francis Moreau wrote:
>> On Fri, Sep 27, 2013 at 10:11 AM, John Keeping <john@keeping.me.uk> wrote:
>> > On Fri, Sep 27, 2013 at 07:09:03AM +0200, Francis Moreau wrote:
>> >> Hi,
>> >>
>> >> On Thu, Sep 26, 2013 at 10:21 PM, John Keeping <john@keeping.me.uk> wrote:
>> >> > On Thu, Sep 26, 2013 at 06:35:57PM +0200, Francis Moreau wrote:
>> >> >> I'm trying to use "git log --cherry ..." in order to display new, kept
>> >> >> and removed commits between two branches A and B.
>> >> >>
>> >> >> So commits which are only in B are considered new and should be marked
>> >> >> with '+'. Commits which are in both branches are marked with '=' but
>> >> >> only commit in branch B are shown. Eventually commits which are in A
>> >> >> but not in B anymore should be marked with '-'.
>> >> >>
>> >> >> So far I found this solution:
>> >> >>
>> >> >>   $ git log --cherry-mark --right-only A...B
>> >> >>   $ git log --cherry-pick  --left-only   A...B
>> >> >>
>> >> >> but I have to call twice git-log. This can be annoying since depending
>> >> >> on A and B, calling git-log can take time.
>> >> >>
>> >> >> Is there another option that I'm missing which would do the job but
>> >> >> with only one call to git-log ?
>> >> >
>> >> > Does this do what you want?
>> >> >
>> >> >     git log --cherry-mark --left-right A...B |
>> >> >     sed -e '/^commit / {
>> >> >         y/<>/-+/
>> >> >     }'
>> >>
>> >> Nope because --left-right shows common commits (with '=' mark) that
>> >> belong to A *and* B, and I'd like to have only the ones in B.
>> >
>> > I think the only way you can address this is to post-process the result,
>> > I don't know any way to remove a left side commit only if it is
>> > patch-identical to a right side commit.
>> >
>> > It should be relatively easy to filter out any '=' commits that are in
>> > the output of "git rev-list --left-only A...B".
>>
>> yes that's what I'm doing but I was wondering if that's possible to do
>> that with only one run of git-log/git-rev-list.
>
> I don't think it is.  But you only need to use the --cherry-mark option
> with one of the runs, so the other one should be very quick - the added
> work of calculating patch IDs slows down "git log" a lot.

That's true, rev-list should be way faster. I think I'll do that.

Thanks.
-- 
Francis

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-09-27  9:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-26 16:35 Question about "git log --cherry" Francis Moreau
2013-09-26 20:21 ` John Keeping
2013-09-27  5:09   ` Francis Moreau
2013-09-27  8:11     ` John Keeping
2013-09-27  8:28       ` Francis Moreau
2013-09-27  9:14         ` John Keeping
2013-09-27  9:52           ` Francis Moreau

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).