diff mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java @ 29:798e750e4f26

first version of agent side checkout
author Pavel.Sher
date Wed, 23 Jul 2008 15:23:05 +0400
parents a7cab5083ada
children 007c63ae45b0
line wrap: on
line diff
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Wed Jul 23 09:32:14 2008 +0400
+++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Wed Jul 23 15:23:05 2008 +0400
@@ -54,7 +54,6 @@
  * <p>Checkout on agent mode is not yet supported too.
  */
 public class MercurialVcsSupport extends VcsSupport implements CollectChangesByIncludeRule {
-  private ServerPaths myServerPaths;
   private ConcurrentMap<String, Lock> myWorkDirLocks= new ConcurrentHashMap<String, Lock>();
   private static final int OLD_WORK_DIRS_CLEANUP_PERIOD = 600;
   private VcsManager myVcsManager;
@@ -64,7 +63,6 @@
                              @NotNull ServerPaths paths,
                              @NotNull SBuildServer server) {
     vcsManager.registerVcsSupport(this);
-    myServerPaths = paths;
     myVcsManager = vcsManager;
     server.getExecutor().scheduleAtFixedRate(new Runnable() {
       public void run() {
@@ -369,7 +367,7 @@
     File workDir = settings.getWorkingDir();
     lockWorkDir(workDir);
     try {
-      if (hasRepositoryCopy(workDir)) {
+      if (settings.hasCopyOfRepository()) {
         // update
         PullCommand pull = new PullCommand(settings);
         pull.execute();
@@ -406,13 +404,8 @@
     return lock;
   }
 
-  private boolean hasRepositoryCopy(final File workDir) {
-    // need better way to check that repository copy is ok
-    return workDir.isDirectory() && new File(workDir, ".hg").isDirectory();
-  }
-
   private void removeOldWorkFolders() {
-    File workFoldersParent = new File(myServerPaths.getCachesDir(), "mercurial");
+    File workFoldersParent = new File(myDefaultWorkFolderParent, "mercurial");
     if (!workFoldersParent.isDirectory()) return;
 
     Set<File> workDirs = new HashSet<File>();