The bottom is instead always calculated from the top by getting its parent commit. Signed-off-by: David Kågedal <davidk@xxxxxxxxxxxxxx> --- stgit/commands/sync.py | 1 - stgit/stack.py | 29 +++-------------------------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/stgit/commands/sync.py b/stgit/commands/sync.py index 580b5bd..c18d7e0 100644 --- a/stgit/commands/sync.py +++ b/stgit/commands/sync.py @@ -148,7 +148,6 @@ def func(parser, options, args): # reset the patch backup information. That's needed in case we # undo the sync but there were no changes made - patch.set_bottom(bottom, backup = True) patch.set_top(top, backup = True) # the actual merging (either from a branch or an external file) diff --git a/stgit/stack.py b/stgit/stack.py index d9a2e56..00b91c6 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -158,7 +158,6 @@ class Patch(StgitObject): def create(self): os.mkdir(self._dir()) - self.create_empty_field('bottom') self.create_empty_field('top') def delete(self): @@ -197,22 +196,10 @@ class Patch(StgitObject): self.__update_top_ref(top) def get_old_bottom(self): - old_bottom = self._get_field('bottom.old') - old_top = self.get_old_top() - assert old_bottom == git.get_commit(old_top).get_parent() - return old_bottom + return git.get_commit(self.get_old_top()).get_parent() def get_bottom(self): - bottom = self._get_field('bottom') - top = self.get_top() - assert bottom == git.get_commit(top).get_parent() - return self._get_field('bottom') - - def set_bottom(self, value, backup = False): - if backup: - curr = self._get_field('bottom') - self._set_field('bottom.old', curr) - self._set_field('bottom', value) + return git.get_commit(self.get_top()).get_parent() def get_old_top(self): return self._get_field('top.old') @@ -232,14 +219,11 @@ class Patch(StgitObject): self._set_field('top.old', curr) self._set_field('top', value) self.__update_top_ref(value) - self.get_bottom() # check the assert def restore_old_boundaries(self): - bottom = self._get_field('bottom.old') top = self._get_field('top.old') - if top and bottom: - self._set_field('bottom', bottom) + if top: self._set_field('top', top) self.__update_top_ref(top) return True @@ -806,7 +790,6 @@ class Series(PatchSet): committer_name = committer_name, committer_email = committer_email) - patch.set_bottom(bottom, backup = backup) patch.set_top(commit_id, backup = backup) patch.set_description(descr) patch.set_authname(author_name) @@ -914,11 +897,8 @@ class Series(PatchSet): committer_name = committer_name, committer_email = committer_email) # set the patch top to the new commit - patch.set_bottom(bottom) patch.set_top(commit_id) else: - assert top != bottom - patch.set_bottom(bottom) patch.set_top(top) self.log_patch(patch, 'new') @@ -972,7 +952,6 @@ class Series(PatchSet): if head == bottom: # reset the backup information. No logging since the # patch hasn't changed - patch.set_bottom(head, backup = True) patch.set_top(top, backup = True) else: @@ -1000,7 +979,6 @@ class Series(PatchSet): committer_name = committer_name, committer_email = committer_email) - patch.set_bottom(head, backup = True) patch.set_top(top, backup = True) self.log_patch(patch, 'push(f)') @@ -1073,7 +1051,6 @@ class Series(PatchSet): if head == bottom: # A fast-forward push. Just reset the backup # information. No need for logging - patch.set_bottom(bottom, backup = True) patch.set_top(top, backup = True) git.switch(top) - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html