git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCHv2 0/9] --left/right-only and --cherry-mark

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Mar 11, 2011, 07:52 UTC
Message-ID
<4D79D4CC.7020806@drmicha.warpmail.net>
In-Reply-To
<7v4o7a6dj3.fsf@alter.siamese.dyndns.org>
Junio C Hamano venit, vidit, dixit 10.03.2011 19:22:
Show 38 quoted lines
> Michael J Gruber <git@drmicha.warpmail.net> writes:
> 
>> ...
>> Additionally, since parse_revision_opt (which calls handle_revision_opt)
>> is called from other sites for individual args we would need to do the
>> handling in the Y case (set pick when marking) right in
>> handle_revision_opt, not just in setup_revisions. It's a matter of a few
>> more if's and or's, but still.
>>
>> Taking these together, I wonder whether we shouldn't leave it as in v2.
> 
> The primary downside of keeping cherry_pick and cherry_mark as independent
> I see is what would happen to the "if (cherry_pick || cherry_mark)" when
> somebody comes up with the next bright idea to use the change equivalence
> computed in cherry_pick_list(). With the approach in v2, the natural way
> of enhancing this would be to add another "|| cherry_xyzzy" there, and the
> next bright idea would add another "|| cherry_frotz".
> 
> My gut feeling was that it would be a more maintainable implementation to
> have an internal bit that does not have to be exposed to the UI and that
> tells the revision machinery that we need to compute the equivalence, and
> an enum (if the three modes of using the equivalence are incompatible with
> each other) or a one-bit-per-feature bitset (if the three features that
> use the equivalence can be used at the same time) that tells the machinery
> what to do with the equivalence information. From the UI level, the user
> only asks for the feature(s) that use(s) the equivalence information, and
> asking for any of them would set the internal "need equivalence" bit.
> 
> The above is modeled after the way how revs.limited bit is used. That bit
> corresponds to the "internal bit" that is flipped by many features that
> can be triggered from the UI level that depends on having the history
> graph before they do their work.
> 
> Counting the number of "if (limited)" and tricky codepaths around it, and
> contrasting that with the number of ways we flip the "limited = 1" bit
> (which grew over time), I think you can understand where my fear of
> potential future complexity against "if (cherry_pick || cherry_mark)"
> comes from.
I see, thanks for the background!

Other callers of the revision walker have to remember that they need to set revs->limited already when they want to use any limitting flags, so revs->cherry_pick as in v3 would be no different.(*)

So maybe we should have another flag revs->cherry_process which is set automatically when needed, after processing all options (same with limited), and leave cherry_pick to keep track of --cherry-pick?

(*) Well, in fact they don't as long as they use the api correctly. blame and shortlog call parse_revision_opt but use setup_revisions and prepare_revision_walk afterwards. pack-objects calls handle_revision_arg after setup_revisions but prepare_revision_walk after. I was afraid of callers setting revs->something inconsistently and then jumping into the walker.

So, maybe prepare_revision_walk is the most sensible place to set revs->limited and revs->cherry_process when needed as indicated by other flags (or set already), and take out their handling from the option parser?

Michael
Previous: Junio C HamanoNext: Junio C Hamano
Message 29 of 30 in “[PATCHv2 0/9] --left/right-only and --cherry-mark”
  1. Michael J GruberMar 7, 2011
  2. 1/9 revlist.c: introduce --left/right-only for unsymmetric pickingMichael J Gruber, Mar 7, 2011
  3. 2/9 t6007: Make sure we test --cherry-pickMichael J Gruber, Mar 7, 2011
  4. 3/9 rev-list: documentation and test for --left/right-onlyMichael J Gruber, Mar 7, 2011
  5. 4/9 rev-list: --left/right-only are mutually exclusiveMichael J Gruber, Mar 7, 2011
  6. 5/9 rev-list/log: factor out revision mark generationMichael J Gruber, Mar 7, 2011
  7. 6/9 revision.c: introduce --cherry-markMichael J Gruber, Mar 7, 2011
  8. Junio C HamanoMar 9, 2011
  9. 6/9 revision.c: introduce --cherry-markMichael J Gruber, Mar 10, 2011
  10. 7/9 rev-list: documentation and test for --cherry-markMichael J Gruber, Mar 7, 2011
  11. 8/9 log --cherry: a synonymMichael J Gruber, Mar 7, 2011
  12. 9/9 t6007: test rev-list --cherryMichael J Gruber, Mar 7, 2011
  13. Junio C HamanoMar 9, 2011
  14. Michael J GruberMar 10, 2011
  15. Junio C HamanoMar 10, 2011
  16. Michael J GruberMar 10, 2011
  17. 00/10 --left/right-only and --cherry-markMichael J Gruber, Mar 10, 2011
  18. 01/10 revlist.c: introduce --left/right-only for unsymmetric pickingMichael J Gruber, Mar 10, 2011
  19. 02/10 t6007: Make sure we test --cherry-pickMichael J Gruber, Mar 10, 2011
  20. 03/10 rev-list: documentation and test for --left/right-onlyMichael J Gruber, Mar 10, 2011
  21. 04/10 rev-list: --left/right-only are mutually exclusiveMichael J Gruber, Mar 10, 2011
  22. 05/10 rev-list/log: factor out revision mark generationMichael J Gruber, Mar 10, 2011
  23. 06/10 revision.c: introduce --cherry-markMichael J Gruber, Mar 10, 2011
  24. 07/10 rev-list: documentation and test for --cherry-markMichael J Gruber, Mar 10, 2011
  25. 08/10 log --cherry: a synonymMichael J Gruber, Mar 10, 2011
  26. 09/10 t6007: test rev-list --cherryMichael J Gruber, Mar 10, 2011
  27. 10/10 git-log: put space after commit markMichael J Gruber, Mar 10, 2011
  28. Junio C HamanoMar 10, 2011
  29. Michael J GruberMar 11, 2011
  30. Junio C HamanoMar 11, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.