com.intellij.vcs.log.Hash Java Examples
The following examples show how to use
com.intellij.vcs.log.Hash.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CreateBranchModelTest.java From azure-devops-intellij with MIT License | 6 votes |
private void mockGitRepoInfo(GitRemoteBranch... remoteBranches) { HashMap<GitRemoteBranch, Hash> remoteBranchMap = Maps.newHashMap(); for (GitRemoteBranch remoteBranch : remoteBranches) { remoteBranchMap.put(remoteBranch, null); } GitRepoInfo gitRepoInfo = new GitRepoInfo( null, null, Repository.State.NORMAL, Collections.emptyList(), Collections.emptyMap(), remoteBranchMap, Collections.emptyList(), Collections.emptyList(), new GitHooksInfo(false, false), false ); when(mockGitRepository.getInfo()).thenReturn(gitRepoInfo); }
Example #2
Source File: CreatePullRequestModelTest.java From azure-devops-intellij with MIT License | 6 votes |
private void mockGitRepoBranches(GitLocalBranch currentBranch, GitRemoteBranch... remoteBranches) { HashMap<GitRemoteBranch, Hash> remoteBranchMap = Maps.newHashMap(); for (GitRemoteBranch remoteBranch : remoteBranches) { remoteBranchMap.put(remoteBranch, null); } GitRepoInfo gitRepoInfo = new GitRepoInfo( currentBranch, null, Repository.State.NORMAL, Collections.emptyList(), Collections.emptyMap(), remoteBranchMap, Collections.emptyList(), Collections.emptyList(), new GitHooksInfo(false, false), false ); when(gitRepositoryMock.getInfo()).thenReturn(gitRepoInfo); }
Example #3
Source File: InfoCacheGateway.java From GitToolBox with Apache License 2.0 | 6 votes |
private RepoStatusRemote createRemoteStatus(@NotNull GitRepository repository, @NotNull GitLocalBranch localBranch) { GitToolBoxConfigPrj config = ProjectConfig.get(project); GitRemoteBranch trackedBranch = localBranch.findTrackedBranch(repository); GitRemoteBranch parentBranch = null; GitRepoInfo repoInfo = repository.getInfo(); ReferencePointForStatusType type = config.getReferencePointForStatus().getType(); if (type == ReferencePointForStatusType.TRACKED_REMOTE_BRANCH) { parentBranch = trackedBranch; } else if (type == ReferencePointForStatusType.SELECTED_PARENT_BRANCH) { parentBranch = findRemoteParent(repository, config.getReferencePointForStatus().getName()).orElse(null); } else if (type == ReferencePointForStatusType.AUTOMATIC) { parentBranch = getRemoteBranchFromActiveTask(repository).orElse(trackedBranch); } Hash parentHash = repoInfo.getRemoteBranchesWithHashes() .get(parentBranch); return new RepoStatusRemote(trackedBranch, parentBranch, parentHash); }
Example #4
Source File: VcsChangesLazilyParsedDetails.java From consulo with Apache License 2.0 | 5 votes |
public VcsChangesLazilyParsedDetails(@Nonnull Hash hash, @Nonnull List<Hash> parents, long commitTime, @Nonnull VirtualFile root, @Nonnull String subject, @Nonnull VcsUser author, @Nonnull String message, @Nonnull VcsUser committer, long authorTime, @Nonnull ThrowableComputable<Collection<Change>, ? extends Exception> changesGetter) { super(hash, parents, commitTime, root, subject, author, message, committer, authorTime); myChangesGetter = changesGetter; }
Example #5
Source File: HashImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public static Hash read(@Nonnull DataInput in) throws IOException { int length = DataInputOutputUtil.readINT(in); if (length == 0) throw new IOException("Can not read hash: data length is zero"); byte[] buf = new byte[length]; in.readFully(buf); return new HashImpl(buf); }
Example #6
Source File: VcsShortCommitDetailsImpl.java From consulo with Apache License 2.0 | 5 votes |
public VcsShortCommitDetailsImpl(@Nonnull Hash hash, @Nonnull List<Hash> parents, long commitTime, @Nonnull VirtualFile root, @Nonnull String subject, @Nonnull VcsUser author, @Nonnull VcsUser committer, long authorTime) { super(hash, parents, commitTime); myRoot = root; mySubject = subject; myAuthor = author; myCommitter = committer; myAuthorTime = authorTime; }
Example #7
Source File: VcsRefImpl.java From consulo with Apache License 2.0 | 5 votes |
public VcsRefImpl(@Nonnull Hash commitHash, @Nonnull String name, @Nonnull VcsRefType type, @Nonnull VirtualFile root) { myCommitHash = commitHash; myType = type; myRoot = root; synchronized (ourNames) { myName = ourNames.intern(name); } }
Example #8
Source File: GraphColorManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
public GraphColorManagerImpl(@Nonnull RefsModel refsModel, @Nonnull Function<Integer, Hash> hashGetter, @Nonnull Map<VirtualFile, VcsLogRefManager> refManagers) { myRefsModel = refsModel; myHeadsComparator = new HeadsComparator(refsModel, refManagers, hashGetter); }
Example #9
Source File: GraphColorManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
public HeadsComparator(@Nonnull RefsModel refsModel, @Nonnull Map<VirtualFile, VcsLogRefManager> refManagers, @Nonnull Function<Integer, Hash> hashGetter) { myRefsModel = refsModel; myRefManagers = refManagers; myHashGetter = hashGetter; }
Example #10
Source File: CachedStatusCalculator.java From GitToolBox with Apache License 2.0 | 5 votes |
private List<String> calculateTags(@NotNull GitRepository repository, @Nullable Hash localHash) { GitTagCalculator tagCalculator = GitTagCalculator.create(repository.getProject()); if (localHash == null) { return tagCalculator.tagsForHead(repository.getRoot()); } else { return tagCalculator.tagsForCommit(repository.getRoot(), localHash); } }
Example #11
Source File: InfoCacheGateway.java From GitToolBox with Apache License 2.0 | 5 votes |
@NotNull RepoStatus createRepoStatus(@NotNull GitRepository repository) { Hash localHash = null; RepoStatusRemote remote = RepoStatusRemote.empty(); GitLocalBranch localBranch = repository.getCurrentBranch(); if (localBranch != null) { GitRepoInfo repoInfo = repository.getInfo(); localHash = repoInfo.getLocalBranchesWithHashes() .get(localBranch); remote = createRemoteStatus(repository, localBranch); } return RepoStatus.create(localBranch, localHash, remote); }
Example #12
Source File: GitStatusCalculator.java From GitToolBox with Apache License 2.0 | 5 votes |
@NotNull public GitAheadBehindCount aheadBehindStatus(@NotNull GitRepository repository, @Nullable Hash localHash, @Nullable Hash remoteHash) { if (localHash != null && remoteHash != null) { return doRevListLeftRight(localHash.asString(), remoteHash.asString(), repository); } else { return GitAheadBehindCount.noRemote(); } }
Example #13
Source File: VcsCherryPickAction.java From consulo with Apache License 2.0 | 5 votes |
@Override public void update(@Nonnull AnActionEvent e) { super.update(e); e.getPresentation().setVisible(true); final VcsLog log = e.getData(VcsLogDataKeys.VCS_LOG); Project project = e.getProject(); if (project == null) { e.getPresentation().setEnabledAndVisible(false); return; } VcsCherryPickManager cherryPickManager = VcsCherryPickManager.getInstance(project); List<VcsCherryPicker> cherryPickers = getActiveCherryPickersForProject(project); if (log == null || cherryPickers.isEmpty()) { e.getPresentation().setEnabledAndVisible(false); return; } List<CommitId> commits = VcsLogUtil.collectFirstPack(log.getSelectedCommits(), VcsLogUtil.MAX_SELECTED_COMMITS); if (commits.isEmpty() || cherryPickManager.isCherryPickAlreadyStartedFor(commits)) { e.getPresentation().setEnabled(false); return; } final Map<VirtualFile, List<Hash>> groupedByRoot = groupByRoot(commits); VcsCherryPicker activeCherryPicker = getActiveCherryPicker(cherryPickers, groupedByRoot.keySet()); String description = activeCherryPicker != null ? activeCherryPicker.getInfo(log, groupedByRoot) : SEVERAL_VCS_DESCRIPTION; e.getPresentation().setEnabled(description == null); e.getPresentation() .setText(activeCherryPicker == null ? concatActionNamesForAllAvailable(cherryPickers) : activeCherryPicker.getActionTitle()); e.getPresentation().setDescription(description == null ? "" : description); }
Example #14
Source File: VcsCherryPickAction.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private static Map<VirtualFile, List<Hash>> groupByRoot(@Nonnull List<CommitId> details) { Map<VirtualFile, List<Hash>> result = ContainerUtil.newHashMap(); for (CommitId commit : details) { List<Hash> hashes = result.get(commit.getRoot()); if (hashes == null) { hashes = ContainerUtil.newArrayList(); result.put(commit.getRoot(), hashes); } hashes.add(commit.getHash()); } return result; }
Example #15
Source File: HashEqualsTests.java From consulo with Apache License 2.0 | 4 votes |
@Test public void testEqualsNull() throws Exception { Hash hash1 = HashImpl.build("adf"); Assert.assertFalse(hash1.equals(null)); }
Example #16
Source File: HashEqualsTests.java From consulo with Apache License 2.0 | 4 votes |
@Test public void testEquals() throws Exception { Hash hash1 = HashImpl.build("adf"); Hash hash2 = HashImpl.build("adf"); Assert.assertTrue(hash1.equals(hash2)); }
Example #17
Source File: HashEqualsTests.java From consulo with Apache License 2.0 | 4 votes |
@Test public void testEqualsSelf() throws Exception { Hash hash1 = HashImpl.build("adf"); Assert.assertTrue(hash1.equals(hash1)); }
Example #18
Source File: HashEqualsTests.java From consulo with Apache License 2.0 | 4 votes |
@Test public void testEqualsNone() throws Exception { Hash hash1 = HashImpl.build(""); Hash hash2 = HashImpl.build(""); Assert.assertTrue(hash1.equals(hash2)); }
Example #19
Source File: HashBuildTests.java From consulo with Apache License 2.0 | 4 votes |
public void runStringTest(String strHash) { Hash hash = HashImpl.build(strHash); Assert.assertEquals(strHash, hash.asString()); }
Example #20
Source File: VcsRefImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override @Nonnull public Hash getCommitHash() { return myCommitHash; }
Example #21
Source File: TimedVcsCommitImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override @Nonnull public final List<Hash> getParents() { return myParents; }
Example #22
Source File: TimedVcsCommitImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override @Nonnull public final Hash getId() { return myHash; }
Example #23
Source File: TimedVcsCommitImpl.java From consulo with Apache License 2.0 | 4 votes |
public TimedVcsCommitImpl(@Nonnull Hash hash, @Nonnull List<Hash> parents, long timeStamp) { myHash = hash; myParents = parents; myTime = timeStamp; }
Example #24
Source File: VcsCommitMetadataImpl.java From consulo with Apache License 2.0 | 4 votes |
public VcsCommitMetadataImpl(@Nonnull Hash hash, @Nonnull List<Hash> parents, long commitTime, @Nonnull VirtualFile root, @Nonnull String subject, @Nonnull VcsUser author, @Nonnull String message, @Nonnull VcsUser committer, long authorTime) { super(hash, parents, commitTime, root, subject, author, committer, authorTime); myFullMessage = message.equals(getSubject()) ? getSubject() : message; }
Example #25
Source File: VcsLogSingleCommitAction.java From consulo with Apache License 2.0 | 4 votes |
protected boolean isEnabled(@Nonnull Repo repository, @Nonnull Hash commit) { return true; }
Example #26
Source File: HashImpl.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public static Hash build(@Nonnull String inputStr) { byte[] data = buildData(inputStr); assert data.length > 0 : "Can not build hash for string " + inputStr; return new HashImpl(data); }
Example #27
Source File: VcsLogSingleCommitAction.java From consulo with Apache License 2.0 | 4 votes |
protected boolean isVisible(@Nonnull final Project project, @Nonnull Repo repository, @Nonnull Hash hash) { return !getRepositoryManager(project).isExternal(repository); }
Example #28
Source File: RepoStatusRemote.java From GitToolBox with Apache License 2.0 | 4 votes |
public RepoStatusRemote(GitRemoteBranch remoteTrackingBranch, Hash parentHash) { this(remoteTrackingBranch, remoteTrackingBranch, parentHash); }
Example #29
Source File: RevListCount.java From GitToolBox with Apache License 2.0 | 4 votes |
private RevListCount(Status status, @Nullable Integer value, @Nullable Hash top) { this.value = value; this.status = status; this.top = top; }
Example #30
Source File: RevListCount.java From GitToolBox with Apache License 2.0 | 4 votes |
public static RevListCount success(int count, Hash top) { return new RevListCount(Status.SUCCESS, count, top); }