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

Re: [PATCH 5/6] sequencer: Expose API to cherry-picking machinery

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Aug 13, 2011, 16:45 UTC
Message-ID
<alpine.LNX.2.00.1108131215170.2056@iabervon.org>
In-Reply-To
<CALkWK0migSRUmhPp0069O_NiRs3gQJbrU8QLdwUJ-kUYAsLz4Q@mail.gmail.com>
On Sat, 13 Aug 2011, Ramkumar Ramachandra wrote:
Show 13 quoted lines
> Hi again,
> 
> Jonathan Nieder writes:
> > Another thought.  I wonder if it's possible to leave
> > sequencer_parse_args() private to builtin/revert.c, making the split
> > a little more logical:
> 
> Yes, I'd like this too.  However, there are two new issues:
> revert_or_cherry_pick_usage and action_name.  The former has two
> callsites: one in prepare_revs (in sequencer.c) and another in
> parse_args (in builtin/revert.c).  Unfortunately, action_name is even
> more complicated to get rid of: the information from it is used all
> over the place.

One thing to consider is that sequencer.c will be used by all sorts of different builtins, which are each implementing instructions given differently by the user. Just because a message makes sense as output from revert.c doesn't mean it will make sense from (for example) bisect*.

> Attempting to attack the problems one by one:
> 1. Make prepare_revs and walk_revs_populate_todo return errors to be
> handled by callers.  This is a fairly small patch that can come before
> the big "code moving patch".

This makes sense. If you type "git log --stat=foo", you don't get a diff usage message, even though it's an error parsing options that were originally part of diff.

> 2. Duplicate action_name in both files.  I don't think it's too
> serious, and we can fix this later.

This is actually probably even a good idea, because the two functions might actually want to give different results. Maybe revert.c will end up doing different sequencer operations depending on whether the commit is a merge, but if revert.c has to give an error, it would call it the same thing either way, because the difference doesn't matter at the level of detail the revert.c works at; on the other hand, sequencer.c would want to distinguish the cases so that it is explaining exactly what it's trying to do in this step because it matters to how the issue would be resolved.

Of course, at the point where you move the code, you only have one piece of code that you're starting from, so they'll be the same. But you might want to name them differently.

Show 7 quoted lines
> It has been enormously annoying to work with this "code moving patch":
> everytime I make some changes to the earlier patches, I have to
> recreate this one by hand; rebase offers no help whatsoever.  After
> throwing away code based on this patch several times, I learnt my
> lesson and restricted my series to avoid building on this patch.  I
> consider this a very serious glitch and I'm interested in fixing it.
> Thoughts?

It's a hard problem, although likely worthwhile to solve. But only when you're not doing anything else, because it's complicated and will take you far afield. Essentially, what you need to do is implement a diff algorithm that can detect reorganization (or copying) of sections; this isn't something you can represent in unified diff output, but that's okay because you're not going to output it. You merge two of these results and apply the result to the base, which gives you a file (potentially with conflicts, which is another interesting issue because you have to represent and explain them somehow).

*: bisect could be using sequencer in order to handle the situation where the user has said "commit A is good, commit B is bad, commit C breaks my system in a way that's unrelated"; the system should then be able to check out a maybe-bad commit and revert C from it, but it would be doing this in response to an instruction from the user: "give me something to test next", and would have to present errors differently.

	-Daniel
*This .sig left intentionally blank*
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 18 of 31 in “Towards a generalized sequencer”
  1. 0/6 Towards a generalized sequencerRamkumar Ramachandra, Aug 11, 2011
  2. 1/6 revert: Don't remove the sequencer state on errorRamkumar Ramachandra, Aug 11, 2011
  3. Jonathan NiederAug 11, 2011
  4. Ramkumar RamachandraAug 13, 2011
  5. 2/6 revert: Free memory after get_message callRamkumar Ramachandra, Aug 11, 2011
  6. Jonathan NiederAug 11, 2011
  7. Ramkumar RamachandraAug 12, 2011
  8. 3/6 revert: Parse instruction sheet more cautiouslyRamkumar Ramachandra, Aug 11, 2011
  9. Jonathan NiederAug 11, 2011
  10. 4/6 revert: Allow mixed pick and revert instructionsRamkumar Ramachandra, Aug 11, 2011
  11. Jonathan NiederAug 11, 2011
  12. Ramkumar RamachandraAug 13, 2011
  13. 5/6 sequencer: Expose API to cherry-picking machineryRamkumar Ramachandra, Aug 11, 2011
  14. Jonathan NiederAug 11, 2011
  15. Jonathan NiederAug 11, 2011
  16. Junio C HamanoAug 11, 2011
  17. Ramkumar RamachandraAug 13, 2011
  18. Daniel BarkalowAug 13, 2011
  19. Ramkumar RamachandraAug 13, 2011
  20. Reusing changes after renaming a file (Re: [PATCH 5/6] sequencer: Expose API to cherry-picking machinery)Jonathan Nieder, Aug 13, 2011
  21. Ramkumar RamachandraAug 13, 2011
  22. Jonathan NiederAug 13, 2011
  23. Jonathan NiederAug 13, 2011
  24. Ramkumar RamachandraAug 13, 2011
  25. 6/6 sequencer: Remove sequencer state after final commitRamkumar Ramachandra, Aug 11, 2011
  26. Jonathan NiederAug 11, 2011
  27. Ramkumar RamachandraAug 12, 2011
  28. Jonathan NiederAug 11, 2011
  29. Ramkumar RamachandraAug 12, 2011
  30. Jonathan NiederAug 12, 2011
  31. Ramkumar RamachandraAug 12, 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.