Package org.eclipse.team.core.history

Examples of org.eclipse.team.core.history.IFileRevision


      gitPath = map.getRepoRelativePath(resource);
      Iterator<?> it = selection.iterator();
      while (it.hasNext()) {
        RevCommit commit = (RevCommit) it.next();
        String commitPath = getRenamedPath(gitPath, commit);
        IFileRevision rev = null;
        try {
          rev = CompareUtils.getFileRevision(commitPath, commit,
              map.getRepository(), null);
        } catch (IOException e) {
          Activator.logError(NLS.bind(
              UIText.GitHistoryPage_errorLookingUpPath, gitPath,
              commit.getId()), e);
          errorOccurred = true;
        }
        if (rev != null) {
          if (compareMode) {
            ITypedElement right = CompareUtils
                .getFileRevisionTypedElement(commitPath,
                    commit, map.getRepository());
            final GitCompareFileRevisionEditorInput in = new GitCompareFileRevisionEditorInput(
                SaveableCompareEditorInput
                    .createFileElement(resource), right,
                null);
            try {
              CompareUtils.openInCompare(workBenchPage, in);
            } catch (Exception e) {
              errorOccurred = true;
            }
          } else
            try {
              EgitUiEditorUtils.openEditor(getPart(event)
                  .getSite().getPage(), rev,
                  new NullProgressMonitor());
            } catch (CoreException e) {
              Activator.logError(
                  UIText.GitHistoryPage_openFailed, e);
              errorOccurred = true;
            }
        } else
          ids.add(commit.getId());
      }
    }
    if (input instanceof File) {
      File fileInput = (File) input;
      Repository repo = getRepository(event);
      gitPath = getRepoRelativePath(repo, fileInput);
      Iterator<?> it = selection.iterator();
      while (it.hasNext()) {
        RevCommit commit = (RevCommit) it.next();
        String commitPath = getRenamedPath(gitPath, commit);
        IFileRevision rev = null;
        try {
          rev = CompareUtils.getFileRevision(commitPath, commit,
              repo, null);
        } catch (IOException e) {
          Activator.logError(NLS.bind(
View Full Code Here


      gitPath = map.getRepoRelativePath(resource);
      Iterator<?> it = selection.iterator();
      while (it.hasNext()) {
        RevCommit commit = (RevCommit) it.next();
        String commitPath = getRenamedPath(gitPath, commit);
        IFileRevision rev = null;
        try {
          rev = CompareUtils.getFileRevision(commitPath, commit,
              map.getRepository(), null);
        } catch (IOException e) {
          Activator.logError(NLS.bind(
              UIText.GitHistoryPage_errorLookingUpPath,
              commitPath, commit.getId()), e);
          errorOccurred = true;
        }
        if (rev != null)
          try {
            EgitUiEditorUtils.openTextEditor(getPart(event)
                .getSite().getPage(), rev, null);
          } catch (CoreException e) {
            Activator.logError(e.getMessage(), e);
            errorOccurred = true;
          }
        else
          ids.add(commit.getId());
      }
    }
    if (input instanceof File) {
      Repository repo = getRepository(event);
      File fileInput = (File) input;
      gitPath = getRepoRelativePath(repo, fileInput);
      Iterator<?> it = selection.iterator();
      while (it.hasNext()) {
        RevCommit commit = (RevCommit) it.next();
        String commitPath = getRenamedPath(gitPath, commit);
        IFileRevision rev = null;
        try {
          rev = CompareUtils.getFileRevision(commitPath, commit,
              repo, null);
        } catch (IOException e) {
          Activator.logError(NLS.bind(
View Full Code Here

    RevCommit commit = getSelectedCommit(event);
    if (commit == null)
      return null;

    try {
      IFileRevision revision = CompareUtils.getFileRevision(path, commit,
          repo, null);
      if (revision == null)
        return null;

      IStorage storage = revision.getStorage(new NullProgressMonitor());
      BlameOperation op = new BlameOperation(repo, storage, path, commit,
          HandlerUtil.getActiveShell(event), page.getSite().getPage());
      JobUtil.scheduleUserJob(op, UIText.ShowBlameHandler_JobName,
          JobFamilies.BLAME);
    } catch (IOException e) {
View Full Code Here

  public void testSingleRevision_1() {
    GitProvider provider = (GitProvider)RepositoryProvider.getProvider(project.project);
    assertNotNull(provider);
    IFileHistoryProvider fileHistoryProvider = provider.getFileHistoryProvider();
    IFileHistory fileHistory = fileHistoryProvider.getFileHistoryFor(project.getProject().getWorkspace().getRoot().findMember("Project-1/A.txt"), IFileHistoryProvider.SINGLE_LINE_OF_DESCENT, new NullProgressMonitor());
    IFileRevision fileRevision = fileHistory.getFileRevision("60f0d7917fe2aed5c92b5bc35dfb55b9b8ada359");
    assertEquals("60f0d7917fe2aed5c92b5bc35dfb55b9b8ada359", fileRevision.getContentIdentifier());
    assertEquals("J. Author",fileRevision.getAuthor());
  }
View Full Code Here

  public void testSingleRevision_2() {
    GitProvider provider = (GitProvider)RepositoryProvider.getProvider(project.project);
    assertNotNull(provider);
    IFileHistoryProvider fileHistoryProvider = provider.getFileHistoryProvider();
    IFileHistory fileHistory = fileHistoryProvider.getFileHistoryFor(project.getProject().getWorkspace().getRoot().findMember("Project-1/A.txt"), IFileHistoryProvider.SINGLE_LINE_OF_DESCENT, new NullProgressMonitor());
    IFileRevision fileRevision = fileHistory.getFileRevision("fd5a571c8a3a4a152e4c413d09d3ecb7d41e1e5f");
    assertNull(fileRevision); // not matched by getFileHistoryFor
  }
View Full Code Here

  public void testSingleRevision_3() {
    GitProvider provider = (GitProvider)RepositoryProvider.getProvider(project.project);
    assertNotNull(provider);
    IFileHistoryProvider fileHistoryProvider = provider.getFileHistoryProvider();
    IFileHistory fileHistory = fileHistoryProvider.getFileHistoryFor(project.getProject().getWorkspace().getRoot().findMember("Project-1/B.txt"), IFileHistoryProvider.SINGLE_LINE_OF_DESCENT, new NullProgressMonitor());
    IFileRevision fileRevision = fileHistory.getFileRevision("fd5a571c8a3a4a152e4c413d09d3ecb7d41e1e5f");
    assertEquals("fd5a571c8a3a4a152e4c413d09d3ecb7d41e1e5f", fileRevision.getContentIdentifier());
    assertEquals("J. Author",fileRevision.getAuthor());
  }
View Full Code Here

  public void testIndexRevision() throws Exception {
    GitProvider provider = (GitProvider)RepositoryProvider.getProvider(project.project);
    assertNotNull(provider);
    IFileHistoryProvider fileHistoryProvider = provider.getFileHistoryProvider();
    IFileHistory fileHistory = fileHistoryProvider.getFileHistoryFor(project.getProject().getWorkspace().getRoot().findMember("Project-1/A.txt"), IFileHistoryProvider.SINGLE_LINE_OF_DESCENT, new NullProgressMonitor());
    IFileRevision fileRevision = fileHistory.getFileRevision(GitFileRevision.INDEX);
    assertEquals(GitFileRevision.INDEX, fileRevision.getContentIdentifier());
    IStorage storage = fileRevision.getStorage(null);
    String content = testUtils.slurpAndClose(storage.getContents());
    assertEquals("A.txt - first version\n", content);
  }
View Full Code Here

  public void testIndexRevisionSecondCommit() throws Exception {
    GitProvider provider = (GitProvider)RepositoryProvider.getProvider(project.project);
    assertNotNull(provider);
    IFileHistoryProvider fileHistoryProvider = provider.getFileHistoryProvider();
    IFileHistory fileHistory = fileHistoryProvider.getFileHistoryFor(project.getProject().getWorkspace().getRoot().findMember("Project-1/B.txt"), IFileHistoryProvider.SINGLE_LINE_OF_DESCENT, new NullProgressMonitor());
    IFileRevision fileRevision = fileHistory.getFileRevision(GitFileRevision.INDEX);
    assertEquals(GitFileRevision.INDEX, fileRevision.getContentIdentifier());
    IStorage storage = fileRevision.getStorage(null);
    String content = testUtils.slurpAndClose(storage.getContents());
    assertEquals("B.txt - second version\n", content);
  }
View Full Code Here

    final IFileHistory history = historyProvider.getFileHistoryFor(iFile1,
        IFileHistoryProvider.NONE, new NullProgressMonitor());
    assertNotNull(history);

    final IFileRevision[] revisions = history.getFileRevisions();
    IFileRevision branchFileRevision1 = null;
    IFileRevision masterFileRevision3 = null;
    IFileRevision masterFileRevision1 = null;
    for (IFileRevision revision : revisions) {
      final String revisionId = revision.getContentIdentifier();
      if (branchCommit1.getName().equals(revisionId))
        branchFileRevision1 = revision;
      else if (masterCommit3.getName().equals(revisionId))
View Full Code Here

    final IFileHistory history = historyProvider.getFileHistoryFor(iFile2,
        IFileHistoryProvider.NONE, new NullProgressMonitor());
    assertNotNull(history);

    final IFileRevision[] revisions = history.getFileRevisions();
    IFileRevision masterFileRevision3 = null;
    IFileRevision masterFileRevision2 = null;
    IFileRevision branchFileRevision2 = null;
    for (IFileRevision revision : revisions) {
      final String revisionId = revision.getContentIdentifier();
      if (masterCommit3.getName().equals(revisionId))
        masterFileRevision3 = revision;
      else if (masterCommit2.getName().equals(revisionId))
View Full Code Here

TOP

Related Classes of org.eclipse.team.core.history.IFileRevision

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.