Package org.eclipse.egit.core.internal.indexdiff

Examples of org.eclipse.egit.core.internal.indexdiff.IndexDiffData


    waitForListenerCalled();
    final String fileName = "aFile";
    // This call should trigger an indexDiffChanged event (triggered via
    // resource changed event)
    project.createFile(fileName, "content".getBytes("UTF-8"));
    IndexDiffData indexDiffData = waitForListenerCalled();
    String path = project.project.getFile(fileName).getFullPath()
        .toString().substring(1);
    if (!indexDiffData.getUntracked().contains(path))
      fail("IndexDiffData did not contain aFile as untracked");
    // This call should trigger an indexDiffChanged event
    new Git(repository).add().addFilepattern(path).call();
    IndexDiffData indexDiffData2 = waitForListenerCalled();
    if (indexDiffData2.getUntracked().contains(path))
      fail("IndexDiffData contains aFile as untracked");
    if (!indexDiffData2.getAdded().contains(path))
      fail("IndexDiffData does not contain aFile as added");
  }
View Full Code Here


    project.createFolder("folder/a");
    project.createFolder("folder/b");
    IFile fileA = project.createFile("folder/a/file", new byte[] {});
    project.createFile("folder/b/file", new byte[] {});

    IndexDiffData data1 = waitForListenerCalled();
    assertThat(data1.getUntrackedFolders(), hasItem("Project-1/folder/"));

    testRepository.track(fileA.getLocation().toFile());

    IndexDiffData data2 = waitForListenerCalled();
    assertThat(data2.getAdded(), hasItem("Project-1/folder/a/file"));
    assertThat(data2.getUntrackedFolders(), not(hasItem("Project-1/folder/")));
    assertThat(data2.getUntrackedFolders(), not(hasItem("Project-1/folder/a")));
    assertThat(data2.getUntrackedFolders(), hasItem("Project-1/folder/b/"));
  }
View Full Code Here

    project.createFolder("sub");
    testRepository.addToIndex(project.project);
    testRepository.createInitialCommit("testAddFileInIgnoredFolder\n\nfirst commit\n");
    prepareCacheEntry();

    IndexDiffData data1 = waitForListenerCalled();
    assertThat(data1.getIgnoredNotInIndex(), hasItem("Project-1/ignore"));

    project.createFolder("sub/ignore");

    IndexDiffData data2 = waitForListenerCalled();
    assertThat(data2.getIgnoredNotInIndex(), hasItem("Project-1/ignore"));
    assertThat(data2.getIgnoredNotInIndex(), hasItem("Project-1/sub/ignore"));

    // Must not change anything (ignored path starts with this string, but
    // it's not a prefix path of it)
    project.createFile("sub/ignorenot", new byte[] {});

    IndexDiffData data3 = waitForListenerCalled();
    assertThat(data3.getUntracked(), hasItem("Project-1/sub/ignorenot"));
    assertThat(data3.getIgnoredNotInIndex(), hasItem("Project-1/ignore"));
    assertThat(data3.getIgnoredNotInIndex(), hasItem("Project-1/sub/ignore"));
  }
View Full Code Here

    IFile file = project.createFile("sub/ignore", new byte[] {});
    testRepository.addToIndex(project.project);
    testRepository.createInitialCommit("testRemoveIgnoredFile\n\nfirst commit\n");
    prepareCacheEntry();

    IndexDiffData data1 = waitForListenerCalled();
    assertThat(data1.getIgnoredNotInIndex(), hasItem("Project-1/sub/ignore"));

    // Must not change anything (ignored path starts with this string, but
    // it's not a prefix path of it)
    project.createFile("sub/ignorenot", new byte[] {});

    IndexDiffData data2 = waitForListenerCalled();
    assertThat(data2.getIgnoredNotInIndex(), hasItem("Project-1/sub/ignore"));

    file.delete(false, null);

    IndexDiffData data3 = waitForListenerCalled();
    assertThat(data3.getIgnoredNotInIndex(), not(hasItem("Project-1/sub/ignore")));
  }
View Full Code Here

      IndexDiffCacheEntry cacheEntry = cache.getIndexDiffCacheEntry(repository);
      if (cacheEntry == null)
        continue;

      IndexDiffData indexDiff = cacheEntry.getIndexDiff();
      if (indexDiff == null)
        continue;

      if (hasAnyPathChanged(paths, indexDiff))
        return super.promptForInputChange(requestPreviewMessage,
View Full Code Here

      public void run() {
        if (form.isDisposed())
          return;

        final IndexDiffData indexDiff = doReload(repository);
        boolean indexDiffAvailable;
        boolean noConflicts;
        if (indexDiff == null) {
          indexDiffAvailable = false;
          noConflicts = true;
        } else {
          indexDiffAvailable = true;
          noConflicts = indexDiff.getConflicting().isEmpty();
        }

        if (repositoryChanged) {
          // Reset paths, they're from the old repository
          resetPathsToExpand();
View Full Code Here

        for (StagingEntry entry : content)
          if (entry.getPath().equals(res))
            nodes.remove(entry);
    }

    final IndexDiffData indexDiff = update.indexDiff;
    if (unstagedSection) {
      for (String file : indexDiff.getMissing())
        if (indexDiff.getChanged().contains(file))
          nodes.add(new StagingEntry(repository, MISSING_AND_CHANGED,
              file));
        else
          nodes.add(new StagingEntry(repository, MISSING, file));
      for (String file : indexDiff.getModified())
        if (indexDiff.getChanged().contains(file))
          nodes.add(new StagingEntry(repository, MODIFIED_AND_CHANGED,
              file));
        else if (indexDiff.getAdded().contains(file))
          nodes.add(new StagingEntry(repository, MODIFIED_AND_ADDED,
              file));
        else
          nodes.add(new StagingEntry(repository, MODIFIED, file));
      for (String file : indexDiff.getUntracked())
        nodes.add(new StagingEntry(repository, UNTRACKED, file));
      for (String file : indexDiff.getConflicting())
        nodes.add(new StagingEntry(repository, CONFLICTING, file));
    } else {
      for (String file : indexDiff.getAdded())
        nodes.add(new StagingEntry(repository, ADDED, file));
      for (String file : indexDiff.getChanged())
        nodes.add(new StagingEntry(repository, CHANGED, file));
      for (String file : indexDiff.getRemoved())
        nodes.add(new StagingEntry(repository, REMOVED, file));
    }

    try {
    SubmoduleWalk walk = SubmoduleWalk.forIndex(repository);
View Full Code Here

    IndexDiffCacheEntry entry = Activator.getDefault()
        .getIndexDiffCache().getIndexDiffCacheEntry(repository);
    if (entry == null)
      return false;

    IndexDiffData diff = entry.getIndexDiff();
    if (diff == null)
      return false;

    if (diff.getAdded().isEmpty() && diff.getChanged().isEmpty()
        && diff.getRemoved().isEmpty() && diff.getUntracked().isEmpty()
        && diff.getModified().isEmpty() && diff.getMissing().isEmpty())
      return false;

    return true;
  }
View Full Code Here

  private boolean isWorkingTreeClean() {
    IndexDiffCache diffCache = org.eclipse.egit.core.Activator.getDefault()
        .getIndexDiffCache();
    if (diffCache != null) {
      IndexDiffData diffData = diffCache.getIndexDiffCacheEntry(
          repository).getIndexDiff();
      if (diffData != null) {
        Set<String> modified = diffData.getModified();
        Set<String> untracked = diffData.getUntracked();
        Set<String> missing = diffData.getMissing();
        for (IResource resource : resources) {
          String repoRelativePath = makeRepoRelative(resource);
          if (containsPrefix(modified, repoRelativePath))
            return false;
          if (containsPrefix(untracked, repoRelativePath))
View Full Code Here

        new TestDecoratableResource(project).tracked(),
        new TestDecoratableResource(folder).ignored(),
        new TestDecoratableResource(subFolder).ignored() };

    waitForIndexDiffUpdate(true);
    IndexDiffData indexDiffData = indexDiffCacheEntry.getIndexDiff();
    IDecoratableResource[] actualDRs = {
        new DecoratableResourceAdapter(indexDiffData, project),
        new DecoratableResourceAdapter(indexDiffData, folder),
        new DecoratableResourceAdapter(indexDiffData, subFolder) };
View Full Code Here

TOP

Related Classes of org.eclipse.egit.core.internal.indexdiff.IndexDiffData

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.