chiark / gitweb /
New infrastructure: Make sure that the branch is initialized
authorKarl Hasselström <kha@treskal.com>
Thu, 29 Nov 2007 19:35:27 +0000 (20:35 +0100)
committerKarl Hasselström <kha@treskal.com>
Wed, 9 Jan 2008 23:37:12 +0000 (00:37 +0100)
The old infrastructure has been checking this for ages, but the new
forgot to do so until now.

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

index 9d47d68e642e8464b5c408ddcc2959f5f3b4ecc5..9c4a910b38da51fe66e61551e522c30b005fe465 100644 (file)
@@ -132,7 +132,8 @@ class Stack(object):
             raise exception.StgException('%s: no such branch' % name)
         self.__patchorder = PatchOrder(self)
         self.__patches = Patches(self)
-        stackupgrade.update_to_current_format_version(repository, name)
+        if not stackupgrade.update_to_current_format_version(repository, name):
+            raise exception.StgException('%s: branch not initialized' % name)
     name = property(lambda self: self.__name)
     repository = property(lambda self: self.__repository)
     patchorder = property(lambda self: self.__patchorder)
index 00bfdf018b24514e90ade114859eb71237c9eddd..96ccb79a5ca1f5f27b8102893611acfe2bad658d 100644 (file)
@@ -91,6 +91,8 @@ def update_to_current_format_version(repository, branch):
         set_format_version(2)
 
     # Make sure we're at the latest version.
-    if not get_format_version() in [None, FORMAT_VERSION]:
+    fv = get_format_version()
+    if not fv in [None, FORMAT_VERSION]:
         raise StackException('Branch %s is at format version %d, expected %d'
-                             % (branch, get_format_version(), FORMAT_VERSION))
+                             % (branch, fv, FORMAT_VERSION))
+    return fv != None # true if branch is initialized