@NotNull public static GitRepository registerRepo(Project project, String root) { ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(project); vcsManager.setDirectoryMapping(root, GitVcs.NAME); VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(new File(root)); assertFalse(vcsManager.getAllVcsRoots().length == 0); GitRepository repository = GitUtil.getRepositoryManager(project).getRepositoryForRoot(file); assertNotNull("Couldn't find repository for root " + root, repository); return repository; }
@Override public void setUp() throws Exception { super.setUp(); myBranchVcsRoot = new File(myTempDirFixture.getTempDirPath(), "branch"); myBranchVcsRoot.mkdir(); myProjectLevelVcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject); myProjectLevelVcsManager.setDirectoryMapping( myBranchVcsRoot.getAbsolutePath(), SvnVcs.VCS_NAME); // AbstractVcs vcsFound = myProjectLevelVcsManager.findVcsByName(SvnVcs.VCS_NAME); // Assert.assertEquals(1, myProjectLevelVcsManager.getRootsUnderVcs(vcsFound).length); }