changeset 205:ccf0b5ad00c1 Eluru-6.0.x

Write repository url without credentials to the hgrc We can work without default path, but it is hard to understand which local repository clone what.
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Thu, 13 Jan 2011 19:48:54 +0300
parents ebcca5974cb4
children 8a98b7c435cb
files mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/Init.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/Settings.java
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/Init.java	Thu Mar 31 09:31:33 2011 +0400
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/Init.java	Thu Jan 13 19:48:54 2011 +0300
@@ -1,6 +1,7 @@
 package jetbrains.buildServer.buildTriggers.vcs.mercurial.command;
 
 import com.intellij.execution.configurations.GeneralCommandLine;
+import jetbrains.buildServer.util.FileUtil;
 import jetbrains.buildServer.vcs.VcsException;
 import org.jetbrains.annotations.NotNull;
 
@@ -19,5 +20,14 @@
     GeneralCommandLine cli = createCommandLine();
     cli.addParameter("init");
     runCommand(cli);
+    writeDefaultPath();
+  }
+
+
+  private void writeDefaultPath() {
+    File hgrc = new File(new File(getWorkDirectory(), ".hg"), "hgrc");
+    String repository = getSettings().getRepository();
+    String content = "[paths]\ndefault = " + repository;
+    FileUtil.writeFile(hgrc, content);
   }
 }
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/Settings.java	Thu Mar 31 09:31:33 2011 +0400
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/Settings.java	Thu Jan 13 19:48:54 2011 +0300
@@ -61,6 +61,10 @@
     myRepository = repository;
   }
 
+  public String getRepository() {
+    return myRepository;
+  }
+
   /**
    * Returns name of the branch to use (returns 'default' if no branch specified)
    * @return see above