X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/6889c93cb0d60acea1af4b490559cc88b4128de5..c0af9df25a01b9d6eb4dd7fddbff3c56be588123:/stgit/stack.py diff --git a/stgit/stack.py b/stgit/stack.py index e61d45b..5e9d4fb 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -841,9 +841,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()) + if name != None: self.__patch_name_valid(name) if self.patch_exists(name): @@ -883,9 +890,6 @@ class Series(PatchSet): if before_existing: insert_string(self.__applied_file, patch.get_name()) - # no need to commit anything as the object is already - # present (mainly used by 'uncommit') - commit = False elif unapplied: patches = [patch.get_name()] + self.get_unapplied() write_strings(self.__unapplied_file, patches) @@ -910,6 +914,8 @@ class Series(PatchSet): committer_email = committer_email) # set the patch top to the new commit patch.set_top(commit_id) + else: + assert top != bottom self.log_patch(patch, 'new')