From 737f3549994c21182fe9339910ccdbdb9fcde3c7 Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Fri, 16 Mar 2007 22:45:44 +0000 Subject: [PATCH] Fix diagnostic messages on patch deletion and simplify others. Also make use standard os.removedirs(), allowing for the same simplification. Signed-off-by: Yann Dirson --- stgit/stack.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/stgit/stack.py b/stgit/stack.py index 12110aa8..e9f0e9f0 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -571,7 +571,7 @@ class Series(StgitObject): os.rmdir(self.__patch_dir) print 'done' else: - print 'Patch directory %s is not empty.' % self.__name + print 'Patch directory %s is not empty.' % self.__patch_dir self.__patch_dir = self._dir() @@ -678,18 +678,19 @@ class Series(StgitObject): os.remove(self.__descr_file) if os.path.exists(self._dir()+'/orig-base'): os.remove(self._dir()+'/orig-base') + if not os.listdir(self.__patch_dir): os.rmdir(self.__patch_dir) else: - print 'Patch directory %s is not empty.' % self.__name + print 'Patch directory %s is not empty.' % self.__patch_dir + if not os.listdir(self._dir()): - remove_dirs(os.path.join(self.__base_dir, 'patches'), - self.__name) + os.removedirs(self._dir()) else: - print 'Series directory %s is not empty.' % self.__name + raise StackException, 'Series directory %s is not empty.' % self._dir() + if not os.listdir(self.__refs_dir): - remove_dirs(os.path.join(self.__base_dir, 'refs', 'patches'), - self.__name) + os.removedirs(self.__refs_dir) else: print 'Refs directory %s is not empty.' % self.__refs_dir -- 2.11.4.GIT