Package org.eclipse.egit.ui.internal.synchronize.model

Examples of org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit


  public StyledString getStyledText(Object element) {
    // need to compare classes as everything is 'instanceof GitModelCommit'
    if (element.getClass().equals(GitModelCommit.class)) {
      String formattedName = createChangeSetLabel((GitModelCommit) element);
      StyledString string = new StyledString(formattedName);
      GitModelCommit commit = (GitModelCommit) element;
      String format = " [" + getAbbreviatedId(commit) + "]"; //$NON-NLS-1$//$NON-NLS-2$
      string.append(format, StyledString.DECORATIONS_STYLER);
      return string;
    }
View Full Code Here


  @Test public void workingTreeShouldBeLessThanCommit() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelCommit commit = mock(GitModelCommit.class);
    GitModelWorkingTree workingTree = mock(GitModelWorkingTree.class);

    // when
    int actual = sorter.compare(viewer, workingTree, commit);
View Full Code Here

  @Test public void cacheTreeShouldBeLessThanCommit() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelCache cache = mock(GitModelCache.class);
    GitModelCommit commit = mock(GitModelCommit.class);

    // when
    int actual = sorter.compare(viewer, cache, commit);

    // then
View Full Code Here

   */
  @Test public void commitTreeShouldBeGreaterThanWorkingTree() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelCommit commit = mock(GitModelCommit.class);
    GitModelWorkingTree workingTree = mock(GitModelWorkingTree.class);

    // when
    int actual = sorter.compare(viewer, commit, workingTree);

View Full Code Here

  @Test public void commitTreeShouldBeGreaterThanCache() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelCommit commit = mock(GitModelCommit.class);
    GitModelCache cache = mock(GitModelCache.class);

    // when
    int actual = sorter.compare(viewer, commit, cache);
View Full Code Here

  @Test public void commitTreeShouldBeLessThanBlob() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelCommit commit = mock(GitModelCommit.class);
    GitModelBlob blob = mock(GitModelBlob.class);

    // when
    int actual = sorter.compare(viewer, commit, blob);
View Full Code Here

  @Test public void treeShouldBeGreaterThanCommit() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelTree tree = mock(GitModelTree.class);
    GitModelCommit commit = mock(GitModelCommit.class);

    // when
    int actual = sorter.compare(viewer, tree, commit);

    // then
View Full Code Here

  @Test public void blobShouldBeGreaterThanCommit() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelBlob blob = mock(GitModelBlob.class);
    GitModelCommit commit = mock(GitModelCommit.class);

    // when
    int actual = sorter.compare(viewer, blob, commit);

    // then
View Full Code Here

   */
  @Test public void shouldOrderCommitsByCommitDate() {
    // given
    Viewer viewer = mock(Viewer.class);
    GitChangeSetSorter sorter = new GitChangeSetSorter();
    GitModelCommit commit1 = mock(GitModelCommit.class);
    GitModelCommit commit2 = mock(GitModelCommit.class);
    Commit mockCommit1 = mock(Commit.class);
    Commit mockCommit2 = mock(Commit.class);
    when(mockCommit1.getCommitDate()).thenReturn(new Date(333333L));
    when(mockCommit2.getCommitDate()).thenReturn(new Date(555555L));
    when(commit1.getCachedCommitObj()).thenReturn(mockCommit1);
    when(commit2.getCachedCommitObj()).thenReturn(mockCommit2);

    // when
    int actual1 = sorter.compare(viewer, commit1, commit2);
    int actual2 = sorter.compare(viewer, commit2, commit1);

View Full Code Here

  private static RevCommit getCommitForElement(Object element) {
    RevCommit commit = null;
    if (element instanceof RevCommit)
      commit = (RevCommit) element;
    else if (element instanceof GitModelCommit) {
      GitModelCommit modelCommit = (GitModelCommit) element;
      if (!(modelCommit.getParent() instanceof GitModelRepository))
        return null; // should never happen

      GitModelRepository parent = (GitModelRepository) modelCommit.getParent();
      Repository repo = parent.getRepository();
      AbbreviatedObjectId id = modelCommit.getCachedCommitObj().getId();

      commit = new RevWalk(repo).lookupCommit(id.toObjectId());
    }
    return commit;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.egit.ui.internal.synchronize.model.GitModelCommit

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.