Question about the revision walking API
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
Hi,
Quoted 20 lines · Mike Hommey
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 thatrev_infowith additional commit objects (in my case, I want to add more UNINTERESTING commits) and redo a revision walk based on the modifiedrev_info(so, avoid reinitializing arev_infoand filling it from scratch again with the additional UNINTERESTING commits).
Quoted 3 lines
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.
Quoted 4 lines · Christian Couder
I am not sure what you describe above would work, but something like what is done in
bisect.cshould work, seecheck_ancestors()andbisect_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?
Quoted 8 lines · Mike Hommey
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.
Quoted 3 lines
-
add_pending_object
-prepare_revision_walk
-get_revision(repeated)
Quoted 11 lines · Junio C Hamano
Quoted 8 lines · Mike Hommey
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)
Quoted 3 lines
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.
Quoted 2 lines
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.
Quoted 3 lines
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