From: David Kågedal Date: Wed, 19 Dec 2007 18:00:10 +0000 (+0000) Subject: Remove the 'bottom' field X-Git-Tag: v0.15-rc1~344 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/8762753a9f1269a18aaac70a40e6b886d11fc664?hp=0e1c86f9ff8a81055a45c807cf1218d3ff28d986 Remove the 'bottom' field The bottom is instead always calculated from the top by getting its parent commit. Signed-off-by: David Kågedal Signed-off-by: Karl Hasselström --- diff --git a/stgit/commands/sync.py b/stgit/commands/sync.py index 660ee41..e8e3bac 100644 --- a/stgit/commands/sync.py +++ b/stgit/commands/sync.py @@ -149,7 +149,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 f54bec4..25de0f1 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -162,7 +162,6 @@ class Patch(StgitObject): def create(self): os.mkdir(self._dir()) - self.create_empty_field('bottom') self.create_empty_field('top') def delete(self, keep_log = False): @@ -208,22 +207,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') @@ -243,14 +230,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 @@ -828,7 +812,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) @@ -942,11 +925,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') @@ -1000,7 +980,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: @@ -1028,7 +1007,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)') @@ -1101,7 +1079,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)