From: Catalin Marinas Date: Fri, 12 Sep 2008 21:22:18 +0000 (+0100) Subject: Do not crash if a patch log ref is missing X-Git-Tag: v0.15-rc1~156 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/d6de04620a5460a4fa0bd2107706e2df4f7ea76a?hp=ddca05489313c16e5a0386d26d52568113f8ec46 Do not crash if a patch log ref is missing 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 --- 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)