From c177ec71fb5eda5ddf5fd036bfbec1c971f9b9a8 Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Wed, 6 Jun 2007 23:05:17 +0200 Subject: [PATCH] Fix removal of series with non-existant trash dir. Otherwise it is not possible to delete a stack that never had a patch deleted (eg. a newborn stack). Signed-off-by: Yann Dirson --- stgit/stack.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stgit/stack.py b/stgit/stack.py index ed546719..a6d16f2e 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -680,10 +680,11 @@ class Series(StgitObject): for p in patches: Patch(p, self.__patch_dir, self.__refs_dir).delete() - # remove the trash directory - for fname in os.listdir(self.__trash_dir): - os.remove(os.path.join(self.__trash_dir, fname)) - os.rmdir(self.__trash_dir) + # remove the trash directory if any + if os.path.exists(self.__trash_dir): + for fname in os.listdir(self.__trash_dir): + os.remove(os.path.join(self.__trash_dir, fname)) + os.rmdir(self.__trash_dir) # FIXME: find a way to get rid of those manual removals # (move functionality to StgitObject ?) -- 2.11.4.GIT