private static void addStashParameter( @NotNull Project project, @NotNull GitHandler handler, @NotNull String stash) { GitVcs vcs = GitVcs.getInstance(project); if (vcs != null && GitVersionSpecialty.NEEDS_QUOTES_IN_STASH_NAME.existsIn(vcs.getVersion())) { handler.addParameters(GeneralCommandLine.inescapableQuote(stash)); } else { handler.addParameters(stash); } }
final String commitHash, @Nullable final Callable<Void> successCallable) { GitVcs.runInBackground(new Task.Backgroundable(project, "Fetching...", false) { @Override public void onSuccess() {
@Override protected void setUp() throws Exception { super.setUp(); enableDebugLogging(); try { myProjectFixture = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getTestName(true)).getFixture(); myProjectFixture.setUp(); myCodeInsightFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(myProjectFixture); // Use the context info loaded earlier to setup the environment for TF work initializeTfEnvironment(); myProject = myProjectFixture.getProject(); myProjectRoot = myProject.getBaseDir(); myProjectPath = myProjectRoot.getPath(); myGitSettings = GitVcsSettings.getInstance(myProject); myGitRepositoryManager = GitUtil.getRepositoryManager(myProject); myPlatformFacade = ServiceManager.getService(myProject, GitPlatformFacade.class); myGit = ServiceManager.getService(myProject, Git.class); myVcs = ObjectUtils.assertNotNull(GitVcs.getInstance(myProject)); myVcs.doActivate(); addSilently(); removeSilently(); EULADialog.acceptEula(); } catch (Exception e) { tearDown(); throw e; } }
try { if (listener != null) { listener.directoryCheckedOut(new File(parentDirectory, directoryName), GitVcs.getKey()); listener.checkoutCompleted();
/** * Adds a new line of text to a file and adds/commits it * * @param file * @param repository * @param project * @throws IOException * @throws IOException */ public static void editAndCommitFile(final File file, final git4idea.repo.GitRepository repository, final Project project) throws IOException { // edits file final VirtualFile readmeVirtualFile = LocalFileSystem.getInstance().findFileByIoFile(file); FileUtil.writeToFile(file, "\nnew line", true); // adds and commits the change final LocalChangeListImpl localChangeList = LocalChangeListImpl.createEmptyChangeListImpl(project, "TestCommit", "12345"); final ChangeListManagerImpl changeListManager = ChangeListManagerImpl.getInstanceImpl(project); VcsDirtyScopeManager.getInstance(project).markEverythingDirty(); changeListManager.ensureUpToDate(false); changeListManager.addUnversionedFiles(localChangeList, ImmutableList.of(readmeVirtualFile)); final Change change = changeListManager.getChange(LocalFileSystem.getInstance().findFileByIoFile(file)); repository.getVcs().getCheckinEnvironment().commit(ImmutableList.of(change), COMMIT_MESSAGE); }