use of com.intellij.vcs.log.Hash in project intellij-community by JetBrains.
the class HashEqualsTest method testEqualsNone.
@Test
public void testEqualsNone() {
Hash hash1 = HashImpl.build("");
Hash hash2 = HashImpl.build("");
assertThat(hash1).isEqualTo(hash2);
}
use of com.intellij.vcs.log.Hash in project intellij-community by JetBrains.
the class DataPack method build.
@NotNull
public static DataPack build(@NotNull List<? extends GraphCommit<Integer>> commits, @NotNull Map<VirtualFile, CompressedRefs> refs, @NotNull Map<VirtualFile, VcsLogProvider> providers, @NotNull VcsLogStorage storage, boolean full) {
RefsModel refsModel;
PermanentGraph<Integer> permanentGraph;
if (commits.isEmpty()) {
refsModel = new RefsModel(refs, ContainerUtil.newHashSet(), storage, providers);
permanentGraph = EmptyPermanentGraph.getInstance();
} else {
refsModel = new RefsModel(refs, getHeads(commits), storage, providers);
Function<Integer, Hash> hashGetter = VcsLogStorageImpl.createHashGetter(storage);
GraphColorManagerImpl colorManager = new GraphColorManagerImpl(refsModel, hashGetter, getRefManagerMap(providers));
Set<Integer> branches = getBranchCommitHashIndexes(refsModel.getBranches(), storage);
StopWatch sw = StopWatch.start("building graph");
permanentGraph = PermanentGraphImpl.newInstance(commits, colorManager, branches);
sw.report();
}
return new DataPack(refsModel, permanentGraph, providers, full);
}
use of com.intellij.vcs.log.Hash in project intellij-community by JetBrains.
the class MqPatchTest method assertEqualsCommitInfo.
private void assertEqualsCommitInfo(@Nullable TimedVcsCommit logCommit, MqPatchDetails details) {
if (logCommit != null) {
List<Hash> parents = logCommit.getParents();
assertEquals(logCommit.getId().asString(), details.getNodeId());
assertEquals(!ContainerUtil.isEmpty(parents) ? parents.get(0).asString() : null, details.getParent());
assertEquals(new Date(logCommit.getTimestamp()), details.getDate());
assertEquals(BRANCH, details.getBranch());
}
assertEquals(MESSAGE, details.getMessage());
assertEquals(myHgRepository.getRepositoryConfig().getNamedConfig("ui", "username"), details.getUser());
}
use of com.intellij.vcs.log.Hash in project intellij-community by JetBrains.
the class HgLogHistoryTest method testContainedInBranchesInLogInfos.
public void testContainedInBranchesInLogInfos() throws VcsException {
createBookmarksAndBranches(myRepository);
Hash testHashForFirstCommit = HashImpl.build("0");
Collection<String> branches = HgHistoryUtil.getDescendingHeadsOfBranches(myProject, myRepository, testHashForFirstCommit);
//B_Bookmark should not be listed - it is inactive and not head//
VcsTestUtil.assertEqualCollections(branches, Arrays.asList("default", "branchA", "branchB", "A_BookMark", "C_BookMark"));
}
use of com.intellij.vcs.log.Hash in project intellij-community by JetBrains.
the class GitRepositoryReader method createBranchesFromData.
@NotNull
private static Pair<Map<GitLocalBranch, Hash>, Map<GitRemoteBranch, Hash>> createBranchesFromData(@NotNull Collection<GitRemote> remotes, @NotNull Map<String, Hash> data) {
Map<GitLocalBranch, Hash> localBranches = ContainerUtil.newHashMap();
Map<GitRemoteBranch, Hash> remoteBranches = ContainerUtil.newHashMap();
for (Map.Entry<String, Hash> entry : data.entrySet()) {
String refName = entry.getKey();
Hash hash = entry.getValue();
if (refName.startsWith(REFS_HEADS_PREFIX)) {
localBranches.put(new GitLocalBranch(refName), hash);
} else if (refName.startsWith(REFS_REMOTES_PREFIX)) {
GitRemoteBranch remoteBranch = parseRemoteBranch(refName, remotes);
if (remoteBranch != null) {
remoteBranches.put(remoteBranch, hash);
}
} else {
LOG.warn("Unexpected ref format: " + refName);
}
}
return Pair.create(localBranches, remoteBranches);
}
Aggregations