Search in sources :

Example 16 with Hash

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);
}
Also used : Hash(com.intellij.vcs.log.Hash) Test(org.junit.Test)

Example 17 with Hash

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);
}
Also used : GraphColorManagerImpl(com.intellij.vcs.log.graph.GraphColorManagerImpl) Hash(com.intellij.vcs.log.Hash) StopWatch(com.intellij.vcs.log.util.StopWatch) NotNull(org.jetbrains.annotations.NotNull)

Example 18 with Hash

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());
}
Also used : Hash(com.intellij.vcs.log.Hash) Date(java.util.Date)

Example 19 with Hash

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"));
}
Also used : Hash(com.intellij.vcs.log.Hash)

Example 20 with Hash

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);
}
Also used : Hash(com.intellij.vcs.log.Hash) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Hash (com.intellij.vcs.log.Hash)21 NotNull (org.jetbrains.annotations.NotNull)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 Test (org.junit.Test)4 VcsRef (com.intellij.vcs.log.VcsRef)2 GitRepository (git4idea.repo.GitRepository)2 HgNameWithHashInfo (org.zmlx.hg4idea.HgNameWithHashInfo)2 RepoStateException (com.intellij.dvcs.repo.RepoStateException)1 AccessToken (com.intellij.openapi.application.AccessToken)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1 Project (com.intellij.openapi.project.Project)1 FilePath (com.intellij.openapi.vcs.FilePath)1 VcsException (com.intellij.openapi.vcs.VcsException)1 Change (com.intellij.openapi.vcs.changes.Change)1 MultiMap (com.intellij.util.containers.MultiMap)1 CommitId (com.intellij.vcs.log.CommitId)1 GraphColorManagerImpl (com.intellij.vcs.log.graph.GraphColorManagerImpl)1 StopWatch (com.intellij.vcs.log.util.StopWatch)1 GitLocalBranch (git4idea.GitLocalBranch)1