# HG changeset patch # User Dmitry Neverov # Date 1366804452 -14400 # Node ID e97a636cc9b7426e6409291ed3478aac31a40a14 # Parent c85cb270d59c441da80a0e4d530eff88ed23dedd For inner subrepos report full path from the main root Need it to calculate checkout rules correctly diff -r c85cb270d59c -r e97a636cc9b7 mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/HgVcsRoot.java --- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/HgVcsRoot.java Wed Apr 17 16:40:46 2013 +0400 +++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/HgVcsRoot.java Wed Apr 24 15:54:12 2013 +0400 @@ -130,6 +130,20 @@ return Boolean.valueOf(getProperty("teamcity.internal.subrepo")); } + public String getSubrepoPath() { + return getProperty("teamcity.internal.subrepo.path"); + } + + public String expandSubrepoPath(@NotNull String subrepoPath) { + if (!isSubrepo()) + return subrepoPath; + String mySubrepoPath = getSubrepoPath(); + if (mySubrepoPath == null) + return subrepoPath; + if (!mySubrepoPath.endsWith("/")) + mySubrepoPath += "/"; + return mySubrepoPath + subrepoPath; + } public String getVcsName() { return myRoot.getVcsName(); diff -r c85cb270d59c -r e97a636cc9b7 mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java --- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java Wed Apr 17 16:40:46 2013 +0400 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java Wed Apr 24 15:54:12 2013 +0400 @@ -12,6 +12,7 @@ import java.util.*; import static java.util.Arrays.asList; +import static java.util.Collections.EMPTY_LIST; import static java.util.Collections.emptyList; import static java.util.Collections.emptyMap; @@ -386,7 +387,7 @@ prevRevisions.add(ctx.getStringFromPool(prevSubrepo.revision())); } builder.addSubrepoConfigChange(new SubrepoConfigChange(mainRoot) - .setSubrepoPath(ctx.getStringFromPool(c.getPath())) + .setSubrepoPath(ctx.getStringFromPool(mainRoot.expandSubrepoPath(c.getPath()))) .setSubrepoRootParamDiff(Constants.REPOSITORY_PROP, ctx.getStringFromPool(subrepoUrl)) .setCurrentSubrepoRevision(ctx.getStringFromPool(curRevision)) .setPreviousSubrepoRevisions(prevRevisions)); diff -r c85cb270d59c -r e97a636cc9b7 mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SubrepoChangesTest.java --- a/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SubrepoChangesTest.java Wed Apr 17 16:40:46 2013 +0400 +++ b/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SubrepoChangesTest.java Wed Apr 24 15:54:12 2013 +0400 @@ -105,7 +105,7 @@ assertThat(changes, hasItem(modificationData().withVersion("1f9eb39a3921").withVcsRootProperties(s1props))); Map s2props = new HashMap(root.getProperties()); - s2props.put("teamcity.internal.subrepo.path", "r2"); + s2props.put("teamcity.internal.subrepo.path", "r2/r2"); s2props.put(Constants.REPOSITORY_PROP, myRemoteRepo2.getCanonicalPath()); s2props.put("teamcity.internal.subrepo", "true"); assertThat(changes, hasItem(modificationData().withVersion("ac0003deae69").withVcsRootProperties(s2props)));