Re: [PATCH 08/10] revert: Introduce HEAD, TODO files to persist state, plan
From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:51:21
Ramkumar Ramachandra wrote:
is there some API I can use to avoid iterating over all the commits twice? Once to populate the commit_list to persist the TODO, and the second time to actually pick them?
Good catch. (If I understand correctly this was a potential problem with the previous iterations, too.) So, before thinking about what APIs git provides, what is the desired behavior? It is possible to walk a revision list incrementally (like "git log" does); should cherry-pick take advantage of that? . If yes, the "todo list" would have to be in some form that can be updated incrementally (something like the original revision range with the commits already cherry-picked negated). This sounds complicated to me. . If no, the "todo list" needs to be fully resolved to start out, and then the cherry-pick loop can just walk through it. In git API terms, that means first populating the commit_list (for example using a loop that gets revisions and inserts them at the end of a commit_list, or by preparing the revision walk with "limited" flag set), then walking through it with commit_list APIs.