From: Karl Hasselström Date: Thu, 29 Nov 2007 19:35:27 +0000 (+0100) Subject: New infrastructure: Make sure that the branch is initialized X-Git-Tag: v0.15-rc1~312 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/317b386f436f36763f86666d872a59e9fc44b7a9 New infrastructure: Make sure that the branch is initialized The old infrastructure has been checking this for ages, but the new forgot to do so until now. Signed-off-by: Karl Hasselström --- diff --git a/stgit/lib/stack.py b/stgit/lib/stack.py index 9d47d68..9c4a910 100644 --- a/stgit/lib/stack.py +++ b/stgit/lib/stack.py @@ -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) diff --git a/stgit/lib/stackupgrade.py b/stgit/lib/stackupgrade.py index 00bfdf0..96ccb79 100644 --- a/stgit/lib/stackupgrade.py +++ b/stgit/lib/stackupgrade.py @@ -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