From: "David Kågedal" <davidk@lysator.liu.se>
To: git@vger.kernel.org, catalin.marinas@gmail.com
Subject: [StGit PATCH 12/13] Remove the 'bottom' field
Date: Sat, 15 Sep 2007 00:32:10 +0200 [thread overview]
Message-ID: <20070914223210.7001.67124.stgit@morpheus.local> (raw)
In-Reply-To: <20070914222819.7001.55921.stgit@morpheus.local>
The bottom is instead always calculated from the top by getting its
parent commit.
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---
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)
next prev parent reply other threads:[~2007-09-14 22:32 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-14 22:31 [StGit PATCH 00/13] Eliminate 'top' and 'bottom' files David Kågedal
2007-09-14 22:31 ` [StGit PATCH 01/13] Add some more tests of "stg status" output David Kågedal
2007-09-14 22:31 ` [StGit PATCH 02/13] Clear up semantics of tree_status David Kågedal
2007-09-14 22:31 ` [StGit PATCH 03/13] Moved that status function to the status command file David Kågedal
2007-09-14 22:36 ` David Kågedal
2007-09-14 22:31 ` [StGit PATCH 04/13] Split Series.push_patch in two David Kågedal
2007-09-14 22:31 ` [StGit PATCH 05/13] Remove dead code from push_empty_patch David Kågedal
2007-09-14 22:31 ` [StGit PATCH 06/13] Refactor Series.push_patch David Kågedal
2007-09-14 22:31 ` [StGit PATCH 07/13] Clean up Series.refresh_patch David Kågedal
2007-09-14 22:31 ` [StGit PATCH 08/13] Add a 'bottom' parameter to Series.refresh_patch and use it David Kågedal
2007-09-14 22:31 ` [StGit PATCH 09/13] Clear up the semantics of Series.new_patch David Kågedal
2007-10-08 13:16 ` Catalin Marinas
2007-10-08 13:25 ` Karl Hasselström
2007-10-09 21:01 ` Catalin Marinas
2007-10-10 7:43 ` David Kågedal
2007-10-11 20:42 ` Catalin Marinas
2007-10-10 7:45 ` Karl Hasselström
2007-10-10 8:15 ` Karl Hasselström
2007-09-14 22:32 ` [StGit PATCH 10/13] Refactor Series.new_patch David Kågedal
2007-09-14 22:32 ` [StGit PATCH 11/13] Check bottom and invariants David Kågedal
2007-09-14 22:32 ` David Kågedal [this message]
2007-09-14 22:32 ` [StGit PATCH 13/13] Remove the 'top' field David Kågedal
2007-09-15 23:36 ` Karl Hasselström
2007-09-16 10:22 ` David Kågedal
2007-09-17 7:30 ` Karl Hasselström
2007-09-15 23:42 ` [StGit PATCH 00/13] Eliminate 'top' and 'bottom' files Karl Hasselström
2007-09-16 7:28 ` Catalin Marinas
2007-09-16 10:28 ` David Kågedal
2007-09-17 8:17 ` Karl Hasselström
2007-09-16 10:25 ` David Kågedal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070914223210.7001.67124.stgit@morpheus.local \
--to=davidk@lysator.liu.se \
--cc=catalin.marinas@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).