mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[git] IDEA-102522: Implement commits details in merge conflict during rebase progress
Previously it was implemented only for GitRebaseProcess so Resolve from Local Changes didn't have commits details GitOrigin-RevId: 6cc5013bd214fdd9ee7e2f2b8ac687e325c78345
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e98df80889
commit
e597756a46
@@ -127,10 +127,12 @@ open class GitDefaultMergeDialogCustomizer(
|
||||
val repository = GitRepositoryManager.getInstance(project).getRepositoryForFile(file) ?: return DEFAULT_CUSTOMIZER_LIST
|
||||
return when (repository.state) {
|
||||
Repository.State.MERGING -> getMergeTitleCustomizerList(repository, file)
|
||||
Repository.State.REBASING -> getRebaseTitleCustomizerList(repository, file)
|
||||
else -> DEFAULT_CUSTOMIZER_LIST
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun getMergeTitleCustomizerList(repository: GitRepository, file: FilePath): DiffEditorTitleCustomizerList {
|
||||
val currentBranchHash = getHead(repository) ?: return DEFAULT_CUSTOMIZER_LIST
|
||||
val currentBranchPresentable = repository.currentBranchName ?: currentBranchHash.toShortString()
|
||||
@@ -160,6 +162,34 @@ open class GitDefaultMergeDialogCustomizer(
|
||||
return DiffEditorTitleCustomizerList(leftTitleCustomizer, null, rightTitleCustomizer)
|
||||
}
|
||||
|
||||
private fun getRebaseTitleCustomizerList(repository: GitRepository, file: FilePath): DiffEditorTitleCustomizerList {
|
||||
val currentBranchHash = getHead(repository) ?: return DEFAULT_CUSTOMIZER_LIST
|
||||
val rebasingBranchPresentable = repository.currentBranchName ?: currentBranchHash.toShortString()
|
||||
val upstreamBranch = resolveRebaseOntoBranch(repository) ?: return DEFAULT_CUSTOMIZER_LIST
|
||||
val upstreamBranchHash = upstreamBranch.hash
|
||||
val rebaseHead = tryResolveRef(repository, REBASE_HEAD) ?: return DEFAULT_CUSTOMIZER_LIST
|
||||
val mergeBase = GitHistoryUtils.getMergeBase(
|
||||
repository.project,
|
||||
repository.root,
|
||||
REBASE_HEAD,
|
||||
upstreamBranchHash.asString()
|
||||
)?.rev ?: return DEFAULT_CUSTOMIZER_LIST
|
||||
val leftTitleCustomizer = getTitleWithCommitDetailsCustomizer(
|
||||
"<html>Rebasing ${rebaseHead.toShortString()} from <b>${escapeString(rebasingBranchPresentable)}</b></html>",
|
||||
repository,
|
||||
file,
|
||||
rebaseHead.asString())
|
||||
val branchPartWithBold = if (upstreamBranch.branchName != null) " and commits from <b>${upstreamBranch.branchName}</b>" else ""
|
||||
val rightTitle = "<html>Already rebased commits$branchPartWithBold</html>"
|
||||
val rightTitleCustomizer = getTitleWithCommitsRangeDetailsCustomizer(
|
||||
rightTitle,
|
||||
repository,
|
||||
file,
|
||||
Pair(mergeBase, HEAD)
|
||||
)
|
||||
return DiffEditorTitleCustomizerList(leftTitleCustomizer, null, rightTitleCustomizer)
|
||||
}
|
||||
|
||||
private fun loadCherryPickCommitDetails(repository: GitRepository): CherryPickDetails? {
|
||||
val cherryPickHead = tryResolveRef(repository, CHERRY_PICK_HEAD) ?: return null
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ import git4idea.branch.GitRebaseParams;
|
||||
import git4idea.commands.*;
|
||||
import git4idea.history.GitHistoryUtils;
|
||||
import git4idea.merge.GitConflictResolver;
|
||||
import git4idea.merge.GitDefaultMergeDialogCustomizer;
|
||||
import git4idea.merge.GitDefaultMergeDialogCustomizerKt;
|
||||
import git4idea.merge.GitMergeProvider;
|
||||
import git4idea.rebase.GitSuccessfulRebase.SuccessType;
|
||||
@@ -435,7 +436,7 @@ public class GitRebaseProcess {
|
||||
return new GitRebaseMergeDialogCustomizer(repository, upstream, branch, rebaseHead, mergeBase);
|
||||
}
|
||||
}
|
||||
return new MergeDialogCustomizer();
|
||||
return new GitDefaultMergeDialogCustomizer(repository.getProject());
|
||||
}
|
||||
|
||||
private static class GitRebaseMergeDialogCustomizer extends MergeDialogCustomizer {
|
||||
|
||||
Reference in New Issue
Block a user