chiark / gitweb /
Write removed fields for backwards compatibility
authorKarl Hasselström <kha@treskal.com>
Wed, 19 Dec 2007 18:00:11 +0000 (18:00 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Wed, 19 Dec 2007 23:13:30 +0000 (23:13 +0000)
Start writing the "top", "bottom", and "bottom.old" fields again. The
last two patches mean we don't need them anymore, but old versions of
StGit still do.

At some later time, we'll want to change the stack on-disk format so
that these can be removed. But we'll probably want to do that as part
of a larger change.

Signed-off-by: Karl Hasselström <kha@treskal.com>
stgit/stack.py

index bdc07a9b23acdb40d50e4e67175720e6babff677..6db789a3277f016e74f1599ec76c458e389511a6 100644 (file)
@@ -196,6 +196,8 @@ class Patch(StgitObject):
 
     def __update_top_ref(self, ref):
         git.set_ref(self.__top_ref, ref)
+        self._set_field('top', ref)
+        self._set_field('bottom', git.get_commit(ref).get_parent())
 
     def __update_log_ref(self, ref):
         git.set_ref(self.__log_ref, ref)
@@ -214,8 +216,9 @@ class Patch(StgitObject):
 
     def set_top(self, value, backup = False):
         if backup:
-            curr = self.get_top()
-            self._set_field('top.old', curr)
+            curr_top = self.get_top()
+            self._set_field('top.old', curr_top)
+            self._set_field('bottom.old', git.get_commit(curr_top).get_parent())
         self.__update_top_ref(value)
 
     def restore_old_boundaries(self):