Exemplo n.º 1
0
  private static Set<String> getCommitableChanges(
      Repository repo, IServer server, IProgressMonitor monitor) throws IOException {

    EclipseGitProgressTransformer jgitMonitor = new EclipseGitProgressTransformer(monitor);
    IndexDiff indexDiff =
        new IndexDiff(repo, Constants.HEAD, IteratorService.createInitialIterator(repo));
    indexDiff.diff(jgitMonitor, 0, 0, NLS.bind("Repository: {0}", repo.getDirectory().getPath()));
    Set<String> set = new HashSet<String>();
    if (commitAddedResources(server)) set.addAll(indexDiff.getAdded());
    if (commitChangedResources(server)) set.addAll(indexDiff.getChanged());
    if (commitConflictingResources(server)) set.addAll(indexDiff.getConflicting());
    if (commitMissingResources(server)) set.addAll(indexDiff.getMissing());
    if (commitModifiedResources(server)) set.addAll(indexDiff.getModified());
    if (commitRemovedResources(server)) set.addAll(indexDiff.getRemoved());
    if (commitUntrackedResources(server)) set.addAll(indexDiff.getUntracked());

    return set;
  }
Exemplo n.º 2
0
  StatusResult(File projectPath, IndexDiff indexDiff) {
    this.projectPath = projectPath;
    ignoredMap.put(projectPath.toString(), Boolean.FALSE);

    if (indexDiff == null) {
      return;
    }

    for (String relativePathString : indexDiff.getIgnoredNotInIndex()) {
      String absolutePathString = new File(projectPath, relativePathString).toString();
      ignoredMap.put(absolutePathString, Boolean.TRUE);
    }

    addToStatusSetMap(indexDiff.getAdded(), WorkNodeStatus.ADDED);
    addToStatusSetMap(indexDiff.getChanged(), WorkNodeStatus.CHANGED);
    addToStatusSetMap(indexDiff.getConflicting(), WorkNodeStatus.CONFLICTING);
    addToStatusSetMap(indexDiff.getMissing(), WorkNodeStatus.MISSING);
    addToStatusSetMap(indexDiff.getModified(), WorkNodeStatus.MODIFIED);
    addToStatusSetMap(indexDiff.getRemoved(), WorkNodeStatus.REMOVED);
    addToStatusSetMap(indexDiff.getUntracked(), WorkNodeStatus.UNTRACKED);
  }