Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.IndexDiff$WorkingTreeIteratorFactory


  public Status call() throws GitAPIException, NoWorkTreeException {
    if (workingTreeIt == null)
      workingTreeIt = new FileTreeIterator(repo);

    try {
      IndexDiff diff = new IndexDiff(repo, Constants.HEAD, workingTreeIt);
      diff.diff();
      return new Status(diff);
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }
  }
View Full Code Here


      return false;
    }

    try {
      FileTreeIterator fileTreeIterator = new FileTreeIterator(repository);
      IndexDiff indexDiff = new IndexDiff(repository, Constants.HEAD,
          fileTreeIterator);
      indexDiff.setFilter(PathFilterGroup.createFromStrings(Collections.singletonList(resRelPath)));
      indexDiff.diff();

      return indexDiff.getAdded().contains(resRelPath) || indexDiff.getChanged().contains(resRelPath)
          || indexDiff.getRemoved().contains(resRelPath);
    } catch (IOException e) {
      Activator.error(NLS.bind(UIText.GitHistoryPage_errorLookingUpPath,
          location.toString()), e);
      return false;
    }
View Full Code Here

      }
    }
    WorkingTreeIterator it = IteratorService.createInitialIterator(repo);
    if (it == null)
      throw new OperationCanceledException(); // workspace is closed
    indexDiff = new IndexDiff(repo, Constants.HEAD, it);
    indexDiff.diff(jgitMonitor, counter.count, 0, NLS.bind(
        UIText.CommitActionHandler_repository, repo.getDirectory()
            .getPath()));

    includeList(indexDiff.getAdded(), indexChanges);
View Full Code Here

   * @throws IOException
   */
  private Status getFileStatus(String path) throws IOException {
    AdaptableFileTreeIterator fileTreeIterator = new AdaptableFileTreeIterator(
        repository, ResourcesPlugin.getWorkspace().getRoot());
    IndexDiff indexDiff = new IndexDiff(repository, Constants.HEAD, fileTreeIterator);
    Set<String> repositoryPaths = Collections.singleton(path);
    indexDiff.setFilter(PathFilterGroup.createFromStrings(repositoryPaths));
    indexDiff.diff(null, 0, 0, ""); //$NON-NLS-1$
    return getFileStatus(path, indexDiff);
  }
View Full Code Here

    List<String> treeFilterPaths = calcTreeFilterPaths(filesToUpdate);

    WorkingTreeIterator iterator = IteratorService.createInitialIterator(repository);
    if (iterator == null)
      return null; // workspace is closed
    IndexDiff diffForChangedResources = new IndexDiff(repository,
        Constants.HEAD, iterator);
    diffForChangedResources.setFilter(PathFilterGroup
        .createFromStrings(treeFilterPaths));
    diffForChangedResources.diff(jgitMonitor, 0, 0, jobName);
    return new IndexDiffData(indexDiffData, filesToUpdate,
        resourcesToUpdate, diffForChangedResources);
  }
View Full Code Here

  private IndexDiffData calcIndexDiffDataFull(IProgressMonitor monitor, String jobName)
      throws IOException {
    EclipseGitProgressTransformer jgitMonitor = new EclipseGitProgressTransformer(
        monitor);

    IndexDiff newIndexDiff;
    WorkingTreeIterator iterator = IteratorService
        .createInitialIterator(repository);
    if (iterator == null)
      return null; // workspace is closed
    newIndexDiff = new IndexDiff(repository, Constants.HEAD, iterator);
    newIndexDiff.diff(jgitMonitor, 0, 0, jobName);
    return new IndexDiffData(newIndexDiff);
  }
View Full Code Here

   */
  public Status call() throws IOException, NoWorkTreeException {
    if (workingTreeIt == null)
      workingTreeIt = new FileTreeIterator(repo);

    IndexDiff diff = new IndexDiff(repo, Constants.HEAD, workingTreeIt);
    diff.diff();

    return new Status(diff);
  }
View Full Code Here

  public Status call() throws GitAPIException, NoWorkTreeException {
    if (workingTreeIt == null)
      workingTreeIt = new FileTreeIterator(repo);

    try {
      IndexDiff diff = new IndexDiff(repo, Constants.HEAD, workingTreeIt);
      if (paths != null)
        diff.setFilter(PathFilterGroup.createFromStrings(paths));
      if (progressMonitor == null)
        diff.diff();
      else
        diff.diff(progressMonitor, ProgressMonitor.UNKNOWN,
            ProgressMonitor.UNKNOWN, ""); //$NON-NLS-1$
      return new Status(diff);
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }
View Full Code Here

     */
    public static Map<File, StatusInfo> getInterestingStatus(File root, File dir) {
        String relPath = getRelative(root, dir);

        Repository repo = Git.getInstance().getRepository(root);
        IndexDiff index;

        Map<File, StatusInfo> files = new HashMap<File, StatusInfo>();

        try {
            index = new IndexDiff(repo);
            index.diff();

            put(index.getAdded(), relPath, files, root,
                    StatusInfo.STATUS_VERSIONED_ADDEDLOCALLY);
            put(index.getRemoved(), relPath, files, root,
                    StatusInfo.STATUS_VERSIONED_REMOVEDLOCALLY);
            put(index.getMissing(), relPath, files, root,
                    StatusInfo.STATUS_VERSIONED_DELETEDLOCALLY);
            put(index.getChanged(), relPath, files, root,
                    StatusInfo.STATUS_VERSIONED_MODIFIEDLOCALLY);
            put(index.getModified(), relPath, files, root,
                    StatusInfo.STATUS_VERSIONED_MODIFIEDLOCALLY);

            final FileTreeIterator workTree = new FileTreeIterator(repo.getWorkDir());
            final TreeWalk walk = new TreeWalk(repo);

            walk.reset(); // drop the first empty tree
            walk.setRecursive(true);
            walk.addTree(workTree);

            DirCache cache = DirCache.read(repo);

            while (walk.next()) {
                String path = walk.getPathString();

                if (relPath.length() > 0 && !path.startsWith(relPath)) {
                    continue;
                }
                if (index.getAdded().contains(path) ||
                        index.getRemoved().contains(path) ||
                        index.getMissing().contains(path) ||
                        index.getChanged().contains(path) ||
                        index.getModified().contains(path)) {
                    continue;
                }
                DirCacheEntry entry = cache.getEntry(path);
                if (entry != null) {
                    continue;
View Full Code Here

        return files;
    }

    public static StatusInfo getSingleStatus(File root, File file) {
        Repository repo = Git.getInstance().getRepository(root);
        IndexDiff index;

        int share = SharabilityQuery.getSharability(file.getParentFile());
        if (share == SharabilityQuery.NOT_SHARABLE ||
                (share == SharabilityQuery.MIXED &&
                SharabilityQuery.getSharability(file) == SharabilityQuery.NOT_SHARABLE)) {
            return new StatusInfo(StatusInfo.STATUS_NOTVERSIONED_EXCLUDED, null, false);
        }
        int status = StatusInfo.STATUS_UNKNOWN;
        String name = getRelative(root, file);

        try {
            index = new IndexDiff(repo);
            index.diff();
        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
            return new StatusInfo(status, null, false);
        }

        if (index.getAdded().contains(name)) {
            status = StatusInfo.STATUS_VERSIONED_ADDEDLOCALLY;
        } else if (index.getRemoved().contains(name)) {
            status = StatusInfo.STATUS_VERSIONED_REMOVEDLOCALLY;
        } else if (index.getMissing().contains(name)) {
            status = StatusInfo.STATUS_VERSIONED_DELETEDLOCALLY;
        } else if (index.getChanged().contains(name)) {
            status = StatusInfo.STATUS_VERSIONED_MODIFIEDLOCALLY;
        } else if (index.getModified().contains(name)) {
            status = StatusInfo.STATUS_VERSIONED_MODIFIEDLOCALLY;
        } else {
            status = StatusInfo.STATUS_VERSIONED_UPTODATE;
        }
        StatusInfo info = new StatusInfo(status, null, false);
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.lib.IndexDiff$WorkingTreeIteratorFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.