Mercurial > hg > mercurial
changeset 592:e97a636cc9b7
For inner subrepos report full path from the main root
Need it to calculate checkout rules correctly
author | Dmitry Neverov <dmitry.neverov@jetbrains.com> |
---|---|
date | Wed, 24 Apr 2013 15:54:12 +0400 |
parents | c85cb270d59c |
children | ad112e314be5 |
files | mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/HgVcsRoot.java mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialCollectChangesPolicy.java mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/SubrepoChangesTest.java |
diffstat | 3 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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();
--- 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));
--- 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<String, String> s2props = new HashMap<String, String>(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)));