changeset 67:e6971dc6b17c

always use url with credentials if username/password are specified
author Pavel.Sher
date Thu, 23 Jul 2009 11:42:23 +0400
parents 4add1cea853e
children ee7a7472c921
files mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CloneCommand.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/IdentifyCommand.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/PullCommand.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/PushCommand.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/Settings.java mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java mercurial.ipr
diffstat 7 files changed, 19 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CloneCommand.java	Thu Jul 09 21:23:09 2009 +0400
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/CloneCommand.java	Thu Jul 23 11:42:23 2009 +0400
@@ -26,19 +26,19 @@
   private String myDestDir;
   private String myToId;
   private boolean myUpdateWorkingDir = true;
-  private String myRepositoryPath;
+  private String myRepository;
 
   public CloneCommand(@NotNull final Settings settings) {
     super(settings);
-    myRepositoryPath = getSettings().getRepository();
+    myRepository = getSettings().getRepositoryUrl();
   }
 
   /**
    * Sets repository to clone, by default uses repository from the specified settings
    * @param repo repository path
    */
-  public void setRepositoryPath(@NotNull String repo) {
-    myRepositoryPath = repo;
+  public void setRepository(@NotNull String repo) {
+    myRepository = repo;
   }
 
   public void setDestDir(@NotNull String destDir) {
@@ -68,7 +68,7 @@
     if (!myUpdateWorkingDir) {
       cli.addParameter("-U");
     }
-    cli.addParameter(myRepositoryPath);
+    cli.addParameter(myRepository);
     cli.addParameter(dir.getName());
 
     ExecResult res = runCommand(cli, 24*3600); // some repositories are quite large, we set timeout to 24 hours
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/IdentifyCommand.java	Thu Jul 09 21:23:09 2009 +0400
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/IdentifyCommand.java	Thu Jul 23 11:42:23 2009 +0400
@@ -33,7 +33,7 @@
     GeneralCommandLine cli = new GeneralCommandLine();
     cli.setExePath(getSettings().getHgCommandPath());
     cli.addParameter("identify");
-    cli.addParameter(getSettings().getRepository());
+    cli.addParameter(getSettings().getRepositoryUrl());
     ExecResult res = runCommand(cli);
     failIfNotEmptyStdErr(cli, res);
     return res.getStdout();
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/PullCommand.java	Thu Jul 09 21:23:09 2009 +0400
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/PullCommand.java	Thu Jul 23 11:42:23 2009 +0400
@@ -31,7 +31,7 @@
   public void execute() throws VcsException {
     GeneralCommandLine cli = createCommandLine();
     cli.addParameter("pull");
-    cli.addParameter(getSettings().getRepository());
+    cli.addParameter(getSettings().getRepositoryUrl());
     runCommand(cli);
   }
 }
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/PushCommand.java	Thu Jul 09 21:23:09 2009 +0400
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/PushCommand.java	Thu Jul 23 11:42:23 2009 +0400
@@ -25,7 +25,7 @@
     if (myForced) {
       cli.addParameter("-f");
     }
-    cli.addParameter(getSettings().getPushUrl());
+    cli.addParameter(getSettings().getRepositoryUrl());
     ExecResult res = runCommand(cli);
     failIfNotEmptyStdErr(cli, res);
   }
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/Settings.java	Thu Jul 09 21:23:09 2009 +0400
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/Settings.java	Thu Jul 23 11:42:23 2009 +0400
@@ -57,15 +57,6 @@
   }
 
   /**
-   * Returns repository path
-   * @return repository path
-   */
-  @NotNull
-  public String getRepository() {
-    return myRepository;
-  }
-
-  /**
    * Returns name of the branch to use (returns 'default' if no branch specified)
    * @return see above
    */
@@ -110,7 +101,7 @@
    * Returns URL to use for push command
    * @return URL to use for push command
    */
-  public String getPushUrl() {
+  public String getRepositoryUrl() {
     if (containsCredentials(myRepository)) return myRepository;
 
     String cre = "";
--- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Thu Jul 09 21:23:09 2009 +0400
+++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialVcsSupport.java	Thu Jul 23 11:42:23 2009 +0400
@@ -239,7 +239,7 @@
     StringBuilder res = new StringBuilder();
     res.append(quoteIfNeeded(settings.getHgCommandPath()));
     res.append(" identify ");
-    res.append(quoteIfNeeded(settings.getRepository()));
+    res.append(quoteIfNeeded(settings.getRepositoryUrl()));
     res.append('\n').append(id.execute());
     return res.toString();
   }
@@ -339,7 +339,7 @@
     throws IOException, VcsException {
     CloneCommand cl = new CloneCommand(settings);
     // clone from the local repository
-    cl.setRepositoryPath(settings.getLocalRepositoryDir().getAbsolutePath());
+    cl.setRepository(settings.getLocalRepositoryDir().getAbsolutePath());
     cl.setToId(toVer.getId());
     cl.setUpdateWorkingDir(false);
     File tempDir = FileUtil.createTempDirectory("mercurial", toVer.getId());
@@ -522,7 +522,7 @@
       createClonedRepositoryParentDir(parentDir);
 
       // take last part of repository path
-      String repPath = settings.getRepository();
+      String repPath = settings.getRepositoryUrl();
       String[] splitted = repPath.split("[/\\\\]");
       if (splitted.length > 0) {
         repPath = splitted[splitted.length-1];
--- a/mercurial.ipr	Thu Jul 09 21:23:09 2009 +0400
+++ b/mercurial.ipr	Thu Jul 23 11:42:23 2009 +0400
@@ -111,10 +111,10 @@
       </profile>
     </profiles>
     <list size="5">
-      <item index="0" class="java.lang.String" itemvalue="INFO" />
-      <item index="1" class="java.lang.String" itemvalue="WARNING" />
-      <item index="2" class="java.lang.String" itemvalue="ERROR" />
-      <item index="3" class="java.lang.String" itemvalue="MISSPELLED" />
+      <item index="0" class="java.lang.String" itemvalue="TYPO" />
+      <item index="1" class="java.lang.String" itemvalue="INFO" />
+      <item index="2" class="java.lang.String" itemvalue="WARNING" />
+      <item index="3" class="java.lang.String" itemvalue="ERROR" />
       <item index="4" class="java.lang.String" itemvalue="SERVER PROBLEM" />
     </list>
   </component>
@@ -294,6 +294,9 @@
   <component name="ProjectDetails">
     <option name="projectName" value="mercurial" />
   </component>
+  <component name="ProjectDictionaryState">
+    <dictionary name="Pavel.Sher" />
+  </component>
   <component name="ProjectFileVersion" converted="true" />
   <component name="ProjectKey">
     <option name="state" value="project://C:\Work\mercurial\mercurial.ipr" />