changeset 544:4ff88460fb5d

UI option for subrepo changes
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Wed, 06 Feb 2013 19:23:53 +0400
parents a157a25fd3af
children 1e5b80e2c023
files mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/Constants.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/HgVcsRoot.java mercurial-server/resources/buildServerResources/mercurialSettings.jsp mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/VcsRootBuilder.java
diffstat 4 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/Constants.java	Wed Feb 06 19:23:46 2013 +0400
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/Constants.java	Wed Feb 06 19:23:53 2013 +0400
@@ -28,4 +28,5 @@
   String PASSWORD = VcsRoot.SECURE_PROPERTY_PREFIX + "password";
   String UNCOMPRESSED_TRANSFER = "uncompressedTransfer";
   String USER_FOR_TAG = "tagUsername";
+  String DETECT_SUBREPO_CHANGES = "detectSubrepoChanges";
 }
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/HgVcsRoot.java	Wed Feb 06 19:23:46 2013 +0400
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/HgVcsRoot.java	Wed Feb 06 19:23:53 2013 +0400
@@ -21,6 +21,7 @@
 import jetbrains.buildServer.buildTriggers.vcs.mercurial.PathUtil;
 import jetbrains.buildServer.util.StringUtil;
 import jetbrains.buildServer.vcs.VcsRoot;
+import jetbrains.buildServer.vcs.impl.VcsRootImpl;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -40,6 +41,7 @@
   private final String myUserForTag;
   private final AuthSettings myAuthSettings;
   private File myCustomWorkingDir;
+  private final boolean myDetectSubrepoChanges;
 
   public HgVcsRoot(@NotNull final VcsRoot vcsRoot) {
     this(vcsRoot, vcsRoot.getProperty(Constants.REPOSITORY_PROP));
@@ -54,6 +56,7 @@
     myUncompressedTransfer = "true".equals(getProperty(Constants.UNCOMPRESSED_TRANSFER));
     myUserForTag = getProperty(Constants.USER_FOR_TAG);
     myAuthSettings = new AuthSettings(getProperty(Constants.USERNAME), getProperty(Constants.PASSWORD));
+    myDetectSubrepoChanges = Boolean.parseBoolean(getProperty(Constants.DETECT_SUBREPO_CHANGES));
   }
 
   public String getCustomClonePath() {
@@ -119,6 +122,9 @@
     return myAuthSettings;
   }
 
+  public boolean detectSubrepoChanges() {
+    return myDetectSubrepoChanges;
+  }
 
 
   public String getVcsName() {
@@ -126,6 +132,8 @@
   }
 
   public String getProperty(String propertyName) {
+    if (Constants.REPOSITORY_PROP.equals(propertyName) && myRepository != null)
+      return myRepository;
     return myRoot.getProperty(propertyName);
   }
 
--- a/mercurial-server/resources/buildServerResources/mercurialSettings.jsp	Wed Feb 06 19:23:46 2013 +0400
+++ b/mercurial-server/resources/buildServerResources/mercurialSettings.jsp	Wed Feb 06 19:23:53 2013 +0400
@@ -31,6 +31,12 @@
     </td>
   </tr>
   <tr>
+    <th><label for="detectSubrepoChanges">Detect subrepo changes: </label></th>
+      <td>
+        <props:checkboxProperty name="detectSubrepoChanges"/>
+      </td>
+    </tr>
+  <tr>
     <th><label for="tagUsername">Username For Tags: </label></th>
     <td><props:textProperty name="tagUsername"/>
       <div class="smallNote" style="margin: 0;">Format: User Name &lt;email&gt;</div>
--- a/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/VcsRootBuilder.java	Wed Feb 06 19:23:46 2013 +0400
+++ b/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/VcsRootBuilder.java	Wed Feb 06 19:23:53 2013 +0400
@@ -22,6 +22,7 @@
   private String myUserForTag;
   private boolean myUncompressed = true;
   private File myCloneRepositoryTo;
+  private boolean myDetectSubrepoChanges = false;
 
   public static VcsRootBuilder vcsRoot() {
     return new VcsRootBuilder();
@@ -36,6 +37,7 @@
     vcsRoot.addProperty(Constants.BRANCH_NAME_PROP, myBranch);
     vcsRoot.addProperty(Constants.USER_FOR_TAG, myUserForTag);
     vcsRoot.addProperty(Constants.UNCOMPRESSED_TRANSFER, String.valueOf(myUncompressed));
+    vcsRoot.addProperty(Constants.DETECT_SUBREPO_CHANGES, String.valueOf(myDetectSubrepoChanges));
     if (myCloneRepositoryTo != null)
       vcsRoot.addProperty(Constants.SERVER_CLONE_PATH_PROP, String.valueOf(myCloneRepositoryTo.getAbsolutePath()));
     return vcsRoot;
@@ -55,6 +57,7 @@
       allowing(root).getProperty(with(Constants.PASSWORD)); will(returnValue(myPassword));
       allowing(root).getProperty(with(Constants.UNCOMPRESSED_TRANSFER)); will(returnValue(null));
       allowing(root).getProperty(with(Constants.USER_FOR_TAG)); will(returnValue(myUserForTag));
+      allowing(root).getProperty(with(Constants.DETECT_SUBREPO_CHANGES)); will(returnValue(String.valueOf(myDetectSubrepoChanges)));
     }});
     if (myCloneRepositoryTo != null) {
       context.checking(new Expectations() {{
@@ -111,4 +114,10 @@
     myCloneRepositoryTo = cloneTo;
     return this;
   }
+
+
+  public VcsRootBuilder withSubrepoChanges(boolean detectSubrepoChanges) {
+    myDetectSubrepoChanges = detectSubrepoChanges;
+    return this;
+  }
 }