changeset 377:dbdee21f2893 Eluru-6.5.x

Labeling should not affect vcs root settings
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Tue, 14 Feb 2012 19:38:59 +0400
parents 7d9620034403
children 55c2c88a2d82
files mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupportTest.java
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Wed Feb 08 10:33:34 2012 +0400
+++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Tue Feb 14 19:38:59 2012 +0400
@@ -725,7 +725,8 @@
     File tmpDir = null;
     try {
       tmpDir = createLabelingTmpDir();
-      Settings settings = createSettings(root, tmpDir);
+      final Settings settings = createSettings(root);
+      settings.setCustomWorkingDir(tmpDir);
       syncRepository(settings);
       File workingDir = getWorkingDir(settings);
       new UpdateCommand(settings, workingDir).execute();
@@ -780,12 +781,6 @@
     return settings;
   }
 
-  /* Creates settings for root and use specified customDir as clone path */
-  private Settings createSettings(final VcsRoot root, final File customDir) throws VcsException {
-    ((VcsRootImpl) root).addProperty(Constants.SERVER_CLONE_PATH_PROP, customDir.getAbsolutePath());
-    return createSettings(root);
-  }
-
   private void createClonedRepositoryParentDir(final File parentDir) throws VcsException {
     if (!parentDir.exists() && !parentDir.mkdirs()) {
       throw new VcsException("Failed to create parent directory for cloned repository: " + parentDir.getAbsolutePath());
--- a/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupportTest.java	Wed Feb 08 10:33:34 2012 +0400
+++ b/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupportTest.java	Tue Feb 14 19:38:59 2012 +0400
@@ -473,6 +473,15 @@
   }
 
 
+  public void labeling_should_not_change_vcs_root_settings() throws Exception {
+    VcsRootImpl root = createVcsRoot(simpleRepo(), "test_branch");
+    cleanRepositoryAfterTest(simpleRepo());
+    assertNull(root.getProperty(Constants.SERVER_CLONE_PATH_PROP));
+    myVcs.label("branch_tag", "7:376dcf05cd2a", root, CheckoutRules.DEFAULT);
+    assertNull(root.getProperty(Constants.SERVER_CLONE_PATH_PROP));
+  }
+
+
   private void assertFiles(final List<String> expectedFiles, final ModificationData modificationData) {
     Set<String> actualFiles = new HashSet<String>();
     for (VcsChange vc: modificationData.getChanges()) {