All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about the revision walking API
@ 2015-01-06  2:02 Mike Hommey
  2015-01-06 10:24 ` Junio C Hamano
  2015-01-06 13:37 ` Christian Couder
  0 siblings, 2 replies; 5+ messages in thread
From: Mike Hommey @ 2015-01-06  2:02 UTC (permalink / raw)
  To: git

Hi,

I would like to know if the revision walking API works as one would
expect with a calling sequence like the following:

- init_revisions
- add_pending_object/setup_revisions
- prepare_revision_walk
- get_revision (repeated)
- reset_revision_walk (I guess)
- add_pending_object
- prepare_revision_walk
- get_revision (repeated)

That is, do a first revision walk based on a given rev_info, then reuse that
rev_info with additional commit objects (in my case, I want to add more
UNINTERESTING commits) and redo a revision walk based on the modified
rev_info (so, avoid reinitializing a rev_info and filling it from
scratch again with the additional UNINTERESTING commits).

I guess I could try and see if that works, but I'd rather have an
informed answer than to derive my own from the fact my testcase would
happen to work by chance.

Cheers,

Mike

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

* Re: Question about the revision walking API
  2015-01-06  2:02 Question about the revision walking API Mike Hommey
@ 2015-01-06 10:24 ` Junio C Hamano
  2015-01-06 10:51   ` Mike Hommey
  2015-01-06 13:37 ` Christian Couder
  1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2015-01-06 10:24 UTC (permalink / raw)
  To: Mike Hommey; +Cc: git

Mike Hommey <mh@glandium.org> writes:

> I would like to know if the revision walking API works as one would
> expect with a calling sequence like the following:
>
> - init_revisions
> - add_pending_object/setup_revisions
> - prepare_revision_walk
> - get_revision (repeated)
> - reset_revision_walk (I guess)

Around here you would need to clear flag bits left on the objects by
your previous traversal.  After "git log A..B", commits in that
range would have various combinations of SEEN, ADDED and SHOWN
flags, and also some commits reachable from A would be marked as
UNINTERESTING.  You do not want these to interfere with your next
traversal which may not have anything to do with what you computed
with the previous round.

> - add_pending_object
> - prepare_revision_walk
> - get_revision (repeated)

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

* Re: Question about the revision walking API
  2015-01-06 10:24 ` Junio C Hamano
@ 2015-01-06 10:51   ` Mike Hommey
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Hommey @ 2015-01-06 10:51 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Tue, Jan 06, 2015 at 02:24:58AM -0800, Junio C Hamano wrote:
> Mike Hommey <mh@glandium.org> writes:
> 
> > I would like to know if the revision walking API works as one would
> > expect with a calling sequence like the following:
> >
> > - init_revisions
> > - add_pending_object/setup_revisions
> > - prepare_revision_walk
> > - get_revision (repeated)
> > - reset_revision_walk (I guess)
> 
> Around here you would need to clear flag bits left on the objects by
> your previous traversal.  After "git log A..B", commits in that
> range would have various combinations of SEEN, ADDED and SHOWN

afaics, that's what reset_revision_walk does.

> flags, and also some commits reachable from A would be marked as
> UNINTERESTING.

Do you mean the ancestry of A? That wouldn't matter in my case.

> You do not want these to interfere with your next
> traversal which may not have anything to do with what you computed
> with the previous round.

Okay, so aiui, doing a revision walk doesn't impact anything other
than the object flags, so I can safely use add_pending_object to add
to what I already had in the rev_info?

Cheers,

Mike

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

* Re: Question about the revision walking API
  2015-01-06  2:02 Question about the revision walking API Mike Hommey
  2015-01-06 10:24 ` Junio C Hamano
@ 2015-01-06 13:37 ` Christian Couder
  2015-01-06 18:30   ` Junio C Hamano
  1 sibling, 1 reply; 5+ messages in thread
From: Christian Couder @ 2015-01-06 13:37 UTC (permalink / raw)
  To: Mike Hommey; +Cc: git

Hi,


On Tue, Jan 6, 2015 at 3:02 AM, Mike Hommey <mh@glandium.org> wrote:
> Hi,
>
> I would like to know if the revision walking API works as one would
> expect with a calling sequence like the following:
>
> - init_revisions
> - add_pending_object/setup_revisions
> - prepare_revision_walk
> - get_revision (repeated)
> - reset_revision_walk (I guess)
> - add_pending_object
> - prepare_revision_walk
> - get_revision (repeated)
>
> That is, do a first revision walk based on a given rev_info, then reuse that
> rev_info with additional commit objects (in my case, I want to add more
> UNINTERESTING commits) and redo a revision walk based on the modified
> rev_info (so, avoid reinitializing a rev_info and filling it from
> scratch again with the additional UNINTERESTING commits).
>
> I guess I could try and see if that works, but I'd rather have an
> informed answer than to derive my own from the fact my testcase would
> happen to work by chance.

I am not sure what you describe above would work, but something like
what is done in bisect.c should work, see check_ancestors() and
bisect_next_all(). It might not be the most efficient solution though,
so I am interested if you find something more efficient.

Best,
Christian.

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

* Re: Question about the revision walking API
  2015-01-06 13:37 ` Christian Couder
@ 2015-01-06 18:30   ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2015-01-06 18:30 UTC (permalink / raw)
  To: Christian Couder; +Cc: Mike Hommey, git

Christian Couder <christian.couder@gmail.com> writes:

> I am not sure what you describe above would work, but something like
> what is done in bisect.c should work, see check_ancestors() and
> bisect_next_all(). It might not be the most efficient solution though,
> so I am interested if you find something more efficient.

I do not think what bisect does is a correct solution for general
case; I didn't check too carefully when I applied your patch long
time ago, but I recall that you only clear flag bits from commits
that are still in the pending queue in that codepath.  That may be
sufficient if the subsequent traversal goes only outside the area
previous traversal walked, but the approach is inappropriate for
general cases, no?

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

end of thread, other threads:[~2015-01-06 18:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-06  2:02 Question about the revision walking API Mike Hommey
2015-01-06 10:24 ` Junio C Hamano
2015-01-06 10:51   ` Mike Hommey
2015-01-06 13:37 ` Christian Couder
2015-01-06 18:30   ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.