예제 #1
0
 /**
  * This method is called when user invokes "Enable VCS Integration" and selects a particular VCS.
  * By default it sets up a single mapping {@code <Project> -> selected VCS}.
  */
 @CalledInAwt
 public void enableIntegration() {
   ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
   if (vcsManager != null) {
     vcsManager.setDirectoryMappings(Arrays.asList(new VcsDirectoryMapping("", getName())));
   }
 }
예제 #2
0
  public void perform(
      @NotNull Project project,
      com.assembla.git.GitVcs mksVcs,
      @NotNull List<VcsException> exceptions,
      @NotNull VirtualFile[] affectedFiles)
      throws VcsException {
    ApplicationManager.getApplication()
        .runWriteAction(
            new Runnable() {
              public void run() {
                FileDocumentManager.getInstance().saveAllDocuments();
              }
            });

    if (!ProjectLevelVcsManager.getInstance(project)
        .checkAllFilesAreUnder(com.assembla.git.GitVcs.getInstance(project), affectedFiles)) return;

    final Map<VirtualFile, List<VirtualFile>> roots =
        com.assembla.git.GitUtil.sortFilesByVcsRoot(project, affectedFiles);

    for (VirtualFile root : roots.keySet()) {
      com.assembla.git.commands.GitCommand command =
          new com.assembla.git.commands.GitCommand(
              project, com.assembla.git.GitVcsSettings.getInstance(project), root);
      command.delete(roots.get(root));
    }

    VcsDirtyScopeManager mgr = VcsDirtyScopeManager.getInstance(project);
    for (VirtualFile file : affectedFiles) {
      mgr.fileDirty(file);
      file.refresh(true, true);
    }
  }
 @NotNull
 private Map<VirtualFile, GitUpdater> tryFastForwardMergeForRebaseUpdaters(
     @NotNull Map<VirtualFile, GitUpdater> updaters) {
   Map<VirtualFile, GitUpdater> modifiedUpdaters = new HashMap<VirtualFile, GitUpdater>();
   Map<VirtualFile, Collection<Change>> changesUnderRoots =
       new LocalChangesUnderRoots(
               ChangeListManager.getInstance(myProject),
               ProjectLevelVcsManager.getInstance(myProject))
           .getChangesUnderRoots(updaters.keySet());
   for (Map.Entry<VirtualFile, GitUpdater> updaterEntry : updaters.entrySet()) {
     VirtualFile root = updaterEntry.getKey();
     GitUpdater updater = updaterEntry.getValue();
     Collection<Change> changes = changesUnderRoots.get(root);
     if (updater instanceof GitRebaseUpdater && changes != null && !changes.isEmpty()) {
       // check only if there are local changes, otherwise stash won't happen anyway and there
       // would be no optimization
       GitRebaseUpdater rebaseUpdater = (GitRebaseUpdater) updater;
       if (rebaseUpdater.fastForwardMerge()) {
         continue;
       }
     }
     modifiedUpdaters.put(root, updater);
   }
   return modifiedUpdaters;
 }
  public void loadState(final SvnMappingSavedPart state) {
    ((ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject))
        .addInitializationRequest(
            VcsInitObject.AFTER_COMMON,
            new DumbAwareRunnable() {
              public void run() {
                ApplicationManager.getApplication()
                    .executeOnPooledThread(
                        new Runnable() {
                          @Override
                          public void run() {
                            final SvnMapping mapping = new SvnMapping();
                            final SvnMapping realMapping = new SvnMapping();
                            try {
                              fillMapping(mapping, state.getMappingRoots());
                              fillMapping(realMapping, state.getMoreRealMappingRoots());
                            } catch (ProcessCanceledException e) {
                              throw e;
                            } catch (Throwable t) {
                              LOG.info(t);
                              return;
                            }

                            synchronized (myMonitor) {
                              myMapping.copyFrom(mapping);
                              myMoreRealMapping.copyFrom(realMapping);
                            }
                          }
                        });
              }
            });
  }
  @NotNull
  public Change[] getSelectedChanges() {
    Set<Change> changes = new LinkedHashSet<Change>();

    final TreePath[] paths = getSelectionPaths();
    if (paths == null) {
      return new Change[0];
    }

    for (TreePath path : paths) {
      ChangesBrowserNode<?> node = (ChangesBrowserNode) path.getLastPathComponent();
      changes.addAll(node.getAllChangesUnder());
    }

    if (changes.isEmpty()) {
      final List<VirtualFile> selectedModifiedWithoutEditing = getSelectedModifiedWithoutEditing();
      if (selectedModifiedWithoutEditing != null && !selectedModifiedWithoutEditing.isEmpty()) {
        for (VirtualFile file : selectedModifiedWithoutEditing) {
          AbstractVcs vcs = ProjectLevelVcsManager.getInstance(myProject).getVcsFor(file);
          if (vcs == null) continue;
          final VcsCurrentRevisionProxy before =
              VcsCurrentRevisionProxy.create(file, myProject, vcs.getKeyInstanceMethod());
          if (before != null) {
            ContentRevision afterRevision = new CurrentContentRevision(new FilePathImpl(file));
            changes.add(new Change(before, afterRevision, FileStatus.HIJACKED));
          }
        }
      }
    }

    return changes.toArray(new Change[changes.size()]);
  }
예제 #6
0
 @Nullable
 public static GitVcs getInstance(Project project) {
   if (project == null || project.isDisposed()) {
     return null;
   }
   return (GitVcs) ProjectLevelVcsManager.getInstance(project).findVcsByName(NAME);
 }
  /** call in setUp */
  public DuringChangeListManagerUpdateTestScheme(final Project project, final String tmpDirPath) {
    final MockAbstractVcs vcs = new MockAbstractVcs(project);
    myChangeProvider = new MockDelayingChangeProvider();
    vcs.setChangeProvider(myChangeProvider);

    final File mockVcsRoot = new File(tmpDirPath, "mock");
    mockVcsRoot.mkdir();
    final VirtualFile vRoot = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(mockVcsRoot);

    final ProjectLevelVcsManagerImpl projectLevelVcsManager =
        (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(project);
    projectLevelVcsManager.registerVcs(vcs);
    // projectLevelVcsManager.setDirectoryMapping(mockVcsRoot.getAbsolutePath(), vcs.getName());
    final ArrayList<VcsDirectoryMapping> list =
        new ArrayList<VcsDirectoryMapping>(projectLevelVcsManager.getDirectoryMappings());
    list.add(new VcsDirectoryMapping(vRoot.getPath(), vcs.getName()));
    projectLevelVcsManager.setDirectoryMappings(list);

    AbstractVcs vcsFound = projectLevelVcsManager.findVcsByName(vcs.getName());
    final VirtualFile[] roots = projectLevelVcsManager.getRootsUnderVcs(vcsFound);
    assert roots.length == 1
        : Arrays.asList(roots)
            + "; "
            + vcs.getName()
            + "; "
            + Arrays.toString(AllVcses.getInstance(project).getAll());

    myDirtyScopeManager = VcsDirtyScopeManager.getInstance(project);
    myClManager = ChangeListManager.getInstance(project);
  }
  public void update(AnActionEvent e) {
    Presentation presentation = e.getPresentation();
    final DataContext dataContext = e.getDataContext();

    Project project = PlatformDataKeys.PROJECT.getData(dataContext);
    if ((project == null)
        || (ProjectLevelVcsManager.getInstance(project).isBackgroundVcsOperationRunning())) {
      presentation.setEnabled(false);
      presentation.setVisible(false);
      return;
    }

    VirtualFile[] files = PlatformDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext);
    if (files == null || files.length == 0) {
      presentation.setEnabled(false);
      presentation.setVisible(false);
      return;
    }
    boolean enabled = false;
    boolean visible = false;
    if (files.length == 1 && files[0].isDirectory()) {
      visible = true;
      if (!SvnStatusUtil.isUnderControl(project, files[0])) {
        enabled = true;
      }
    }
    presentation.setEnabled(enabled);
    presentation.setVisible(visible);
  }
예제 #9
0
  public SvnVcs(
      final Project project,
      MessageBus bus,
      SvnConfiguration svnConfiguration,
      final SvnLoadedBrachesStorage storage) {
    super(project, VCS_NAME);
    myLoadedBranchesStorage = storage;
    LOG.debug("ct");
    myRootsToWorkingCopies = new RootsToWorkingCopies(this);
    myConfiguration = svnConfiguration;
    myAuthNotifier = new SvnAuthenticationNotifier(this);

    dumpFileStatus(FileStatus.ADDED);
    dumpFileStatus(FileStatus.DELETED);
    dumpFileStatus(FileStatus.MERGE);
    dumpFileStatus(FileStatus.MODIFIED);
    dumpFileStatus(FileStatus.NOT_CHANGED);
    dumpFileStatus(FileStatus.UNKNOWN);

    dumpFileStatus(SvnFileStatus.REPLACED);
    dumpFileStatus(SvnFileStatus.EXTERNAL);
    dumpFileStatus(SvnFileStatus.OBSTRUCTED);

    final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
    myAddConfirmation =
        vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.ADD, this);
    myDeleteConfirmation =
        vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.REMOVE, this);
    myCheckoutOptions =
        vcsManager.getStandardOption(VcsConfiguration.StandardOption.CHECKOUT, this);

    if (myProject.isDefault()) {
      myChangeListListener = null;
      myEntriesFileListener = null;
    } else {
      myEntriesFileListener = new SvnEntriesFileListener(project);
      upgradeIfNeeded(bus);

      myChangeListListener = new SvnChangelistListener(myProject, this);

      myVcsListener =
          new VcsListener() {
            @Override
            public void directoryMappingChanged() {
              invokeRefreshSvnRoots(true);
            }
          };
    }

    myFrameStateListener =
        project.isDefault()
            ? null
            : new MyFrameStateListener(
                ChangeListManager.getInstance(project), VcsDirtyScopeManager.getInstance(project));
    myWorkingCopiesContent = new WorkingCopiesContent(this);

    // remove used some time before old notification group ids
    correctNotificationIds();
    myChecker = new SvnExecutableChecker(myProject);
  }
 public RootsCalculator(
     final Project project, final AbstractVcs vcs, final RepositoryLocationCache locationCache) {
   myProject = project;
   myLocationCache = locationCache;
   myPlManager = ProjectLevelVcsManager.getInstance(myProject);
   myVcs = vcs;
 }
예제 #11
0
  @Override
  public void deactivate() {
    FrameStateManager.getInstance().removeListener(myFrameStateListener);

    final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
    if (myVcsListener != null) {
      vcsManager.removeVcsListener(myVcsListener);
    }

    if (myEntriesFileListener != null) {
      VirtualFileManager.getInstance().removeVirtualFileListener(myEntriesFileListener);
    }
    SvnApplicationSettings.getInstance().svnDeactivated();
    if (myCommittedChangesProvider != null) {
      myCommittedChangesProvider.deactivate();
    }
    if (myChangeListListener != null && !myProject.isDefault()) {
      ChangeListManager.getInstance(myProject).removeChangeListListener(myChangeListListener);
    }
    vcsManager.removeVcsListener(myRootsToWorkingCopies);
    myRootsToWorkingCopies.clear();

    myAuthNotifier.stop();
    myAuthNotifier.clear();

    mySvnBranchPointsCalculator.deactivate();
    mySvnBranchPointsCalculator = null;
    myWorkingCopiesContent.deactivate();
    myLoadedBranchesStorage.deactivate();
    myPool.dispose();
    myPool = null;
  }
 RemoteRevisionsStateCache(final Project project) {
   myVcsManager = ProjectLevelVcsManager.getInstance(project);
   myChanged = new HashMap<String, Pair<Boolean, VcsRoot>>();
   myQueries = new MultiMap<VcsRoot, String>();
   myTs = new HashMap<VcsRoot, Long>();
   myLock = new Object();
   myVcsConfiguration = VcsConfiguration.getInstance(project);
 }
  @Override
  protected void update(@NotNull VcsContext context, @NotNull Presentation presentation) {
    Project project = context.getProject();

    presentation.setEnabled(isEnabled(context));
    presentation.setVisible(
        project != null && ProjectLevelVcsManager.getInstance(project).hasActiveVcss());
  }
 private VcsRootProblemNotifier(@NotNull Project project) {
   myProject = project;
   mySettings = VcsConfiguration.getInstance(myProject);
   myChangeListManager = ChangeListManager.getInstance(project);
   myProjectFileIndex = ProjectFileIndex.SERVICE.getInstance(myProject);
   myVcsManager = ProjectLevelVcsManager.getInstance(project);
   myReportedUnregisteredRoots = new HashSet<>(mySettings.IGNORED_UNREGISTERED_ROOTS);
 }
  private RemoteRevisionsCache(final Project project) {
    myProject = project;
    myLock = new Object();

    myRemoteRevisionsNumbersCache = new RemoteRevisionsNumbersCache(myProject);
    myRemoteRevisionsStateCache = new RemoteRevisionsStateCache(myProject);

    myChangeDecorator = new RemoteStatusChangeNodeDecorator(this);

    myVcsManager = ProjectLevelVcsManager.getInstance(project);
    myVcsManager.addVcsListener(this);
    myKinds = new HashMap<String, RemoteDifferenceStrategy>();
    Disposer.register(
        project,
        new Disposable() {
          public void dispose() {
            myVcsManager.removeVcsListener(RemoteRevisionsCache.this);
          }
        });
    final VcsConfiguration vcsConfiguration = VcsConfiguration.getInstance(myProject);
    myControlledCycle =
        new ControlledCycle(
            project,
            new Getter<Boolean>() {
              @Override
              public Boolean get() {
                final boolean shouldBeDone =
                    vcsConfiguration.isChangedOnServerEnabled() && myVcsManager.hasActiveVcss();

                if (shouldBeDone) {
                  boolean somethingChanged = myRemoteRevisionsNumbersCache.updateStep();
                  somethingChanged |= myRemoteRevisionsStateCache.updateStep();
                  if (somethingChanged) {
                    myProject.getMessageBus().syncPublisher(REMOTE_VERSION_CHANGED).run();
                  }
                }
                return shouldBeDone;
              }
            },
            "Finishing \"changed on server\" update",
            DEFAULT_REFRESH_INTERVAL);

    updateRoots();

    if ((!myProject.isDefault()) && vcsConfiguration.isChangedOnServerEnabled()) {
      ((ProjectLevelVcsManagerImpl) myVcsManager)
          .addInitializationRequest(
              VcsInitObject.REMOTE_REVISIONS_CACHE,
              new Runnable() {
                public void run() {
                  // do not start if there're no vcses
                  if (!myVcsManager.hasActiveVcss() || !vcsConfiguration.isChangedOnServerEnabled())
                    return;
                  myControlledCycle.startIfNotStarted(-1);
                }
              });
    }
  }
예제 #16
0
 public static void addMappingIfSubRoot(
     @NotNull Project project, @NotNull String newRepositoryPath, @NotNull String vcsName) {
   if (project.getBasePath() != null
       && FileUtil.isAncestor(project.getBasePath(), newRepositoryPath, true)) {
     ProjectLevelVcsManager manager = ProjectLevelVcsManager.getInstance(project);
     manager.setDirectoryMappings(
         VcsUtil.addMapping(manager.getDirectoryMappings(), newRepositoryPath, vcsName));
   }
 }
예제 #17
0
 @Nullable
 public AnnotationProvider getCachingAnnotationProvider() {
   final AnnotationProvider ap = getAnnotationProvider();
   if (ourUseAnnotationCache && ap instanceof VcsCacheableAnnotationProvider) {
     return new VcsAnnotationCachedProxy(
         this, ProjectLevelVcsManager.getInstance(myProject).getVcsHistoryCache());
   }
   return ap;
 }
예제 #18
0
 @Nullable
 public static HgVcs getInstance(Project project) {
   if (project == null || project.isDisposed()) {
     return null;
   }
   final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
   if (vcsManager == null) {
     return null;
   }
   return (HgVcs) vcsManager.findVcsByName(VCS_NAME);
 }
예제 #19
0
 @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 AbstractVcs getActiveVcs() {
   AbstractVcs[] vcss = ProjectLevelVcsManager.getInstance(myProject).getAllActiveVcss();
   if (vcss.length == 0) return null;
   for (AbstractVcs vcs : vcss) {
     if (vcs.getType() == VcsType.distributed) {
       return vcs;
     }
   }
   return vcss[0];
 }
예제 #21
0
  public void loadSettings() {
    final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);

    if (getUpdateEnvironment() != null) {
      myUpdateOption = vcsManager.getStandardOption(VcsConfiguration.StandardOption.UPDATE, this);
    }

    if (getStatusEnvironment() != null) {
      myStatusOption = vcsManager.getStandardOption(VcsConfiguration.StandardOption.STATUS, this);
    }
  }
 @Nullable
 private static SvnVcs getVCS(VirtualFile file) {
   Project[] projects = ProjectManager.getInstance().getOpenProjects();
   for (Project project : projects) {
     AbstractVcs vcs = ProjectLevelVcsManager.getInstance(project).getVcsFor(file);
     if (vcs instanceof SvnVcs) {
       return (SvnVcs) vcs;
     }
   }
   return null;
 }
예제 #23
0
 private void returnConfirmationBack() {
   if (mySystemOperation) {
     final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
     final VcsShowConfirmationOption addConfirmation =
         vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.ADD, null);
     addConfirmation.setValue(myAddconfirmationvalue);
     final VcsShowConfirmationOption deleteConfirmation =
         vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.REMOVE, null);
     deleteConfirmation.setValue(myDeleteconfirmationvalue);
   }
 }
 private static boolean isActionEnabled(final AnActionEvent e) {
   Project project = e.getData(CommonDataKeys.PROJECT);
   if (project == null) return false;
   VirtualFile vFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
   if (vFile == null) return false;
   AbstractVcs vcs = ProjectLevelVcsManager.getInstance(project).getVcsFor(vFile);
   if (vcs == null || vcs.getCommittedChangesProvider() == null || !vcs.allowsRemoteCalls(vFile)) {
     return false;
   }
   FilePath filePath = VcsContextFactory.SERVICE.getInstance().createFilePathOn(vFile);
   return AbstractVcs.fileInVcsByFileStatus(project, filePath);
 }
 @NotNull
 private Collection<VirtualFile> getSelectedRoots() {
   ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
   Collection<VirtualFile> result = new HashSet<VirtualFile>();
   for (FilePath path : ChangesUtil.getPaths(myPanel.getSelectedChanges())) {
     VirtualFile root = vcsManager.getVcsRootFor(path);
     if (root != null) {
       result.add(root);
     }
   }
   return result;
 }
예제 #26
0
 @Nullable
 private static VirtualFile guessVcsRoot(@NotNull Project project, @Nullable VirtualFile file) {
   VirtualFile root = null;
   if (file != null) {
     root = ProjectLevelVcsManager.getInstance(project).getVcsRootFor(file);
     if (root == null) {
       LOGGER.debug("Cannot get root by file. Trying with get by library: " + file);
       root = getVcsRootForLibraryFile(project, file);
     }
   }
   return root;
 }
예제 #27
0
  @Nullable
  private static VirtualFile guessRootForVcs(
      @NotNull Project project, @Nullable AbstractVcs vcs, @Nullable String defaultRootPathValue) {
    if (project.isDisposed()) return null;
    LOG.debug("Guessing vcs root...");
    ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
    if (vcs == null) {
      LOG.debug("Vcs not found.");
      return null;
    }
    String vcsName = vcs.getDisplayName();
    VirtualFile[] vcsRoots = vcsManager.getRootsUnderVcs(vcs);
    if (vcsRoots.length == 0) {
      LOG.debug("No " + vcsName + " roots in the project.");
      return null;
    }

    if (vcsRoots.length == 1) {
      VirtualFile onlyRoot = vcsRoots[0];
      LOG.debug("Only one " + vcsName + " root in the project, returning: " + onlyRoot);
      return onlyRoot;
    }

    // get remembered last visited repository root
    if (defaultRootPathValue != null) {
      VirtualFile recentRoot = VcsUtil.getVirtualFile(defaultRootPathValue);
      if (recentRoot != null) {
        LOG.debug("Returning the recent root: " + recentRoot);
        return recentRoot;
      }
    }

    // otherwise return the root of the project dir or the root containing the project dir, if there
    // is such
    VirtualFile projectBaseDir = project.getBaseDir();
    if (projectBaseDir == null) {
      VirtualFile firstRoot = vcsRoots[0];
      LOG.debug("Project base dir is null, returning the first root: " + firstRoot);
      return firstRoot;
    }
    VirtualFile rootCandidate;
    for (VirtualFile root : vcsRoots) {
      if (root.equals(projectBaseDir) || VfsUtilCore.isAncestor(root, projectBaseDir, true)) {
        LOG.debug("The best candidate: " + root);
        return root;
      }
    }
    rootCandidate = vcsRoots[0];
    LOG.debug("Returning the best candidate: " + rootCandidate);
    return rootCandidate;
  }
예제 #28
0
    private void setConfirmationToDefault() {
      if (mySystemOperation) {
        final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
        final VcsShowConfirmationOption addConfirmation =
            vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.ADD, null);
        myAddconfirmationvalue = addConfirmation.getValue();
        addConfirmation.setValue(VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY);

        final VcsShowConfirmationOption deleteConfirmation =
            vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.REMOVE, null);
        myDeleteconfirmationvalue = deleteConfirmation.getValue();
        deleteConfirmation.setValue(VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY);
      }
    }
  @Before
  public void setUp() throws Throwable {
    IdeaTestApplication.getInstance();

    myTestName = createTestName();
    myProjectFixture =
        IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(myTestName).getFixture();

    edt(
        new ThrowableRunnable<Exception>() {
          @Override
          public void run() throws Exception {
            myProjectFixture.setUp();
          }
        });

    myProject = myProjectFixture.getProject();

    myProjectRoot = myProject.getBasePath();
    myProjectDir = myProject.getBaseDir();
    myTestRoot = myProjectRoot;

    myGit = ServiceManager.getService(myProject, Git.class);
    mySettings = GitVcsSettings.getInstance(myProject);
    mySettings.getAppSettings().setPathToGit(GitExecutor.PathHolder.GIT_EXECUTABLE);

    // dynamic overriding is used instead of making it in plugin.xml,
    // because MockVcsHelper is not ready to be a full featured implementation for all tests.
    myVcsHelper =
        GitTestUtil.overrideService(myProject, AbstractVcsHelper.class, MockVcsHelper.class);
    myChangeListManager = ChangeListManagerImpl.getInstanceImpl(myProject);
    myNotificator = (TestVcsNotifier) ServiceManager.getService(myProject, VcsNotifier.class);
    myVcs = GitVcs.getInstance(myProject);
    myRepositoryManager = GitUtil.getRepositoryManager(myProject);

    virtualCommits = new GitTestVirtualCommitsHolder();
    myAsyncTasks = new ArrayList<>();

    cd(myProjectRoot);
    myRepository = GitTestUtil.createRepository(myProject, myProjectRoot);

    ProjectLevelVcsManagerImpl vcsManager =
        (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject);
    AbstractVcs vcs = vcsManager.findVcsByName("Git");
    Assert.assertEquals(1, vcsManager.getRootsUnderVcs(vcs).length);

    GitTestUtil.assumeSupportedGitVersion(myVcs);
    LOG.info(getStartTestMarker());
  }
 public Collection<AbstractVcs> getAffectedVcses() {
   final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
   final Set<AbstractVcs> vcses =
       new HashSet<AbstractVcs>(Arrays.asList(vcsManager.getAllActiveVcss()));
   final Set<AbstractVcs> result = new HashSet<AbstractVcs>();
   for (Change change : myBrowser.myAllChanges) {
     if (vcses.isEmpty()) break;
     final AbstractVcs vcs = ChangesUtil.getVcsForChange(change, myBrowser.myProject);
     if (vcs != null) {
       result.add(vcs);
       vcses.remove(vcs);
     }
   }
   return result;
 }