Re: [StGit PATCH 09/13] Clear up the semantics of Series.new_patch
- From
- Catalin Marinas <catalin.marinas@gmail.com>
- Date
- Oct 8, 2007, 13:16 UTC
- Message-ID
- <b0943d9e0710080616r36142946m3e24d2f6893287c9@mail.gmail.com>
- In-Reply-To
- <20070914223154.7001.12254.stgit@morpheus.local>
On 14/09/2007, David Kågedal <davidk@lysator.liu.se> wrote:
Show 5 quoted lines
> This patch adds a number of assertions to document and verify the > complex restrictions of the input parameters to the Series.new_patch > function. It also adds the requirement that 'before_existing' and > 'commit' cannot be true at the same time when calling it, instead of > updating 'commit' inside the function.
[...]
Show 16 quoted lines
> --- a/stgit/stack.py > +++ b/stgit/stack.py > @@ -833,9 +833,16 @@ class Series(PatchSet): > author_name = None, author_email = None, author_date = None, > committer_name = None, committer_email = None, > before_existing = False): > - """Creates a new patch > + """Creates a new patch, either pointing to an existing commit object, > + or by creating a new commit object. > """ > > + 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.
Thanks.
-- Catalin