changeset 545:1e5b80e2c023

Subrepo doesn't know its parent
author Dmitry Neverov <dmitry.neverov@jetbrains.com>
date Thu, 21 Feb 2013 17:31:17 +0400
parents 4ff88460fb5d
children dc7aae21ef23
files mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialIncludeRuleUpdater.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SubRepo.java
diffstat 2 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialIncludeRuleUpdater.java	Wed Feb 06 19:23:53 2013 +0400
+++ b/mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialIncludeRuleUpdater.java	Thu Feb 21 17:31:17 2013 +0400
@@ -159,9 +159,9 @@
       SubRepo workingDirSubrepo = workingDirSubrepos.get(path);
       if (workingDirSubrepo != null && subrepoConfig.hasDifferentUrlThan(workingDirSubrepo)) {
         myLogger.message("The url of subrepoConfig was changed between revisions " + workingDirRevision + " and " + toVersion + " , delete the subrepoConfig");
-        delete(subrepoConfig.dir());
+        delete(subrepoConfigDir(repo, subrepoConfig));
       }
-      HgRepo subrepository = myRepoFactory.create(subrepoConfig.dir(), myHgPath, myAuthSettings);
+      HgRepo subrepository = myRepoFactory.create(subrepoConfigDir(repo, subrepoConfig), myHgPath, myAuthSettings);
       String subrepoUrl;
       try {
         subrepoUrl = subrepoConfig.resolveUrl(parentRepositoryUrl);
@@ -231,4 +231,8 @@
     else
       throw new VcsException(e);
   }
+
+  private File subrepoConfigDir(@NotNull HgRepo parentRepo, @NotNull SubRepo subrepo) {
+    return new File(parentRepo.getWorkingDir(), subrepo.path());
+  }
 }
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SubRepo.java	Wed Feb 06 19:23:53 2013 +0400
+++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SubRepo.java	Thu Feb 21 17:31:17 2013 +0400
@@ -2,7 +2,6 @@
 
 import org.jetbrains.annotations.NotNull;
 
-import java.io.File;
 import java.net.URI;
 import java.net.URISyntaxException;
 
@@ -10,14 +9,12 @@
 * @author dmitry.neverov
 */
 public class SubRepo {
-  private final HgRepo myParentRepo;
   private final String myPath;
   private final String myUrl;
   private final String myRevision;
   private final VcsType myVcsType;
 
-  public SubRepo(@NotNull HgRepo parentRepo, @NotNull String path, @NotNull String url, @NotNull String revision) {
-    myParentRepo = parentRepo;
+  public SubRepo(@NotNull String path, @NotNull String url, @NotNull String revision) {
     myPath = path;
     myUrl = url;
     myRevision = revision;
@@ -54,11 +51,6 @@
     return url.startsWith("..");
   }
 
-  @NotNull
-  File dir() {
-    return new File(myParentRepo.getWorkingDir(), myPath);
-  }
-
   public boolean hasDifferentUrlThan(@NotNull SubRepo other) {
     return !myUrl.equals(other.url());
   }