mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
feature: git bisect
support
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
9eae1eeb81
commit
df5294bcb7
16 changed files with 397 additions and 7 deletions
|
@ -398,6 +398,18 @@ namespace SourceGit.ViewModels
|
|||
get => _workingCopy?.InProgressContext;
|
||||
}
|
||||
|
||||
public Models.BisectState BisectState
|
||||
{
|
||||
get => _bisectState;
|
||||
private set => SetProperty(ref _bisectState, value);
|
||||
}
|
||||
|
||||
public bool IsBisectCommandRunning
|
||||
{
|
||||
get => _isBisectCommandRunning;
|
||||
private set => SetProperty(ref _isBisectCommandRunning, value);
|
||||
}
|
||||
|
||||
public bool IsAutoFetching
|
||||
{
|
||||
get => _isAutoFetching;
|
||||
|
@ -939,6 +951,31 @@ namespace SourceGit.ViewModels
|
|||
return actions;
|
||||
}
|
||||
|
||||
public void Bisect(string subcmd)
|
||||
{
|
||||
IsBisectCommandRunning = true;
|
||||
SetWatcherEnabled(false);
|
||||
|
||||
var log = CreateLog($"Bisect({subcmd})");
|
||||
Task.Run(() =>
|
||||
{
|
||||
var succ = new Commands.Bisect(_fullpath, subcmd).Use(log).Exec();
|
||||
log.Complete();
|
||||
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
if (!succ)
|
||||
App.RaiseException(_fullpath, log.Content);
|
||||
else if (log.Content.Contains("is the first bad commit"))
|
||||
App.SendNotification(_fullpath, log.Content);
|
||||
|
||||
MarkBranchesDirtyManually();
|
||||
SetWatcherEnabled(true);
|
||||
IsBisectCommandRunning = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public void RefreshBranches()
|
||||
{
|
||||
var branches = new Commands.QueryBranches(_fullpath).Result();
|
||||
|
@ -1023,6 +1060,8 @@ namespace SourceGit.ViewModels
|
|||
_histories.Commits = commits;
|
||||
_histories.Graph = graph;
|
||||
|
||||
BisectState = _histories.UpdateBisectInfo();
|
||||
|
||||
if (!string.IsNullOrEmpty(_navigateToBranchDelayed))
|
||||
{
|
||||
var branch = _branches.Find(x => x.FullName == _navigateToBranchDelayed);
|
||||
|
@ -2627,6 +2666,9 @@ namespace SourceGit.ViewModels
|
|||
private Timer _autoFetchTimer = null;
|
||||
private DateTime _lastFetchTime = DateTime.MinValue;
|
||||
|
||||
private Models.BisectState _bisectState = Models.BisectState.None;
|
||||
private bool _isBisectCommandRunning = false;
|
||||
|
||||
private string _navigateToBranchDelayed = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue