Added revert commit feature
This commit is contained in:
parent
a7d89aabaf
commit
d60b1a14a2
4 changed files with 24 additions and 0 deletions
|
@ -247,6 +247,13 @@ class GitManager @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
fun revertCommit(revCommit: RevCommit) = managerScope.launch {
|
||||
safeProcessing {
|
||||
logManager.revertCommit(safeGit, revCommit)
|
||||
refreshRepositoryInfo()
|
||||
}
|
||||
}
|
||||
|
||||
fun createBranchOnCommit(branch: String, revCommit: RevCommit) = managerScope.launch {
|
||||
safeProcessing {
|
||||
branchesManager.createBranchOnCommit(safeGit, branch, revCommit)
|
||||
|
|
|
@ -63,6 +63,13 @@ class LogManager @Inject constructor(
|
|||
.setName(ref.name)
|
||||
.call()
|
||||
}
|
||||
|
||||
suspend fun revertCommit(git: Git, revCommit: RevCommit) = withContext(Dispatchers.IO) {
|
||||
git
|
||||
.revert()
|
||||
.include(revCommit)
|
||||
.call()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ fun Log(
|
|||
onRevCommitSelected: (RevCommit) -> Unit,
|
||||
onUncommitedChangesSelected: () -> Unit,
|
||||
onCheckoutCommit: (graphNode: GraphNode) -> Unit,
|
||||
onRevertCommit: (graphNode: GraphNode) -> Unit,
|
||||
onCreateBranchOnCommit: (branchName: String, graphNode: GraphNode) -> Unit,
|
||||
onCreateTagOnCommit: (tagName: String, graphNode: GraphNode) -> Unit,
|
||||
onCheckoutRef: (ref: Ref) -> Unit,
|
||||
|
@ -239,6 +240,12 @@ fun Log(
|
|||
}
|
||||
}
|
||||
),
|
||||
ContextMenuItem(
|
||||
label = "Revert commit",
|
||||
onClick = {
|
||||
onRevertCommit(item)
|
||||
}
|
||||
)
|
||||
)
|
||||
},
|
||||
) {
|
||||
|
|
|
@ -96,6 +96,9 @@ fun RepositoryOpenPage(gitManager: GitManager, dialogManager: DialogManager) {
|
|||
onCheckoutCommit = { graphNode ->
|
||||
gitManager.checkoutCommit(graphNode)
|
||||
},
|
||||
onRevertCommit = { graphNode ->
|
||||
gitManager.revertCommit(graphNode)
|
||||
},
|
||||
onCreateBranchOnCommit = { branch, graphNode ->
|
||||
gitManager.createBranchOnCommit(branch, graphNode)
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue