com.intellij.vcs.log.VcsFullCommitDetails Java Examples
The following examples show how to use
com.intellij.vcs.log.VcsFullCommitDetails.
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: OpenCommitInBrowserAction.java From azure-devops-intellij with MIT License | 6 votes |
@Override public void actionPerformed(@NotNull final AnActionEvent anActionEvent) { final Project project = anActionEvent.getRequiredData(CommonDataKeys.PROJECT); final VcsFullCommitDetails commit = anActionEvent.getRequiredData(VcsLogDataKeys.VCS_LOG).getSelectedDetails().get(0); final GitRepository gitRepository = GitUtil.getRepositoryManager(project).getRepositoryForRootQuick(commit.getRoot()); if (gitRepository == null) return; final GitRemote remote = TfGitHelper.getTfGitRemote(gitRepository); // guard for null so findbugs doesn't complain if (remote == null) { return; } final String remoteUrl = remote.getFirstUrl(); if (remoteUrl == null) { return; } final URI urlToBrowseTo = UrlHelper.getCommitURI(remoteUrl, commit.getId().toString()); logger.info("Browsing to url " + urlToBrowseTo.getPath()); BrowserUtil.browse(urlToBrowseTo); }
Example #2
Source File: VcsLogAction.java From consulo with Apache License 2.0 | 6 votes |
@Override public void update(@Nonnull AnActionEvent e) { Project project = e.getProject(); VcsLog log = e.getData(VcsLogDataKeys.VCS_LOG); if (project == null || log == null) { e.getPresentation().setEnabledAndVisible(false); return; } List<VcsFullCommitDetails> details = log.getSelectedDetails(); MultiMap<Repo, VcsFullCommitDetails> grouped = groupByRootWithCheck(project, details); if (grouped == null) { e.getPresentation().setEnabledAndVisible(false); } else { e.getPresentation().setVisible(isVisible(project, grouped)); e.getPresentation().setEnabled(!grouped.isEmpty() && isEnabled(grouped)); } }
Example #3
Source File: CommitPanel.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull private static String getAuthorText(@Nonnull VcsFullCommitDetails commit, int offset) { long authorTime = commit.getAuthorTime(); long commitTime = commit.getCommitTime(); String authorText = getAuthorName(commit.getAuthor()) + formatDateTime(authorTime); if (!VcsUserUtil.isSamePerson(commit.getAuthor(), commit.getCommitter())) { String commitTimeText; if (authorTime != commitTime) { commitTimeText = formatDateTime(commitTime); } else { commitTimeText = ""; } authorText += getCommitterText(commit.getCommitter(), commitTimeText, offset); } else if (authorTime != commitTime) { authorText += getCommitterText(null, formatDateTime(commitTime), offset); } return authorText; }
Example #4
Source File: VcsLogStructureFilterImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public boolean matches(@Nonnull VcsCommitMetadata details) { if ((details instanceof VcsFullCommitDetails)) { for (Change change : ((VcsFullCommitDetails)details).getChanges()) { ContentRevision before = change.getBeforeRevision(); if (before != null && matches(before.getFile().getPath())) { return true; } ContentRevision after = change.getAfterRevision(); if (after != null && matches(after.getFile().getPath())) { return true; } } return false; } else { return false; } }
Example #5
Source File: VcsLogFullDetailsIndex.java From consulo with Apache License 2.0 | 6 votes |
public VcsLogFullDetailsIndex(@Nonnull String logId, @Nonnull String name, final int version, @Nonnull DataIndexer<Integer, T, VcsFullCommitDetails> indexer, @Nonnull DataExternalizer<T> externalizer, @Nonnull FatalErrorHandler fatalErrorHandler, @Nonnull Disposable disposableParent) throws IOException { myID = ID.create(name); myName = name; myLogId = logId; myIndexer = indexer; myFatalErrorHandler = fatalErrorHandler; myMapReduceIndex = createMapReduceIndex(externalizer, version); Disposer.register(disposableParent, this); }
Example #6
Source File: VcsCherryPickManager.java From consulo with Apache License 2.0 | 6 votes |
@Nullable private VcsCherryPicker getCherryPickerOrReportError(@Nonnull VcsFullCommitDetails details) { CommitId commitId = new CommitId(details.getId(), details.getRoot()); if (myIdsInProgress.contains(commitId)) { showError("Cherry pick process is already started for commit " + commitId.getHash().toShortString() + " from root " + commitId.getRoot().getName()); return null; } myIdsInProgress.add(commitId); VcsCherryPicker cherryPicker = getCherryPickerForCommit(details); if (cherryPicker == null) { showError( "Cherry pick is not supported for commit " + details.getId().toShortString() + " from root " + details.getRoot().getName()); return null; } return cherryPicker; }
Example #7
Source File: DvcsUtil.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull public static <R extends Repository> Map<R, List<VcsFullCommitDetails>> groupCommitsByRoots(@Nonnull RepositoryManager<R> repoManager, @Nonnull List<? extends VcsFullCommitDetails> commits) { Map<R, List<VcsFullCommitDetails>> groupedCommits = ContainerUtil.newHashMap(); for (VcsFullCommitDetails commit : commits) { R repository = repoManager.getRepositoryForRoot(commit.getRoot()); if (repository == null) { LOGGER.info("No repository found for commit " + commit); continue; } List<VcsFullCommitDetails> commitsInRoot = groupedCommits.get(repository); if (commitsInRoot == null) { commitsInRoot = ContainerUtil.newArrayList(); groupedCommits.put(repository, commitsInRoot); } commitsInRoot.add(commit); } return groupedCommits; }
Example #8
Source File: CommitPanel.java From consulo with Apache License 2.0 | 5 votes |
void setData(@Nullable VcsFullCommitDetails commit) { if (commit == null) { myMainText = null; } else { String hash = commit.getId().toShortString(); String hashAndAuthor = getHtmlWithFonts(hash + " " + getAuthorText(commit, hash.length() + 1)); String messageText = getMessageText(commit); myMainText = messageText + "<br/><br/>" + hashAndAuthor; } }
Example #9
Source File: DetailsPanel.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void onDetailsLoaded(@Nonnull List<VcsFullCommitDetails> detailsList) { Set<VcsFullCommitDetails> newCommitDetails = ContainerUtil.newHashSet(detailsList); for (int i = 0; i < mySelection.size(); i++) { CommitPanel commitPanel = getCommitPanel(i); commitPanel.setCommit(detailsList.get(i)); } if (!ContainerUtil.intersects(myCommitDetails, newCommitDetails)) { myScrollPane.getVerticalScrollBar().setValue(0); } myCommitDetails = newCommitDetails; }
Example #10
Source File: CommitPanel.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private String getMessageText(@Nonnull VcsFullCommitDetails commit) { String fullMessage = commit.getFullMessage(); int separator = fullMessage.indexOf("\n\n"); String subject = separator > 0 ? fullMessage.substring(0, separator) : fullMessage; String description = fullMessage.substring(subject.length()); return "<b>" + getHtmlWithFonts(escapeMultipleSpaces(IssueLinkHtmlRenderer.formatTextWithLinks(myProject, subject)), Font.BOLD) + "</b>" + getHtmlWithFonts(escapeMultipleSpaces(IssueLinkHtmlRenderer.formatTextWithLinks(myProject, description))); }
Example #11
Source File: VcsLogAction.java From GitLink with MIT License | 5 votes |
@Override public void actionPerformed(@NotNull final Project project, @NotNull final AnActionEvent event) { VcsLog vcsLog = event.getData(VcsLogDataKeys.VCS_LOG); if (vcsLog == null) { return; } VcsFullCommitDetails vcsCommit = vcsLog.getSelectedDetails().get(0); Commit commit = new Commit(vcsCommit.getId().toShortString()); this.perform(project, commit, vcsCommit.getRoot()); }
Example #12
Source File: PushController.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull private List<DefaultMutableTreeNode> getPresentationForCommits(@Nonnull final Project project, @Nonnull List<? extends VcsFullCommitDetails> commits, int commitsNum) { Function<VcsFullCommitDetails, DefaultMutableTreeNode> commitToNode = new Function<VcsFullCommitDetails, DefaultMutableTreeNode>() { @Override public DefaultMutableTreeNode fun(VcsFullCommitDetails commit) { return new CommitNode(project, commit); } }; List<DefaultMutableTreeNode> childrenToShown = new ArrayList<DefaultMutableTreeNode>(); for (int i = 0; i < commits.size(); ++i) { if (i >= commitsNum) { final VcsLinkedTextComponent moreCommitsLink = new VcsLinkedTextComponent("<a href='loadMore'>...</a>", new VcsLinkListener() { @Override public void hyperlinkActivated(@Nonnull DefaultMutableTreeNode sourceNode, @Nonnull MouseEvent event) { TreeNode parent = sourceNode.getParent(); if (parent instanceof RepositoryNode) { addMoreCommits((RepositoryNode)parent); } } }); childrenToShown.add(new TextWithLinkNode(moreCommitsLink)); break; } childrenToShown.add(commitToNode.fun(commits.get(i))); } return childrenToShown; }
Example #13
Source File: VcsCherryPickManager.java From consulo with Apache License 2.0 | 5 votes |
public void cherryPick(@Nonnull VcsLog log) { log.requestSelectedDetails(new Consumer<List<VcsFullCommitDetails>>() { @Override public void consume(List<VcsFullCommitDetails> details) { ProgressManager.getInstance().run(new CherryPickingTask(myProject, ContainerUtil.reverse(details))); } }, null); }
Example #14
Source File: VcsCherryPickManager.java From consulo with Apache License 2.0 | 5 votes |
@Nullable private VcsCherryPicker getCherryPickerForCommit(@Nonnull VcsFullCommitDetails commitDetails) { AbstractVcs vcs = myProjectLevelVcsManager.getVcsFor(commitDetails.getRoot()); if (vcs == null) return null; VcsKey key = vcs.getKeyInstanceMethod(); return getCherryPickerFor(key); }
Example #15
Source File: VcsCherryPickManager.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public MultiMap<VcsCherryPicker, VcsFullCommitDetails> createArrayMultiMap() { return new MultiMap<VcsCherryPicker, VcsFullCommitDetails>() { @Nonnull @Override protected Collection<VcsFullCommitDetails> createCollection() { return new ArrayList<>(); } }; }
Example #16
Source File: VcsLogOneCommitPerRepoAction.java From consulo with Apache License 2.0 | 5 votes |
private boolean allValuesAreSingletons(@Nonnull MultiMap<Repo, VcsFullCommitDetails> grouped) { return !ContainerUtil.exists(grouped.entrySet(), new Condition<Map.Entry<Repo, Collection<VcsFullCommitDetails>>>() { @Override public boolean value(Map.Entry<Repo, Collection<VcsFullCommitDetails>> entry) { return entry.getValue().size() != 1; } }); }
Example #17
Source File: VcsLogOneCommitPerRepoAction.java From consulo with Apache License 2.0 | 5 votes |
@javax.annotation.Nullable private Map<Repo, VcsFullCommitDetails> convertToSingleElementMap(@Nonnull MultiMap<Repo, VcsFullCommitDetails> groupedCommits) { Map<Repo, VcsFullCommitDetails> map = ContainerUtil.newHashMap(); for (Map.Entry<Repo, Collection<VcsFullCommitDetails>> entry : groupedCommits.entrySet()) { Collection<VcsFullCommitDetails> commits = entry.getValue(); if (commits.size() != 1) { return null; } map.put(entry.getKey(), commits.iterator().next()); } return map; }
Example #18
Source File: VcsLogAction.java From consulo with Apache License 2.0 | 5 votes |
protected boolean isVisible(@Nonnull final Project project, @Nonnull MultiMap<Repo, VcsFullCommitDetails> grouped) { return ContainerUtil.and(grouped.keySet(), new Condition<Repo>() { @Override public boolean value(Repo repo) { RepositoryManager<Repo> manager = getRepositoryManager(project); return !manager.isExternal(repo); } }); }
Example #19
Source File: VcsLogAction.java From consulo with Apache License 2.0 | 5 votes |
@javax.annotation.Nullable private MultiMap<Repo, VcsFullCommitDetails> groupByRootWithCheck(@Nonnull Project project, @Nonnull List<VcsFullCommitDetails> commits) { MultiMap<Repo, VcsFullCommitDetails> map = MultiMap.create(); for (VcsFullCommitDetails commit : commits) { Repo root = getRepositoryForRoot(project, commit.getRoot()); if (root == null) { // commit from some other VCS return null; } map.putValue(root, commit); } return map; }
Example #20
Source File: VcsLogAction.java From GitLink with MIT License | 5 votes |
@Override protected boolean shouldActionBeEnabled(@NotNull final AnActionEvent event) { VcsLog log = event.getData(VcsLogDataKeys.VCS_LOG); if (log == null) { return false; } List<VcsFullCommitDetails> commits = log.getSelectedDetails(); return commits.size() == 1; }
Example #21
Source File: OpenCommitInBrowserAction.java From azure-devops-intellij with MIT License | 5 votes |
@Override public void update(@NotNull final AnActionEvent anActionEvent) { final Presentation presentation = anActionEvent.getPresentation(); final Project project = anActionEvent.getData(CommonDataKeys.PROJECT); final VcsLog log = anActionEvent.getData(VcsLogDataKeys.VCS_LOG); if (project == null || project.isDisposed() || log == null) { presentation.setEnabledAndVisible(false); return; } final List<VcsFullCommitDetails> commits = log.getSelectedDetails(); if (commits.size() == 0) { presentation.setEnabledAndVisible(false); return; } final VcsFullCommitDetails commit = commits.get(0); final GitRepository repository = GitUtil.getRepositoryManager(project).getRepositoryForRootQuick(commit.getRoot()); if (repository == null || !TfGitHelper.isTfGitRepository(repository)) { presentation.setEnabledAndVisible(false); return; } else if (commits.size() > 1) { // only one for now, leave it visible as a breadcrumb presentation.setVisible(true); presentation.setEnabled(false); return; } presentation.setEnabledAndVisible(true); }
Example #22
Source File: VcsLogUserIndex.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public Map<Integer, Void> map(@Nonnull VcsFullCommitDetails inputData) { Map<Integer, Void> result = new THashMap<>(); try { result.put(myRegistry.getUserId(inputData.getAuthor()), null); } catch (IOException e) { myFatalErrorConsumer.consume(e); } return result; }
Example #23
Source File: VcsLogMessagesTrigramIndex.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public Map<Integer, Void> map(@Nonnull VcsFullCommitDetails inputData) { MyTrigramProcessor trigramProcessor = new MyTrigramProcessor(); TrigramBuilder.processTrigrams(inputData.getFullMessage(), trigramProcessor); return trigramProcessor.map; }
Example #24
Source File: CommitPanel.java From consulo with Apache License 2.0 | 5 votes |
public void setCommit(@Nonnull VcsFullCommitDetails commitData) { if (!Comparing.equal(myCommit, commitData)) { if (commitData instanceof LoadingDetails) { myDataPanel.setData(null); myRootPanel.setRoot("", null); } else { myDataPanel.setData(commitData); VirtualFile root = commitData.getRoot(); if (myColorManager.isMultipleRoots()) { myRootPanel.setRoot(root.getName(), VcsLogGraphTable.getRootBackgroundColor(root, myColorManager)); } else { myRootPanel.setRoot("", null); } } myCommit = commitData; } List<String> branches = null; if (!(commitData instanceof LoadingDetails)) { branches = myLogData.getContainingBranchesGetter().requestContainingBranches(commitData.getRoot(), commitData.getId()); } myContainingBranchesPanel.setBranches(branches); myDataPanel.update(); myContainingBranchesPanel.update(); revalidate(); }
Example #25
Source File: VcsCherryPickManager.java From consulo with Apache License 2.0 | 4 votes |
public CherryPickingTask(@Nonnull Project project, @Nonnull List<VcsFullCommitDetails> detailsInReverseOrder) { super(project, "Cherry-Picking"); myAllDetailsInReverseOrder = detailsInReverseOrder; myChangeListManager = (ChangeListManagerEx)ChangeListManager.getInstance(myProject); myChangeListManager.blockModalNotifications(); }
Example #26
Source File: OutgoingResult.java From consulo with Apache License 2.0 | 4 votes |
public OutgoingResult(@Nonnull List<? extends VcsFullCommitDetails> commits, @Nonnull List<VcsError> errors) { myCommits = commits; myErrors = errors; }
Example #27
Source File: OutgoingResult.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public List<? extends VcsFullCommitDetails> getCommits() { return myCommits; }
Example #28
Source File: VcsLogOneCommitPerRepoAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected boolean isEnabled(@Nonnull MultiMap<Repo, VcsFullCommitDetails> grouped) { return allValuesAreSingletons(grouped); }
Example #29
Source File: VcsLogOneCommitPerRepoAction.java From consulo with Apache License 2.0 | 4 votes |
@Override protected void actionPerformed(@Nonnull Project project, @Nonnull MultiMap<Repo, VcsFullCommitDetails> grouped) { Map<Repo, VcsFullCommitDetails> singleElementMap = convertToSingleElementMap(grouped); assert singleElementMap != null; actionPerformed(project, singleElementMap); }
Example #30
Source File: VcsLogFullDetailsIndex.java From consulo with Apache License 2.0 | 4 votes |
public void update(int commitId, @Nonnull VcsFullCommitDetails details) throws IOException { myMapReduceIndex.update(commitId, details).compute(); }