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

Re: [StGit PATCH 09/13] Clear up the semantics of Series.new_patch

From
David Kågedal <davidk@lysator.liu.se>
Date
Oct 10, 2007, 07:43 UTC
Message-ID
<87prznxvmq.fsf@lysator.liu.se>
In-Reply-To
<b0943d9e0710091401s280b3a12md9e700fb3ae007bf@mail.gmail.com>
"Catalin Marinas" <catalin.marinas@gmail.com> writes:
Show 21 quoted lines
> On 08/10/2007, Karl Hasselström <kha@treskal.com> wrote:
>> On 2007-10-08 14:16:10 +0100, Catalin Marinas wrote:
>>
>> > On 14/09/2007, David Kågedal <davidk@lysator.liu.se> wrote:
>> >
>> > > +        assert commit or (top and bottom)
>> > > +        assert not before_existing or (top and bottom)
>> > > +        assert not (commit and before_existing)
>> > > +        assert (top and bottom) or (not top and not bottom)
>> > > +        assert not top or (bottom == git.get_commit(top).get_parent())
>> >
>> > The last assertion here prevents the use of 'stg pick --reverse'.
>> > This command creates an unapplied patch with top and bottom reversed
>> > and pushes it to force a three-way merge.
>> >
>> > It seems to work OK if I comment it out but I wonder whether it will
>> > break in the future with the planned removal of the top and bottom
>> > files.
>>
>> I think the assert represents a real constraint, namely that there has
>> to be a 1:1 correspondance between patches and commits.
Yes, that was the point of the series.
Show 6 quoted lines
>> Couldn't "stg pick --reverse" create a new commit and use that? That
>> is, given that we want to revert commit C, create a new commit C* with
>
> Series.new_patch already creates a commit, why should we move the
> functionality to 'pick'? The only call to new_patch with commit=False
> seems to be from 'uncommit' (and it makes sense indeed).

It might be true that the assertion could be amended so that if commit=True, then it is allowed to have top/bottom that doesn't correspond to a commit and its parent. But it's hard to be sure without looking at the code much harder than I did just now. Testing would also help.

Show 6 quoted lines
>> And shouldn't there be a test for this? :-)
>
> Yes :-). I think there are many other tests needed. It would be useful
> to do a code coverage with the existing tests to see what we are
> missing. Unit testing might be useful as well but we all have limited
> spare time.
-- 
David Kågedal
Previous: Catalin MarinasNext: Catalin Marinas
Message 15 of 30 in “Eliminate 'top' and 'bottom' files”
  1. 00/13 Eliminate 'top' and 'bottom' filesDavid Kågedal, Sep 14, 2007
  2. 01/13 Add some more tests of "stg status" outputDavid Kågedal, Sep 14, 2007
  3. 02/13 Clear up semantics of tree_statusDavid Kågedal, Sep 14, 2007
  4. 03/13 Moved that status function to the status command fileDavid Kågedal, Sep 14, 2007
  5. David KågedalSep 14, 2007
  6. 04/13 Split Series.push_patch in twoDavid Kågedal, Sep 14, 2007
  7. 05/13 Remove dead code from push_empty_patchDavid Kågedal, Sep 14, 2007
  8. 06/13 Refactor Series.push_patchDavid Kågedal, Sep 14, 2007
  9. 07/13 Clean up Series.refresh_patchDavid Kågedal, Sep 14, 2007
  10. 08/13 Add a 'bottom' parameter to Series.refresh_patch and use itDavid Kågedal, Sep 14, 2007
  11. 09/13 Clear up the semantics of Series.new_patchDavid Kågedal, Sep 14, 2007
  12. Catalin MarinasOct 8, 2007
  13. Karl HasselströmOct 8, 2007
  14. Catalin MarinasOct 9, 2007
  15. David KågedalOct 10, 2007
  16. Catalin MarinasOct 11, 2007
  17. Karl HasselströmOct 10, 2007
  18. Karl HasselströmOct 10, 2007
  19. 10/13 Refactor Series.new_patchDavid Kågedal, Sep 14, 2007
  20. 11/13 Check bottom and invariantsDavid Kågedal, Sep 14, 2007
  21. 12/13 Remove the 'bottom' fieldDavid Kågedal, Sep 14, 2007
  22. 13/13 Remove the 'top' fieldDavid Kågedal, Sep 14, 2007
  23. Karl HasselströmSep 15, 2007
  24. David KågedalSep 16, 2007
  25. Karl HasselströmSep 17, 2007
  26. Karl HasselströmSep 15, 2007
  27. Catalin MarinasSep 16, 2007
  28. David KågedalSep 16, 2007
  29. Karl HasselströmSep 17, 2007
  30. David KågedalSep 16, 2007

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.