[PATCH 03/10] Make use exception raised by removedirs.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Signed-off-by: Yann Dirson <ydirson@xxxxxxxxxx>
---

 stgit/stack.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/stgit/stack.py b/stgit/stack.py
index 8fdaf2c..ec75507 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -684,14 +684,14 @@ class Series(StgitObject):
             else:
                 print 'Patch directory %s is not empty.' % self.__patch_dir
 
-            if not os.listdir(self._dir()):
+            try:
                 os.removedirs(self._dir())
-            else:
+            except OSError:
                 raise StackException, 'Series directory %s is not empty.' % self._dir()
 
-            if not os.listdir(self.__refs_dir):
+            try:
                 os.removedirs(self.__refs_dir)
-            else:
+            except OSError:
                 print 'Refs directory %s is not empty.' % self.__refs_dir
 
         if os.path.exists(self.__base_file):

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]