use of jetbrains.buildServer.vcs.VcsRootEntry in project teamcity-git by JetBrains.
the class AgentMirrorCleaner method getRunningBuildRepositories.
private Set<String> getRunningBuildRepositories(@NotNull DirectoryCleanersProviderContext context) {
Set<String> repositories = new HashSet<String>();
for (VcsRootEntry entry : context.getRunningBuild().getVcsRootEntries()) {
VcsRoot root = entry.getVcsRoot();
if (!Constants.VCS_NAME.equals(root.getVcsName()))
continue;
try {
GitVcsRoot gitRoot = new AgentGitVcsRoot(myMirrorManager, root, myTokenStorage);
String repositoryUrl = gitRoot.getRepositoryFetchURL().toString();
LOG.debug("Repository " + repositoryUrl + " is used in the build, its mirror won't be cleaned");
addRepositoryWithSubmodules(repositories, gitRoot.getRepositoryFetchURL().toString());
} catch (VcsException e) {
LOG.warn("Error while creating git root " + root.getName() + ". If the root has a mirror on agent, the mirror might be cleaned", e);
}
}
return repositories;
}
use of jetbrains.buildServer.vcs.VcsRootEntry in project teamcity-git by JetBrains.
the class MapFullPathTest method bulk.
public void bulk() throws Exception {
// clone repository for myRoot and root3
RepositoryStateData state0 = RepositoryStateData.createSingleVersionState("a7274ca8e024d98c7d59874f19f21d26ee31d41d");
RepositoryStateData state1 = myGit.getCurrentState(myRoot);
myGit.getCollectChangesPolicy().collectChanges(myRoot, state0, state1, CheckoutRules.DEFAULT);
// tracks same repo as myRoot1
VcsRoot root3 = vcsRoot().withId(3).withFetchUrl(myRemoteRepositoryDir.getAbsolutePath()).build();
// tracks same repo as myRoot2
VcsRoot root4 = vcsRoot().withId(4).withFetchUrl(myRemoteRepositoryDir2.getAbsolutePath()).build();
List<Boolean> result = myGit.checkSuitable(asList(new VcsRootEntry(myRoot, new CheckoutRules("-:dir1")), new VcsRootEntry(myRoot, new CheckoutRules("+:dir1")), new VcsRootEntry(myRoot, new CheckoutRules("+:dir2")), new VcsRootEntry(myRoot2, new CheckoutRules("+:dir2")), new VcsRootEntry(root3, new CheckoutRules("+:dir1")), new VcsRootEntry(root4, new CheckoutRules("+:dir4")), new VcsRootEntry(root3, new CheckoutRules("+:dir5")), new VcsRootEntry(root4, new CheckoutRules("+:dir6"))), asList(// affects root and root3
"a7274ca8e024d98c7d59874f19f21d26ee31d41d-add81050184d3c818560bdd8839f50024c188586||dir1/text1.txt", // affects no repo
"abababababababababababababababababababab||."));
then(result).containsExactly(false, true, false, false, true, false, false, false);
}
use of jetbrains.buildServer.vcs.VcsRootEntry in project teamcity-git by JetBrains.
the class MapFullPathTest method setUp.
@BeforeMethod
public void setUp() throws IOException {
new TeamCityProperties() {
{
setModel(new BasePropertiesModel() {
});
}
};
myTempFiles = new TempFiles();
myContext = new Mockery() {
{
setImposteriser(ClassImposteriser.INSTANCE);
}
};
myRemoteRepositoryDir = myTempFiles.createTempDir();
copyRepository(dataFile("repo_for_fetch.1"), myRemoteRepositoryDir);
myRemoteRepositoryDir2 = myTempFiles.createTempDir();
copyRepository(dataFile("repo.git"), myRemoteRepositoryDir2);
ServerPaths paths = new ServerPaths(myTempFiles.createTempDir().getAbsolutePath());
GitSupportBuilder gitBuilder = gitSupport().withServerPaths(paths);
myGit = gitBuilder.build();
myMapFullPath = gitBuilder.getMapFullPath();
myRoot = vcsRoot().withId(1).withFetchUrl(myRemoteRepositoryDir.getAbsolutePath()).build();
myRootEntry = new VcsRootEntry(myRoot, CheckoutRules.DEFAULT);
myRoot2 = vcsRoot().withId(2).withFetchUrl(myRemoteRepositoryDir2.getAbsolutePath()).build();
myRootEntry2 = new VcsRootEntry(myRoot2, CheckoutRules.DEFAULT);
}
Aggregations