changeset 23:3ddf410c2fd6

minor change
author Pavel.Sher
date Fri, 18 Jul 2008 13:17:29 +0400
parents 0d6f27953b30
children afcb3eee8fc6
files mercurial/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java
diffstat 1 files changed, 32 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Thu Jul 17 00:58:04 2008 +0400
+++ b/mercurial/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Fri Jul 18 13:17:29 2008 +0400
@@ -55,40 +55,6 @@
         removeOldWorkFolders();
       }
     }, 0, OLD_WORK_DIRS_CLEANUP_PERIOD, TimeUnit.SECONDS);
-
-  }
-
-  private void removeOldWorkFolders() {
-    File workFoldersParent = new File(myServerPaths.getCachesDir(), "mercurial");
-    if (!workFoldersParent.isDirectory()) return;
-
-    Set<File> workDirs = new HashSet<File>();
-    File[] files = workFoldersParent.listFiles(new FileFilter() {
-      public boolean accept(final File file) {
-        return file.isDirectory() && file.getName().startsWith(Settings.DEFAULT_WORK_DIR_PREFIX);
-      }
-    });
-    if (files != null) {
-      for (File f: files) {
-        workDirs.add(FileUtil.getCanonicalFile(f));
-      }
-    }
-
-    for (VcsRoot vcsRoot: myVcsManager.getAllRegisteredVcsRoots()) {
-      if (getName().equals(vcsRoot.getVcsName())) {
-        Settings s = new Settings(myServerPaths, vcsRoot);
-        workDirs.remove(FileUtil.getCanonicalFile(s.getWorkingDir()));
-      }
-    }
-
-    for (File f: workDirs) {
-      lockWorkDir(f);
-      try {
-        FileUtil.delete(f);
-      } finally {
-        unlockWorkDir(f);
-      }
-    }
   }
 
   public List<ModificationData> collectBuildChanges(final VcsRoot root,
@@ -428,4 +394,36 @@
     return workDir.isDirectory() && new File(workDir, ".hg").isDirectory();
   }
 
+  private void removeOldWorkFolders() {
+    File workFoldersParent = new File(myServerPaths.getCachesDir(), "mercurial");
+    if (!workFoldersParent.isDirectory()) return;
+
+    Set<File> workDirs = new HashSet<File>();
+    File[] files = workFoldersParent.listFiles(new FileFilter() {
+      public boolean accept(final File file) {
+        return file.isDirectory() && file.getName().startsWith(Settings.DEFAULT_WORK_DIR_PREFIX);
+      }
+    });
+    if (files != null) {
+      for (File f: files) {
+        workDirs.add(FileUtil.getCanonicalFile(f));
+      }
+    }
+
+    for (VcsRoot vcsRoot: myVcsManager.getAllRegisteredVcsRoots()) {
+      if (getName().equals(vcsRoot.getVcsName())) {
+        Settings s = new Settings(myServerPaths, vcsRoot);
+        workDirs.remove(FileUtil.getCanonicalFile(s.getWorkingDir()));
+      }
+    }
+
+    for (File f: workDirs) {
+      lockWorkDir(f);
+      try {
+        FileUtil.delete(f);
+      } finally {
+        unlockWorkDir(f);
+      }
+    }
+  }
 }