Search in sources :

Example 11 with VcsFullCommitDetails

use of com.intellij.vcs.log.VcsFullCommitDetails in project intellij-community by JetBrains.

the class GitNewResetDialog method prepareDescription.

@NotNull
private static String prepareDescription(@NotNull Project project, @NotNull Map<GitRepository, VcsFullCommitDetails> commits) {
    if (commits.size() == 1 && !isMultiRepo(project)) {
        Map.Entry<GitRepository, VcsFullCommitDetails> entry = commits.entrySet().iterator().next();
        return String.format("%s -> %s", getSourceText(entry.getKey()), getTargetText(entry.getValue()));
    }
    StringBuilder desc = new StringBuilder("");
    for (Map.Entry<GitRepository, VcsFullCommitDetails> entry : commits.entrySet()) {
        GitRepository repository = entry.getKey();
        VcsFullCommitDetails commit = entry.getValue();
        desc.append(String.format("%s in %s -> %s<br/>", getSourceText(repository), getShortRepositoryName(repository), getTargetText(commit)));
    }
    return desc.toString();
}
Also used : GitRepository(git4idea.repo.GitRepository) Map(java.util.Map) VcsFullCommitDetails(com.intellij.vcs.log.VcsFullCommitDetails) NotNull(org.jetbrains.annotations.NotNull)

Example 12 with VcsFullCommitDetails

use of com.intellij.vcs.log.VcsFullCommitDetails in project intellij-community by JetBrains.

the class HgQGotoFromLogAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
    VcsLog log = e.getRequiredData(VcsLogDataKeys.VCS_LOG);
    log.requestSelectedDetails(new Consumer<List<VcsFullCommitDetails>>() {

        @Override
        public void consume(List<VcsFullCommitDetails> selectedDetails) {
            VcsFullCommitDetails fullCommitDetails = ContainerUtil.getFirstItem(selectedDetails);
            assert fullCommitDetails != null;
            final HgRepository repository = getRepositoryForRoot(project, fullCommitDetails.getRoot());
            assert repository != null;
            actionPerformed(repository, fullCommitDetails);
        }
    }, null);
}
Also used : Project(com.intellij.openapi.project.Project) VcsLog(com.intellij.vcs.log.VcsLog) List(java.util.List) HgRepository(org.zmlx.hg4idea.repo.HgRepository) VcsFullCommitDetails(com.intellij.vcs.log.VcsFullCommitDetails)

Aggregations

VcsFullCommitDetails (com.intellij.vcs.log.VcsFullCommitDetails)12 Project (com.intellij.openapi.project.Project)4 NotNull (org.jetbrains.annotations.NotNull)4 Change (com.intellij.openapi.vcs.changes.Change)3 FileHistoryUi (com.intellij.vcs.log.history.FileHistoryUi)3 FilePath (com.intellij.openapi.vcs.FilePath)2 VcsFileRevision (com.intellij.openapi.vcs.history.VcsFileRevision)2 LoadingDetails (com.intellij.vcs.log.data.LoadingDetails)2 List (java.util.List)2 OutgoingResult (com.intellij.dvcs.push.OutgoingResult)1 VcsError (com.intellij.dvcs.push.VcsError)1 VcsException (com.intellij.openapi.vcs.VcsException)1 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)1 ShowDiffContext (com.intellij.openapi.vcs.changes.actions.diff.ShowDiffContext)1 ObjectUtils.chooseNotNull (com.intellij.util.ObjectUtils.chooseNotNull)1 CommitId (com.intellij.vcs.log.CommitId)1 VcsLog (com.intellij.vcs.log.VcsLog)1 GitCommit (git4idea.GitCommit)1 GitLocalBranch (git4idea.GitLocalBranch)1 GitCommandResult (git4idea.commands.GitCommandResult)1