示例#1
0
  // on EDT, dispose checked
  public void execute(final UpdatedFiles updatedFiles) {
    if (myConflictedVirtualFiles.isEmpty()) {
      return;
    }
    final AbstractVcsHelper vcsHelper = AbstractVcsHelper.getInstance(myProject);

    List<VirtualFile> mergedFiles =
        vcsHelper.showMergeDialog(myConflictedVirtualFiles, new SvnMergeProvider(myProject));

    final FileGroup mergedGroup = updatedFiles.getGroupById(FileGroup.MERGED_ID);
    final FileGroup conflictedGroup = updatedFiles.getGroupById(FileGroup.MERGED_WITH_CONFLICT_ID);
    final VcsKey vcsKey = SvnVcs.getKey();

    for (final VirtualFile mergedFile : mergedFiles) {
      String path = FileUtil.toSystemDependentName(mergedFile.getPresentableUrl());
      conflictedGroup.remove(path);
      mergedGroup.add(path, vcsKey, null);

      mergedFile.refresh(false, false);
      // for additionally created files removal to be detected
      mergedFile.getParent().refresh(false, false);

      if (myChangesUnderProjectRoot) {
        myDirtyScopeManager.fileDirty(mergedFile);
      }
    }
  }
  private boolean executeRebase(final List<VcsException> exceptions, RebaseInfo rebaseInfo) {
    // TODO this is a workaround to attach PushActiveBranched to the new update.
    // at first we update via rebase
    boolean result =
        new GitUpdateProcess(
                myProject, new EmptyProgressIndicator(), rebaseInfo.roots, UpdatedFiles.create())
            .update(true);

    // then we reorder commits
    if (result) {
      // getting new rebase info because commit hashes changed because of rebase
      final List<Root> roots =
          loadRoots(myProject, new ArrayList<VirtualFile>(rebaseInfo.roots), exceptions, false);
      updateTree(roots, rebaseInfo.uncheckedCommits);
      rebaseInfo = collectRebaseInfo();
      return reorderCommitsIfNeeded(rebaseInfo);
    } else {
      notifyMessage(
          myProject,
          "Commits weren't pushed",
          "Rebase failed.",
          NotificationType.WARNING,
          true,
          null);
      return false;
    }
  }
 private List<VcsException> updateThroughPlugin() throws VcsException {
   HgRegularUpdater updater =
       new HgRegularUpdater(
           myProject,
           projectRepoVirtualFile,
           new org.zmlx.hg4idea.provider.update.HgUpdater.UpdateConfiguration());
   UpdatedFiles updatedFiles = UpdatedFiles.create();
   EmptyProgressIndicator indicator = new EmptyProgressIndicator();
   ArrayList<VcsException> nonFatalWarnings = new ArrayList<VcsException>();
   updater.update(updatedFiles, indicator, nonFatalWarnings);
   return nonFatalWarnings;
 }
示例#4
0
 public static boolean haveUnresolvedConflicts(final UpdatedFiles updatedFiles) {
   final String[] ids =
       new String[] {
         FileGroup.MERGED_WITH_CONFLICT_ID,
         FileGroup.MERGED_WITH_PROPERTY_CONFLICT_ID,
         FileGroup.MERGED_WITH_TREE_CONFLICT,
         FileGroup.SKIPPED_ID
       };
   for (String id : ids) {
     final FileGroup group = updatedFiles.getGroupById(id);
     if ((group != null) && (!group.isEmpty())) return true;
   }
   return false;
 }
示例#5
0
  public boolean needsInteraction(final UpdatedFiles updatedFiles) {
    if (myChangesUnderProjectRoot) {
      refreshChangeListsFindConflicts(updatedFiles);
    } else {
      final FileGroup conflictedGroup =
          updatedFiles.getGroupById(FileGroup.MERGED_WITH_CONFLICT_ID);
      for (String filename : conflictedGroup.getFiles()) {
        final VirtualFile vf = SvnUtil.getVirtualFile(filename);
        myConflictedVirtualFiles.add(vf);
      }
    }

    return ((!myConflictedVirtualFiles.isEmpty()) || (!haveUnresolvedConflicts(updatedFiles)))
        && (!SvnConfiguration.getInstance(myProject).MERGE_DRY_RUN);
  }
 @Override
 protected void actionPerformed(@NotNull HgRepository repository, @NotNull Hash commit) {
   FileDocumentManager.getInstance().saveAllDocuments();
   HgMergeCommand.mergeWith(repository, commit.asString(), UpdatedFiles.create());
 }
 private static void addToGroup(UpdatedFiles updatedFiles, HgChange change, String id) {
   updatedFiles
       .getGroupById(id)
       .add(change.afterFile().getFile().getAbsolutePath(), HgVcs.VCS_NAME, null);
 }