mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-30 13:51:53 +08:00
feature: add log for git cherry-pick/rebase/revert/merge --continue/--skip/--abort (#2096)
This commit is contained in:
@@ -5,22 +5,28 @@ namespace SourceGit.ViewModels
|
||||
{
|
||||
public abstract class InProgressContext
|
||||
{
|
||||
public async Task ContinueAsync()
|
||||
public string Name
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
}
|
||||
|
||||
public async Task ContinueAsync(CommandLog log)
|
||||
{
|
||||
if (_continueCmd != null)
|
||||
await _continueCmd.ExecAsync();
|
||||
await _continueCmd.Use(log).ExecAsync();
|
||||
}
|
||||
|
||||
public async Task SkipAsync()
|
||||
public async Task SkipAsync(CommandLog log)
|
||||
{
|
||||
if (_skipCmd != null)
|
||||
await _skipCmd.ExecAsync();
|
||||
await _skipCmd.Use(log).ExecAsync();
|
||||
}
|
||||
|
||||
public async Task AbortAsync()
|
||||
public async Task AbortAsync(CommandLog log)
|
||||
{
|
||||
if (_abortCmd != null)
|
||||
await _abortCmd.ExecAsync();
|
||||
await _abortCmd.Use(log).ExecAsync();
|
||||
}
|
||||
|
||||
protected Commands.Command _continueCmd = null;
|
||||
@@ -42,6 +48,8 @@ namespace SourceGit.ViewModels
|
||||
|
||||
public CherryPickInProgress(Repository repo)
|
||||
{
|
||||
Name = "Cherry-Pick";
|
||||
|
||||
_continueCmd = new Commands.Command
|
||||
{
|
||||
WorkingDirectory = repo.FullPath,
|
||||
@@ -93,6 +101,8 @@ namespace SourceGit.ViewModels
|
||||
|
||||
public RebaseInProgress(Repository repo)
|
||||
{
|
||||
Name = "Rebase";
|
||||
|
||||
_continueCmd = new Commands.Command
|
||||
{
|
||||
WorkingDirectory = repo.FullPath,
|
||||
@@ -144,6 +154,8 @@ namespace SourceGit.ViewModels
|
||||
|
||||
public RevertInProgress(Repository repo)
|
||||
{
|
||||
Name = "Revert";
|
||||
|
||||
_continueCmd = new Commands.Command
|
||||
{
|
||||
WorkingDirectory = repo.FullPath,
|
||||
@@ -189,6 +201,8 @@ namespace SourceGit.ViewModels
|
||||
|
||||
public MergeInProgress(Repository repo)
|
||||
{
|
||||
Name = "Merge";
|
||||
|
||||
_continueCmd = new Commands.Command
|
||||
{
|
||||
WorkingDirectory = repo.FullPath,
|
||||
|
||||
@@ -541,7 +541,10 @@ namespace SourceGit.ViewModels
|
||||
if (File.Exists(mergeMsgFile) && !string.IsNullOrWhiteSpace(_commitMessage))
|
||||
await File.WriteAllTextAsync(mergeMsgFile, _commitMessage);
|
||||
|
||||
await _inProgressContext.ContinueAsync();
|
||||
var log = _repo.CreateLog($"Continue {_inProgressContext.Name}");
|
||||
await _inProgressContext.ContinueAsync(log);
|
||||
log.Complete();
|
||||
|
||||
CommitMessage = string.Empty;
|
||||
IsCommitting = false;
|
||||
}
|
||||
@@ -558,7 +561,10 @@ namespace SourceGit.ViewModels
|
||||
using var lockWatcher = _repo.LockWatcher();
|
||||
IsCommitting = true;
|
||||
|
||||
await _inProgressContext.SkipAsync();
|
||||
var log = _repo.CreateLog($"Skip {_inProgressContext.Name}");
|
||||
await _inProgressContext.SkipAsync(log);
|
||||
log.Complete();
|
||||
|
||||
CommitMessage = string.Empty;
|
||||
IsCommitting = false;
|
||||
}
|
||||
@@ -575,7 +581,10 @@ namespace SourceGit.ViewModels
|
||||
using var lockWatcher = _repo.LockWatcher();
|
||||
IsCommitting = true;
|
||||
|
||||
await _inProgressContext.AbortAsync();
|
||||
var log = _repo.CreateLog($"Abort {_inProgressContext.Name}");
|
||||
await _inProgressContext.AbortAsync(log);
|
||||
log.Complete();
|
||||
|
||||
CommitMessage = string.Empty;
|
||||
IsCommitting = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user