当前位置: 首页>>代码示例>>Java>>正文


Java DvcsUtil.workingTreeChangeFinished方法代码示例

本文整理汇总了Java中com.intellij.dvcs.DvcsUtil.workingTreeChangeFinished方法的典型用法代码示例。如果您正苦于以下问题:Java DvcsUtil.workingTreeChangeFinished方法的具体用法?Java DvcsUtil.workingTreeChangeFinished怎么用?Java DvcsUtil.workingTreeChangeFinished使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.dvcs.DvcsUtil的用法示例。


在下文中一共展示了DvcsUtil.workingTreeChangeFinished方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rebaseCurrentBranch

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
private static void rebaseCurrentBranch(@NotNull final Project project,
                                        @NotNull final GitRepository gitRepository,
                                        @NotNull final ProgressIndicator indicator) {
  final Git git = ServiceManager.getService(project, Git.class);
  final GitPlatformFacade facade = ServiceManager.getService(project, GitPlatformFacade.class);
  AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
  try {
    List<VirtualFile> rootsToSave = Collections.singletonList(gitRepository.getRoot());
    GitPreservingProcess process = new GitPreservingProcess(project, facade, git, rootsToSave, "Rebasing", "upstream/master",
                                                            GitVcsSettings.UpdateChangesPolicy.STASH, indicator,
      new Runnable() {
        @Override
        public void run() {
          doRebaseCurrentBranch(project, gitRepository.getRoot(), indicator);
        }
      });
    process.execute();
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(project, token);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GithubRebaseAction.java

示例2: perform

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
protected void perform(@NotNull final Project project,
                       @NotNull final List<VirtualFile> gitRoots,
                       @NotNull final VirtualFile defaultRoot,
                       final Set<VirtualFile> affectedRoots,
                       final List<VcsException> exceptions) throws VcsException {
  final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
  if (changeListManager.isFreezedWithNotification("Can not stash changes now")) return;
  GitStashDialog d = new GitStashDialog(project, gitRoots, defaultRoot);
  if (!d.showAndGet()) {
    return;
  }
  VirtualFile root = d.getGitRoot();
  affectedRoots.add(root);
  final GitLineHandler h = d.handler();
  AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
  try {
    GitHandlerUtil.doSynchronously(h, GitBundle.getString("stashing.title"), h.printableCommandLine());
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(project, token);
  }
  ServiceManager.getService(project, GitPlatformFacade.class).hardRefresh(root);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GitStash.java

示例3: perform

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
protected void perform(@NotNull Project project,
                       @NotNull List<VirtualFile> gitRoots,
                       @NotNull VirtualFile defaultRoot,
                       Set<VirtualFile> affectedRoots,
                       List<VcsException> exceptions) throws VcsException {
  GitResetDialog d = new GitResetDialog(project, gitRoots, defaultRoot);
  if (!d.showAndGet()) {
    return;
  }
  GitLineHandler h = d.handler();
  affectedRoots.add(d.getGitRoot());
  AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
  try {
    GitHandlerUtil.doSynchronously(h, GitBundle.getString("resetting.title"), h.printableCommandLine());
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(project, token);
  }
  GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
  manager.updateRepository(d.getGitRoot());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GitResetHead.java

示例4: cherryPick

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
public void cherryPick(@NotNull List<VcsFullCommitDetails> commits) {
  Map<GitRepository, List<VcsFullCommitDetails>> commitsInRoots =
    DvcsUtil.<GitRepository>groupCommitsByRoots(myPlatformFacade.getRepositoryManager(myProject), commits);
  List<GitCommitWrapper> successfulCommits = ContainerUtil.newArrayList();
  List<GitCommitWrapper> alreadyPicked = ContainerUtil.newArrayList();
  AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
  try {
    for (Map.Entry<GitRepository, List<VcsFullCommitDetails>> entry : commitsInRoots.entrySet()) {
      GitRepository repository = entry.getKey();
      boolean result = cherryPick(repository, entry.getValue(), successfulCommits, alreadyPicked);
      repository.update();
      if (!result) {
        return;
      }
    }
    notifyResult(successfulCommits, alreadyPicked);
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(myProject, token);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GitCherryPicker.java

示例5: execute

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
@Nullable
private HgCommandResult execute() {
  HgPromptCommandExecutor commandExecutor = new HgPromptCommandExecutor(project);
  commandExecutor.setShowOutput(true);
  List<String> arguments = new LinkedList<String>();
  if (!StringUtil.isEmptyOrSpaces(revision)) {
    arguments.add("--rev");
    arguments.add(revision);
  }
  AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
  try {
    HgCommandResult result = commandExecutor.executeInCurrentThread(repo.getRoot(), "merge", arguments);
    repo.update();
    return result;
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(project, token);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:HgMergeCommand.java

示例6: graft

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
@Nullable
private HgCommandResult graft(@NotNull List<String> params) {
  List<String> args = new ArrayList<String>();
  args.add("--log");
  args.addAll(params);
  AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
  try {
    HgCommandResult result =
      new HgCommandExecutor(myProject)
        .executeInCurrentThread(myRepository.getRoot(), "graft", args);
    myRepository.update();
    return result;
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(myProject, token);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:HgGraftCommand.java

示例7: execute

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
public void execute() {
  saveAllDocuments();
  AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
  Map<GitRepository, GitCommandResult> results = ContainerUtil.newHashMap();
  try {
    for (Map.Entry<GitRepository, VcsFullCommitDetails> entry : myCommits.entrySet()) {
      GitRepository repository = entry.getKey();
      VirtualFile root = repository.getRoot();
      String target = entry.getValue().getId().asString();
      GitLocalChangesWouldBeOverwrittenDetector detector = new GitLocalChangesWouldBeOverwrittenDetector(root, RESET);

      GitCommandResult result = myGit.reset(repository, myMode, target, detector);
      if (!result.success() && detector.wasMessageDetected()) {
        GitCommandResult smartResult = proposeSmartReset(detector, repository, target);
        if (smartResult != null) {
          result = smartResult;
        }
      }
      results.put(repository, result);
      repository.update();
      VfsUtil.markDirtyAndRefresh(true, true, false, root);
      VcsDirtyScopeManager.getInstance(myProject).dirDirtyRecursively(root);
    }
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(myProject, token);
  }
  notifyResult(results);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:GitResetOperation.java

示例8: update

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
/**
 * Checks if update is possible, saves local changes and updates all roots.
 * In case of error shows notification and returns false. If update completes without errors, returns true.
 *
 * Perform update on all roots.
 * 0. Blocks reloading project on external change, saving/syncing on frame deactivation.
 * 1. Checks if update is possible (rebase/merge in progress, no tracked branches...) and provides merge dialog to solve problems.
 * 2. Finds updaters to use (merge or rebase).
 * 3. Preserves local changes if needed (not needed for merge sometimes).
 * 4. Updates via 'git pull' or equivalent.
 * 5. Restores local changes if update completed or failed with error. If update is incomplete, i.e. some unmerged files remain,
 * local changes are not restored.
 *
 */
@NotNull
public GitUpdateResult update(final UpdateMethod updateMethod) {
  LOG.info("update started|" + updateMethod);
  String oldText = myProgressIndicator.getText();
  myProgressIndicator.setText("Updating...");

  for (GitRepository repository : myRepositories) {
    repository.update();
  }

  // check if update is possible
  if (checkRebaseInProgress() || isMergeInProgress() || areUnmergedFiles() || !checkTrackedBranchesConfigured()) {
    return GitUpdateResult.NOT_READY;
  }

  if (!fetchAndNotify()) {
    return GitUpdateResult.NOT_READY;
  }

  AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
  GitUpdateResult result;
  try {
    result = updateImpl(updateMethod);
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(myProject, token);
  }
  myProgressIndicator.setText(oldText);
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:45,代码来源:GitUpdateProcess.java

示例9: rebase

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
public GitUpdateResult rebase(@NotNull VirtualFile root,
                              @NotNull List<String> parameters,
                              @Nullable final Runnable onCancel,
                              @Nullable GitLineHandlerListener lineListener) {
  final GitLineHandler rebaseHandler = createHandler(root);
  rebaseHandler.setStdoutSuppressed(false);
  rebaseHandler.addParameters(parameters);
  if (lineListener != null) {
    rebaseHandler.addLineListener(lineListener);
  }

  final GitRebaseProblemDetector rebaseConflictDetector = new GitRebaseProblemDetector();
  rebaseHandler.addLineListener(rebaseConflictDetector);
  GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector = new GitUntrackedFilesOverwrittenByOperationDetector(root);
  GitLocalChangesWouldBeOverwrittenDetector localChangesDetector = new GitLocalChangesWouldBeOverwrittenDetector(root, CHECKOUT);
  rebaseHandler.addLineListener(untrackedFilesDetector);
  rebaseHandler.addLineListener(localChangesDetector);
  rebaseHandler.addLineListener(GitStandardProgressAnalyzer.createListener(myProgressIndicator));

  AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
  try {
    String oldText = myProgressIndicator.getText();
    myProgressIndicator.setText("Rebasing...");
    GitCommandResult result = myGit.runCommand(rebaseHandler);
    myProgressIndicator.setText(oldText);
    return result.success() ?
           GitUpdateResult.SUCCESS :
           handleRebaseFailure(rebaseHandler, root, rebaseConflictDetector, untrackedFilesDetector, localChangesDetector);
  }
  catch (ProcessCanceledException pce) {
    if (onCancel != null) {
      onCancel.run();
    }
    return GitUpdateResult.CANCEL;
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(myProject, token);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:GitRebaser.java

示例10: continueRebase

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
/**
 * Runs 'git rebase --continue' on several roots consequently.
 * @return true if rebase successfully finished.
 */
public boolean continueRebase(@NotNull Collection<VirtualFile> rebasingRoots) {
  AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
  try {
    boolean success = true;
    for (VirtualFile root : rebasingRoots) {
      success &= continueRebase(root);
    }
    return success;
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(myProject, token);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GitRebaser.java

示例11: rollbackMissingFileDeletion

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
public void rollbackMissingFileDeletion(List<FilePath> files,
                                        List<VcsException> exceptions, RollbackProgressListener listener) {
  AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
  try {
    revert(files);
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(project, token);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:HgRollbackEnvironment.java

示例12: execute

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
@Nullable
public HgCommandResult execute() {
  List<String> arguments = new LinkedList<String>();
  if (clean) {
    arguments.add("--clean");
  }

  if (!StringUtil.isEmptyOrSpaces(revision)) {
    arguments.add("--rev");
    arguments.add(revision);
  }

  final HgPromptCommandExecutor executor = new HgPromptCommandExecutor(project);
  executor.setShowOutput(true);
  HgCommandResult result;
  AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
  try {
    result =
      executor.executeInCurrentThread(repo, "update", arguments);
    if (!clean && hasUncommittedChangesConflict(result)) {
      final String message = "<html>Your uncommitted changes couldn't be merged into the requested changeset.<br>" +
                             "Would you like to perform force update and discard them?";
      if (showDiscardChangesConfirmation(project, message) == Messages.OK) {
        arguments.add("-C");
        result = executor.executeInCurrentThread(repo, "update", arguments);
      }
    }
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(project, token);
  }

  VfsUtil.markDirtyAndRefresh(true, true, false, repo);
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:HgUpdateCommand.java

示例13: performRebase

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
@Nullable
private HgCommandResult performRebase(@NotNull String... args) {
  AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
  try {
    HgCommandResult result =
      new HgCommandExecutor(project)
        .executeInCurrentThread(repo.getRoot(), "rebase", ContainerUtil.list(args));
    repo.update();
    return result;
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(project, token);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:HgRebaseCommand.java

示例14: perform

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
protected void perform(@NotNull Project project,
                       @NotNull List<VirtualFile> gitRoots,
                       @NotNull VirtualFile defaultRoot,
                       Set<VirtualFile> affectedRoots,
                       List<VcsException> exceptions) throws VcsException {
  // remote all roots where there are no rebase in progress
  for (Iterator<VirtualFile> i = gitRoots.iterator(); i.hasNext();) {
    if (!GitRebaseUtils.isRebaseInTheProgress(i.next())) {
      i.remove();
    }
  }
  if (gitRoots.size() == 0) {
    Messages.showErrorDialog(project, GitBundle.getString("rebase.action.no.root"), GitBundle.getString("rebase.action.error"));
    return;
  }
  final VirtualFile root;
  if (gitRoots.size() == 1) {
    root = gitRoots.get(0);
  }
  else {
    if (!gitRoots.contains(defaultRoot)) {
      defaultRoot = gitRoots.get(0);
    }
    GitRebaseActionDialog d = new GitRebaseActionDialog(project, getActionName(), gitRoots, defaultRoot);
    d.show();
    root = d.selectRoot();
    if (root == null) {
      return;
    }
  }
  affectedRoots.add(root);
  GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.REBASE);
  h.setStdoutSuppressed(false);
  h.addParameters("--abort");
  AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
  try {
    GitHandlerUtil.doSynchronously(h, getActionName(), h.printableCommandLine());
    VfsUtil.markDirtyAndRefresh(true, true, false, root);
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(project, token);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:GitRebaseAbort.java

示例15: doOKAction

import com.intellij.dvcs.DvcsUtil; //导入方法依赖的package包/类
@Override
protected void doOKAction() {
  VirtualFile root = getGitRoot();
  final GitLineHandler h = handler();
  final AtomicBoolean conflict = new AtomicBoolean();

  h.addLineListener(new GitLineHandlerAdapter() {
    public void onLineAvailable(String line, Key outputType) {
      if (line.contains("Merge conflict")) {
        conflict.set(true);
      }
    }
  });
  GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector = new GitUntrackedFilesOverwrittenByOperationDetector(root);
  GitLocalChangesWouldBeOverwrittenDetector localChangesDetector = new GitLocalChangesWouldBeOverwrittenDetector(root, MERGE);
  h.addLineListener(untrackedFilesDetector);
  h.addLineListener(localChangesDetector);

  AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
  try {
    final Ref<GitCommandResult> result = Ref.create();
    final ProgressManager progressManager = ProgressManager.getInstance();
    boolean completed = progressManager.runProcessWithProgressSynchronously(new Runnable() {
      @Override
      public void run() {
        h.addLineListener(new GitHandlerUtil.GitLineHandlerListenerProgress(progressManager.getProgressIndicator(), h, "stash", false));
        Git git = ServiceManager.getService(Git.class);
        result.set(git.runCommand(new Computable.PredefinedValueComputable<GitLineHandler>(h)));
      }
    }, GitBundle.getString("unstash.unstashing"), true, myProject);

    if (!completed) return;

    ServiceManager.getService(myProject, GitPlatformFacade.class).hardRefresh(root);
    GitCommandResult res = result.get();
    if (conflict.get()) {
      boolean conflictsResolved = new UnstashConflictResolver(myProject, root, getSelectedStash()).merge();
      LOG.info("loadRoot " + root + ", conflictsResolved: " + conflictsResolved);
    } else if (untrackedFilesDetector.wasMessageDetected()) {
      GitUntrackedFilesHelper.notifyUntrackedFilesOverwrittenBy(myProject, root, untrackedFilesDetector.getRelativeFilePaths(),
                                                                "unstash", null);
    } else if (localChangesDetector.wasMessageDetected()) {
      LocalChangesWouldBeOverwrittenHelper.showErrorDialog(myProject, root, "unstash", localChangesDetector.getRelativeFilePaths());
    } else if (!res.success()) {
      GitUIUtil.showOperationErrors(myProject, h.errors(), h.printableCommandLine());
    }
  }
  finally {
    DvcsUtil.workingTreeChangeFinished(myProject, token);
  }
  super.doOKAction();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:53,代码来源:GitUnstashDialog.java


注:本文中的com.intellij.dvcs.DvcsUtil.workingTreeChangeFinished方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。