Search in sources :

Example 1 with AbstractHash

use of git4idea.history.wholeTree.AbstractHash in project intellij-community by JetBrains.

the class AbstractHashTest method testLeadingNulls.

public void testLeadingNulls() throws Exception {
    final String hash0 = "0";
    final AbstractHash abstractHash0 = AbstractHash.create(hash0);
    Assert.assertFalse(abstractHash0.getClass().getName().contains("AbstractHash.StringPresentation"));
    Assert.assertEquals(hash0, abstractHash0.getString());
    final String hash = "0f";
    final AbstractHash abstractHash = AbstractHash.create(hash);
    Assert.assertFalse(abstractHash.getClass().getName().contains("AbstractHash.StringPresentation"));
    Assert.assertEquals(hash, abstractHash.getString());
    final String hash1 = "001";
    final AbstractHash abstractHash1 = AbstractHash.create(hash1);
    Assert.assertFalse(abstractHash1.getClass().getName().contains("AbstractHash.StringPresentation"));
    Assert.assertEquals(hash1, abstractHash1.getString());
    final String hash2 = "000";
    final AbstractHash abstractHash2 = AbstractHash.create(hash2);
    Assert.assertFalse(abstractHash2.getClass().getName().contains("AbstractHash.StringPresentation"));
    Assert.assertEquals(hash2, abstractHash2.getString());
}
Also used : AbstractHash(git4idea.history.wholeTree.AbstractHash)

Example 2 with AbstractHash

use of git4idea.history.wholeTree.AbstractHash in project intellij-community by JetBrains.

the class AbstractHashTest method testShort.

public void testShort() throws Exception {
    final String hash = "f";
    final AbstractHash abstractHash = AbstractHash.create(hash);
    Assert.assertFalse(abstractHash.getClass().getName().contains("AbstractHash.StringPresentation"));
    Assert.assertEquals(hash, abstractHash.getString());
    final String hash1 = "ff";
    final AbstractHash abstractHash1 = AbstractHash.create(hash1);
    Assert.assertFalse(abstractHash1.getClass().getName().contains("AbstractHash.StringPresentation"));
    Assert.assertEquals(hash1, abstractHash1.getString());
}
Also used : AbstractHash(git4idea.history.wholeTree.AbstractHash)

Example 3 with AbstractHash

use of git4idea.history.wholeTree.AbstractHash in project intellij-community by JetBrains.

the class GitChangesParser method prepareParentRevisions.

private static List<GitRevisionNumber> prepareParentRevisions(List<String> parentsHashes) {
    final List<AbstractHash> parents = new ArrayList<>(parentsHashes.size());
    for (String parentsShortHash : parentsHashes) {
        parents.add(AbstractHash.create(parentsShortHash));
    }
    final List<GitRevisionNumber> parentRevisions = new ArrayList<>(parents.size());
    for (AbstractHash parent : parents) {
        parentRevisions.add(new GitRevisionNumber(parent.getString()));
    }
    return parentRevisions;
}
Also used : GitRevisionNumber(git4idea.GitRevisionNumber) ArrayList(java.util.ArrayList) AbstractHash(git4idea.history.wholeTree.AbstractHash)

Example 4 with AbstractHash

use of git4idea.history.wholeTree.AbstractHash in project intellij-community by JetBrains.

the class AbstractHashTest method testLong.

public void testLong() throws Exception {
    final String hash = "0123456789abcdef0123456789abcdef01234567";
    final AbstractHash abstractHash = AbstractHash.create(hash);
    Assert.assertFalse(abstractHash.getClass().getName().contains("AbstractHash.StringPresentation"));
    Assert.assertEquals(hash, abstractHash.getString());
}
Also used : AbstractHash(git4idea.history.wholeTree.AbstractHash)

Example 5 with AbstractHash

use of git4idea.history.wholeTree.AbstractHash in project intellij-community by JetBrains.

the class AbstractHashTest method testSimple.

public void testSimple() throws Exception {
    final String hash = "0a5b9f";
    final AbstractHash abstractHash = AbstractHash.create(hash);
    Assert.assertFalse(abstractHash.getClass().getName().contains("AbstractHash.StringPresentation"));
    Assert.assertEquals(hash, abstractHash.getString());
}
Also used : AbstractHash(git4idea.history.wholeTree.AbstractHash)

Aggregations

AbstractHash (git4idea.history.wholeTree.AbstractHash)5 GitRevisionNumber (git4idea.GitRevisionNumber)1 ArrayList (java.util.ArrayList)1