From: Catalin Marinas Date: Fri, 12 Sep 2008 21:54:58 GMT Subject: [StGit PATCH] Do not crash if a patch log ref is missing Message-ID: <20080912215449.10270.38860.stgit@localhost.localdomain> Since we'll get rid of the individual patch logs, StGit should ignore if such a ref is missing when deleting the compatibility patch files. Signed-off-by: Catalin Marinas --- stgit/lib/stack.py | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/stgit/lib/stack.py b/stgit/lib/stack.py index 9cb3967..1059955 100644 --- a/stgit/lib/stack.py +++ b/stgit/lib/stack.py @@ -68,7 +68,11 @@ class Patch(object): for f in os.listdir(self.__compat_dir): os.remove(os.path.join(self.__compat_dir, f)) os.rmdir(self.__compat_dir) - self.__stack.repository.refs.delete(self.__log_ref) + try: + # this compatibility log ref might not exist + self.__stack.repository.refs.delete(self.__log_ref) + except KeyError: + pass def set_commit(self, commit, msg): self.__write_compat_files(commit, msg) self.__stack.repository.refs.set(self.__ref, commit, msg)