mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-16 16:05:00 +00:00
enhance: clear commit message before merging/cherry-picking/rebasing/reverting to allow SourceGit
read it from git (#1414)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
7de5991ecb
commit
7e2f3bec8c
11 changed files with 30 additions and 17 deletions
|
@ -66,6 +66,7 @@ namespace SourceGit.ViewModels
|
|||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
_repo.ClearCommitMessage();
|
||||
ProgressDescription = $"Cherry-Pick commit(s) ...";
|
||||
|
||||
var log = _repo.CreateLog("Cherry-Pick");
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace SourceGit.ViewModels
|
|||
CallUIThread(() =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty(upstreamHead))
|
||||
_repo.NavigateToCommitDelayed(upstreamHead);
|
||||
_repo.NavigateToCommit(upstreamHead, true);
|
||||
|
||||
_repo.MarkFetched();
|
||||
_repo.SetWatcherEnabled(true);
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace SourceGit.ViewModels
|
|||
var changedLocalBranchHead = new Commands.QueryRevisionByRefName(_repo.FullPath, Local.Name).Result();
|
||||
CallUIThread(() =>
|
||||
{
|
||||
_repo.NavigateToCommitDelayed(changedLocalBranchHead);
|
||||
_repo.NavigateToCommit(changedLocalBranchHead, true);
|
||||
_repo.SetWatcherEnabled(true);
|
||||
});
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace SourceGit.ViewModels
|
|||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
_repo.ClearCommitMessage();
|
||||
ProgressDescription = $"Merging '{_sourceName}' into '{Into}' ...";
|
||||
|
||||
var log = _repo.CreateLog($"Merging '{_sourceName}' into '{Into}'");
|
||||
|
@ -67,7 +68,7 @@ namespace SourceGit.ViewModels
|
|||
var head = new Commands.QueryRevisionByRefName(_repo.FullPath, "HEAD").Result();
|
||||
CallUIThread(() =>
|
||||
{
|
||||
_repo.NavigateToCommitDelayed(head);
|
||||
_repo.NavigateToCommit(head, true);
|
||||
_repo.SetWatcherEnabled(true);
|
||||
});
|
||||
return true;
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace SourceGit.ViewModels
|
|||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
_repo.ClearCommitMessage();
|
||||
ProgressDescription = "Merge head(s) ...";
|
||||
|
||||
var log = _repo.CreateLog("Merge Multiple Heads");
|
||||
|
@ -48,7 +49,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var succ = new Commands.Merge(
|
||||
new Commands.Merge(
|
||||
_repo.FullPath,
|
||||
ConvertTargetToMergeSources(),
|
||||
AutoCommit,
|
||||
|
@ -56,7 +57,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
log.Complete();
|
||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||
return succ;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace SourceGit.ViewModels
|
|||
var head = new Commands.QueryRevisionByRefName(_repo.FullPath, "HEAD").Result();
|
||||
CallUIThread(() =>
|
||||
{
|
||||
_repo.NavigateToCommitDelayed(head);
|
||||
_repo.NavigateToCommit(head, true);
|
||||
_repo.SetWatcherEnabled(true);
|
||||
});
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace SourceGit.ViewModels
|
|||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
_repo.ClearCommitMessage();
|
||||
ProgressDescription = "Rebasing ...";
|
||||
|
||||
var log = _repo.CreateLog("Rebase");
|
||||
|
|
|
@ -925,24 +925,23 @@ namespace SourceGit.ViewModels
|
|||
_lastFetchTime = DateTime.Now;
|
||||
}
|
||||
|
||||
public void NavigateToCommit(string sha)
|
||||
public void NavigateToCommit(string sha, bool isDelayMode = false)
|
||||
{
|
||||
if (_histories != null)
|
||||
if (isDelayMode)
|
||||
{
|
||||
_navigateToCommitDelayed = sha;
|
||||
}
|
||||
else if (_histories != null)
|
||||
{
|
||||
SelectedViewIndex = 0;
|
||||
_histories.NavigateTo(sha);
|
||||
}
|
||||
}
|
||||
|
||||
public void NavigateToCommitDelayed(string sha)
|
||||
public void ClearCommitMessage()
|
||||
{
|
||||
_navigateToCommitDelayed = sha;
|
||||
}
|
||||
|
||||
public void NavigateToCurrentHead()
|
||||
{
|
||||
if (_currentBranch != null)
|
||||
NavigateToCommit(_currentBranch.Head);
|
||||
if (_workingCopy is not null)
|
||||
_workingCopy.CommitMessage = string.Empty;
|
||||
}
|
||||
|
||||
public void ClearHistoriesFilter()
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace SourceGit.ViewModels
|
|||
public override Task<bool> Sure()
|
||||
{
|
||||
_repo.SetWatcherEnabled(false);
|
||||
_repo.ClearCommitMessage();
|
||||
ProgressDescription = $"Revert commit '{Target.SHA}' ...";
|
||||
|
||||
var log = _repo.CreateLog($"Revert '{Target.SHA}'");
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
</ContentControl.DataTemplates>
|
||||
</ContentControl>
|
||||
|
||||
<Button Classes="icon_button" Width="32" Command="{Binding NavigateToCurrentHead}" ToolTip.Tip="{DynamicResource Text.Repository.NavigateToCurrentHead}">
|
||||
<Button Classes="icon_button" Width="32" Click="NavigateToHead" ToolTip.Tip="{DynamicResource Text.Repository.NavigateToCurrentHead}">
|
||||
<Path Width="13" Height="13" Margin="0,2,0,0" Data="{StaticResource Icons.Target}" Fill="{DynamicResource Brush.FG1}"/>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
|
|
@ -150,5 +150,14 @@ namespace SourceGit.Views
|
|||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void NavigateToHead(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.Repository { CurrentBranch: { } } repo)
|
||||
{
|
||||
repo.NavigateToCommit(repo.CurrentBranch.Head);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue