diff --git a/src/ViewModels/InProgressContexts.cs b/src/ViewModels/InProgressContexts.cs index 446cbe98..5b61035f 100644 --- a/src/ViewModels/InProgressContexts.cs +++ b/src/ViewModels/InProgressContexts.cs @@ -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, diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index d094b3e8..8bf5ed63 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -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; }