changeset 118:80eb7fdc4de0

Add logging for deleting tmp directories
author nd@localhost.localdomain
date Tue, 31 Aug 2010 20:30:32 +0400
parents 345fe6e101b7
children 7e327b36e36c
files mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Mon Aug 23 20:30:17 2010 +0400
+++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Tue Aug 31 20:30:32 2010 +0400
@@ -155,7 +155,7 @@
         Loggers.VCS.warn("Unable to obtain content of the file: " + filePath);
       }
     } finally {
-      FileUtil.delete(parentDir);
+      deleteTmpDir(parentDir);
     }
     return new byte[0];
   }
@@ -309,7 +309,14 @@
         }
       }
     } finally {
-      FileUtil.delete(parentDir);
+      deleteTmpDir(parentDir);
+    }
+  }
+
+  private void deleteTmpDir(File parentDir) {
+    boolean dirDeleted = FileUtil.delete(parentDir);
+    if (!dirDeleted) {
+      Loggers.VCS.warn("Can not delete directory \"" + parentDir.getAbsolutePath() + "\"");
     }
   }
 
@@ -600,9 +607,9 @@
   private String fixTagName(final String label) {
     // according to Mercurial documentation http://hgbook.red-bean.com/hgbookch8.html#x12-1570008
     // tag name must not contain:
-    // Colon (ASCII 58, :)
-    // Carriage return (ASCII 13, \r)
-    // Newline (ASCII 10, \n)
+    // Colon (ASCII 58, �:�)
+    // Carriage return (ASCII 13, �\r�)
+    // Newline (ASCII 10, �\n�)
     // all these characters will be replaced with _ (underscore)
     return label.replace(':', '_').replace('\r', '_').replace('\n', '_');
   }