changeset 211:77d3c69b8dfe

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 b8112fd77386
children a813cc021b13
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	Mon Apr 04 15:59:32 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	Mon Apr 04 15:59:32 2011 +0400
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/Settings.java	Thu Jan 13 19:48:54 2011 +0300
@@ -59,6 +59,10 @@
     return myCustomClonePath;
   }
 
+  public String getRepository() {
+    return myRepository;
+  }
+
   /**
    * Returns name of the branch to use (returns 'default' if no branch specified)
    * @return see above