Package org.eclipse.egit.core.synchronize.GitCommitsModelCache

Examples of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change


      tw.setRecursive(true);

      Map<String, Change> result = new HashMap<String, Change>();
      MutableObjectId idBuf = new MutableObjectId();
      while (tw.next()) {
        Change change = new Change();
        change.name = tw.getNameString();
        tw.getObjectId(idBuf, 0);
        change.objectId = AbbreviatedObjectId.fromObjectId(idBuf);
        tw.getObjectId(idBuf, 1);
        change.remoteObjectId = AbbreviatedObjectId.fromObjectId(idBuf);
View Full Code Here


    final Map<IPath, Node> nodes = new HashMap<IPath, Node>();

    for (Map.Entry<String, Change> entry : changes.entrySet()) {
      String repoRelativePath = entry.getKey();
      Change change = entry.getValue();

      GitModelObjectContainer parent = root;
      List<GitModelObject> children = rootChildren;
      IPath path = rootPath;

      String[] segments = repoRelativePath.split("/"); //$NON-NLS-1$

      for (int i = 0; i < segments.length; i++) {
        path = path.append(segments[i]);

        // Changes represent files, so the last segment is the file name
        boolean fileNode = (i == segments.length - 1);
        if (!fileNode) {
          Node node = nodes.get(path);
          if (node == null) {
            GitModelTree tree = treeFactory.createTreeModel(parent,
                path, change.getKind());
            node = new Node(tree);
            nodes.put(path, node);
            children.add(tree);
          }
          parent = node.tree;
View Full Code Here

    return createGitModelBlob(baseId, null, location);
  }

  private GitModelBlob createGitModelBlob(ObjectId baseId, ObjectId remoteId,
      IPath location) throws Exception {
    Change change = mock(Change.class);
    if (baseId != null)
      when(change.getObjectId()).thenReturn(
          AbbreviatedObjectId.fromObjectId(baseId));
    if (remoteId != null)
      when(change.getRemoteObjectId()).thenReturn(
          AbbreviatedObjectId.fromObjectId(remoteId));

    return new GitModelBlob(createModelCommit(),
        lookupRepository(leftRepoFile), change, location);
  }
View Full Code Here

      Map<String, Change> result = new HashMap<String, Change>();
      while(tw.next()) {
        if (!shouldIncludeEntry(tw))
          continue;

        Change change = new Change();
        change.name = tw.getNameString();
        change.remoteCommitId = commitId;

        tw.getObjectId(idBuf, 0);
        change.objectId = AbbreviatedObjectId.fromObjectId(idBuf);
View Full Code Here

  }

  @Test
  public void shouldBeEqualWhenBothObjectIdsAndRemoteIdsAreSame() {
    // given
    Change c1 = new Change();
    Change c2 = new Change();
    c1.objectId = c2.objectId = ZERO_ID;
    c1.remoteObjectId = c2.remoteObjectId = MISC_ID;

    // when
    boolean result = c1.equals(c2);

    // then
    assertTrue(result);
    assertEquals(c1.hashCode(), c2.hashCode());
  }
View Full Code Here

      .fromString("63448b851ae8831a1ad007f588508d3246ec7ace");

  @Test
  public void shouldNotBeEqualWithNullRefference() {
    // given
    Change change = new Change();

    // when
    boolean result = change.equals(null);

    // then
    assertFalse(result);
  }
View Full Code Here

  }

  @Test
  public void shouldNotBeEqualWithDifferentType() {
    // given
    Change change = new Change();

    // when
    boolean result = change.equals(new Object());

    // then
    assertFalse(result);
  }
View Full Code Here

  }

  @Test
  public void shouldBeEqualWhenBothIdsAreNull() {
    // given
    Change change = new Change();

    // when
    boolean result = change.equals(new Change());

    // then
    assertTrue(result);
  }
View Full Code Here

  }

  @Test
  public void shouldNotBeEqualWhenOneObjectIdIsNull() {
    // given
    Change change = new Change();
    change.objectId = ZERO_ID;

    // when
    boolean result = change.equals(new Change());

    // then
    assertFalse(result);
  }
View Full Code Here

  }

  @Test
  public void shouldBeEqualWhenBothObjectIdsAreTheSame() {
    // given
    Change c1 = new Change();
    Change c2 = new Change();
    c1.objectId = c2.objectId = MISC_ID;

    // when
    boolean result = c1.equals(c2);

    // then
    assertTrue(result);
    assertEquals(c1.hashCode(), c2.hashCode());
  }
View Full Code Here

TOP

Related Classes of org.eclipse.egit.core.synchronize.GitCommitsModelCache.Change

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.