Mercurial > hg > mercurial
changeset 570:57b85306c377
Merge branch Faradi-7.1.x
author | Dmitry Neverov <dmitry.neverov@jetbrains.com> |
---|---|
date | Mon, 18 Mar 2013 12:08:16 +0400 |
parents | 333a1ddcbf94 (current diff) 7ca3303cfc9e (diff) |
children | c3ec73ac68ca |
files | mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/AgentMirrorCleanerTest.java |
diffstat | 2 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/AgentMirrorCleaner.java Thu Mar 07 13:45:05 2013 +0400 +++ b/mercurial-agent/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/AgentMirrorCleaner.java Mon Mar 18 12:08:16 2013 +0400 @@ -50,6 +50,8 @@ Set<String> repositories = new HashSet<String>(); for (VcsRootEntry entry : context.getRunningBuild().getVcsRootEntries()) { VcsRoot root = entry.getVcsRoot(); + if (!isHgRoot(root)) + continue; HgVcsRoot hgRoot = new HgVcsRoot(root); AuthSettings auth = hgRoot.getAuthSettings(); ourLog.debug("Repository " + auth.getRepositoryUrlWithHiddenPassword(hgRoot.getRepository()) + @@ -58,4 +60,8 @@ } return repositories; } + + private boolean isHgRoot(@NotNull VcsRoot root) { + return Constants.VCS_NAME.equals(root.getVcsName()); + } }
--- a/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/AgentMirrorCleanerTest.java Thu Mar 07 13:45:05 2013 +0400 +++ b/mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/AgentMirrorCleanerTest.java Mon Mar 18 12:08:16 2013 +0400 @@ -6,6 +6,7 @@ import jetbrains.buildServer.buildTriggers.vcs.mercurial.command.TestCommandSettingsFactory; import jetbrains.buildServer.log.Log4jFactory; import jetbrains.buildServer.vcs.*; +import jetbrains.buildServer.vcs.impl.VcsRootImpl; import org.jetbrains.annotations.NotNull; import org.jmock.Expectations; import org.jmock.Mockery; @@ -108,6 +109,27 @@ } + public void no_errors_for_non_mercurial_roots() throws Exception { + final File repo1 = myTempFiles.createTempDir(); + copyRepository(new File("mercurial-tests/testData/rep1"), repo1); + final VcsRoot root1 = vcsRoot().withUrl(repo1.getAbsolutePath()).build(); + + final VcsRoot nonHgRoot = new VcsRootImpl(20, "some.vcs"); + + final DirectoryCleanersProviderContext ctx = myContext.mock(DirectoryCleanersProviderContext.class); + myContext.checking(new Expectations(){{ + AgentRunningBuild build = myContext.mock(AgentRunningBuild.class, "build" + myBuildCounter++); + allowing(build).getVcsRootEntries(); will(returnValue(asList(new VcsRootEntry(root1, CheckoutRules.DEFAULT), + new VcsRootEntry(nonHgRoot, CheckoutRules.DEFAULT)))); + allowing(ctx).getRunningBuild(); will(returnValue(build)); + }}); + + final DirectoryCleanersRegistry registry = myContext.mock(DirectoryCleanersRegistry.class); + myCleaner.registerDirectoryCleaners(ctx, registry); + myContext.assertIsSatisfied(); + } + + private void doUpdate(@NotNull VcsRoot vcsRoot, @NotNull String toVersion, @NotNull File workDir) throws VcsException { final AgentRunningBuild build = myContext.mock(AgentRunningBuild.class, "build" + myBuildCounter++); myContext.checking(new Expectations() {{