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


Java GitRepositoryManager.updateRepository方法代码示例

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


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

示例1: perform

import git4idea.repo.GitRepositoryManager; //导入方法依赖的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

示例2: perform

import git4idea.repo.GitRepositoryManager; //导入方法依赖的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);
  d.show();
  if (!d.isOK()) {
    return;
  }
  GitLineHandler h = d.handler();
  affectedRoots.add(d.getGitRoot());
  GitHandlerUtil.doSynchronously(h, GitBundle.getString("resetting.title"), h.printableCommandLine());
  GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
  manager.updateRepository(d.getGitRoot());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:GitResetHead.java

示例3: doRebaseCurrentBranch

import git4idea.repo.GitRepositoryManager; //导入方法依赖的package包/类
private static void doRebaseCurrentBranch(@NotNull final Project project,
                                          @NotNull final VirtualFile root,
                                          @NotNull final ProgressIndicator indicator) {
  final GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(project);
  Git git = ServiceManager.getService(Git.class);
  final GitRebaser rebaser = new GitRebaser(project, git, indicator);

  final GitLineHandler handler = new GitLineHandler(project, root, GitCommand.REBASE);
  handler.setStdoutSuppressed(false);
  handler.addParameters("upstream/master");

  final GitRebaseProblemDetector rebaseConflictDetector = new GitRebaseProblemDetector();
  handler.addLineListener(rebaseConflictDetector);

  final GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector =
    new GitUntrackedFilesOverwrittenByOperationDetector(root);
  final GitLocalChangesWouldBeOverwrittenDetector localChangesDetector = new GitLocalChangesWouldBeOverwrittenDetector(root, CHECKOUT);
  handler.addLineListener(untrackedFilesDetector);
  handler.addLineListener(localChangesDetector);
  handler.addLineListener(GitStandardProgressAnalyzer.createListener(indicator));

  String oldText = indicator.getText();
  indicator.setText("Rebasing from upstream/master...");
  GitCommandResult rebaseResult = git.runCommand(handler);
  indicator.setText(oldText);
  repositoryManager.updateRepository(root);
  if (rebaseResult.success()) {
    root.refresh(false, true);
    GithubNotifications.showInfo(project, "Success", "Successfully rebased GitHub fork");
  }
  else {
    GitUpdateResult result = rebaser.handleRebaseFailure(handler, root, rebaseConflictDetector,
                                                         untrackedFilesDetector, localChangesDetector);
    if (result == GitUpdateResult.NOTHING_TO_UPDATE ||
        result == GitUpdateResult.SUCCESS ||
        result == GitUpdateResult.SUCCESS_WITH_RESOLVED_CONFLICTS) {
      GithubNotifications.showInfo(project, "Success", "Successfully rebased GitHub fork");
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:GithubRebaseAction.java

示例4: commit

import git4idea.repo.GitRepositoryManager; //导入方法依赖的package包/类
private static void commit(Project project,
                           VirtualFile root,
                           Collection<FilePath> files,
                           File message,
                           final String nextCommitAuthor,
                           boolean nextCommitAmend, Date nextCommitAuthorDate)
  throws VcsException {
  boolean amend = nextCommitAmend;
  for (List<String> paths : VcsFileUtil.chunkPaths(root, files)) {
    GitSimpleHandler handler = new GitSimpleHandler(project, root, GitCommand.COMMIT);
    handler.setStdoutSuppressed(false);
    if (amend) {
      handler.addParameters("--amend");
    }
    else {
      amend = true;
    }
    handler.addParameters("--only", "-F", message.getAbsolutePath());
    if (nextCommitAuthor != null) {
      handler.addParameters("--author=" + nextCommitAuthor);
    }
    if (nextCommitAuthorDate != null) {
      handler.addParameters("--date", COMMIT_DATE_FORMAT.format(nextCommitAuthorDate));
    }
    handler.endOptions();
    handler.addParameters(paths);
    handler.run();
  }
  if (!project.isDisposed()) {
    GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
    manager.updateRepository(root);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:GitCheckinEnvironment.java

示例5: handleResult

import git4idea.repo.GitRepositoryManager; //导入方法依赖的package包/类
private void handleResult(GitCommandResult result,
                          Project project,
                          GitSimpleEventDetector mergeConflictDetector,
                          GitLocalChangesWouldBeOverwrittenDetector localChangesDetector,
                          GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector,
                          GitRepository repository,
                          GitRevisionNumber currentRev,
                          Set<VirtualFile> affectedRoots,
                          Label beforeLabel) {
  GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(project);
  VirtualFile root = repository.getRoot();
  if (result.success() || mergeConflictDetector.hasHappened()) {
    VfsUtil.markDirtyAndRefresh(false, true, false, root);
    List<VcsException> exceptions = new ArrayList<VcsException>();
    GitMergeUtil.showUpdates(this, project, exceptions, root, currentRev, beforeLabel, getActionName(), ActionInfo.UPDATE);
    repositoryManager.updateRepository(root);
    runFinalTasks(project, GitVcs.getInstance(project), affectedRoots, getActionName(), exceptions);
  }
  else if (localChangesDetector.wasMessageDetected()) {
    LocalChangesWouldBeOverwrittenHelper.showErrorNotification(project, repository.getRoot(), getActionName(),
                                                               localChangesDetector.getRelativeFilePaths());
  }
  else if (untrackedFilesDetector.wasMessageDetected()) {
    GitUntrackedFilesHelper.notifyUntrackedFilesOverwrittenBy(project, root, untrackedFilesDetector.getRelativeFilePaths(),
                                                              getActionName(), null);
  }
  else {
    GitUIUtil.notifyError(project, "Git " + getActionName() + " Failed", result.getErrorOutputAsJoinedString(), true, null);
    repositoryManager.updateRepository(root);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:GitMergeAction.java

示例6: commit

import git4idea.repo.GitRepositoryManager; //导入方法依赖的package包/类
/**
 * Prepare delete files handler.
 *
 *
 *
 * @param project              the project
 * @param root                 a vcs root
 * @param files                a files to commit
 * @param message              a message file to use
 * @param nextCommitAuthor     a author for the next commit
 * @param nextCommitAmend      true, if the commit should be amended
 * @param nextCommitAuthorDate Author date timestamp to override the date of the commit or null if this overriding is not needed.
 * @return a simple handler that does the task
 * @throws VcsException in case of git problem
 */
private static void commit(Project project,
                           VirtualFile root,
                           Collection<FilePath> files,
                           File message,
                           final String nextCommitAuthor,
                           boolean nextCommitAmend, Date nextCommitAuthorDate)
  throws VcsException {
  boolean amend = nextCommitAmend;
  for (List<String> paths : VcsFileUtil.chunkPaths(root, files)) {
    GitSimpleHandler handler = new GitSimpleHandler(project, root, GitCommand.COMMIT);
    if (amend) {
      handler.addParameters("--amend");
    }
    else {
      amend = true;
    }
    handler.addParameters("--only", "-F", message.getAbsolutePath());
    if (nextCommitAuthor != null) {
      handler.addParameters("--author=" + nextCommitAuthor);
    }
    if (nextCommitAuthorDate != null) {
      handler.addParameters("--date", COMMIT_DATE_FORMAT.format(nextCommitAuthorDate));
    }
    handler.endOptions();
    handler.addParameters(paths);
    handler.run();
  }
  if (!project.isDisposed()) {
    GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
    manager.updateRepository(root);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:48,代码来源:GitCheckinEnvironment.java

示例7: perform

import git4idea.repo.GitRepositoryManager; //导入方法依赖的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 {
  GitVcs vcs = GitVcs.getInstance(project);
  if (vcs == null) {
    return;
  }
  GitMergeDialog dialog = new GitMergeDialog(project, gitRoots, defaultRoot);
  try {
    dialog.updateBranches();
  }
  catch (VcsException e) {
    if (vcs.getExecutableValidator().checkExecutableAndShowMessageIfNeeded(null)) {
      vcs.showErrors(Collections.singletonList(e), GitBundle.getString("merge.retrieving.branches"));
    }
    return;
  }
  dialog.show();
  if (!dialog.isOK()) {
    return;
  }
  Label beforeLabel = LocalHistory.getInstance().putSystemLabel(project, "Before update");
  GitLineHandler h = dialog.handler();
  final VirtualFile root = dialog.getSelectedRoot();
  affectedRoots.add(root);
  GitRevisionNumber currentRev = GitRevisionNumber.resolve(project, root, "HEAD");
  try {
    GitHandlerUtil.doSynchronously(h, GitBundle.message("merging.title", dialog.getSelectedRoot().getPath()), h.printableCommandLine());
  }
  finally {
    exceptions.addAll(h.errors());
    GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
    manager.updateRepository(root);
  }
  if (exceptions.size() != 0) {
    return;
  }
  GitMergeUtil.showUpdates(this, project, exceptions, root, currentRev, beforeLabel, getActionName(), ActionInfo.INTEGRATE);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:45,代码来源:GitMerge.java

示例8: runAction

import git4idea.repo.GitRepositoryManager; //导入方法依赖的package包/类
/**
 * Perform tagging according to selected options
 *
 * @param exceptions the list where exceptions are collected
 */
public void runAction(final List<VcsException> exceptions) {
  final String message = myMessageTextArea.getText();
  final boolean hasMessage = message.trim().length() != 0;
  final File messageFile;
  if (hasMessage) {
    try {
      messageFile = FileUtil.createTempFile(MESSAGE_FILE_PREFIX, MESSAGE_FILE_SUFFIX);
      messageFile.deleteOnExit();
      Writer out = new OutputStreamWriter(new FileOutputStream(messageFile), MESSAGE_FILE_ENCODING);
      try {
        out.write(message);
      }
      finally {
        out.close();
      }
    }
    catch (IOException ex) {
      Messages.showErrorDialog(myProject, GitBundle.message("tag.error.creating.message.file.message", ex.toString()),
                               GitBundle.getString("tag.error.creating.message.file.title"));
      return;
    }
  }
  else {
    messageFile = null;
  }
  try {
    GitSimpleHandler h = new GitSimpleHandler(myProject, getGitRoot(), GitCommand.TAG);
    if (hasMessage) {
      h.addParameters("-a");
    }
    if (myForceCheckBox.isEnabled() && myForceCheckBox.isSelected()) {
      h.addParameters("-f");
    }
    if (hasMessage) {
      h.addParameters("-F", messageFile.getAbsolutePath());
    }
    h.addParameters(myTagNameTextField.getText());
    String object = myCommitTextField.getText().trim();
    if (object.length() != 0) {
      h.addParameters(object);
    }
    try {
      GitHandlerUtil.doSynchronously(h, GitBundle.getString("tagging.title"), h.printableCommandLine());
      GitUIUtil.notifySuccess(myProject, myTagNameTextField.getText(), "Created tag "  + myTagNameTextField.getText() + " successfully.");
    }
    finally {
      exceptions.addAll(h.errors());
      GitRepositoryManager manager = GitUtil.getRepositoryManager(myProject);
      manager.updateRepository(getGitRoot());
    }
  }
  finally {
    if (messageFile != null) {
      //noinspection ResultOfMethodCallIgnored
      messageFile.delete();
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:64,代码来源:GitTagDialog.java


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