mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 20:54:59 +00:00
feature: saving as patch supports multiple commits (#658)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
c72506d939
commit
9cb85081ab
9 changed files with 110 additions and 8 deletions
|
@ -24,6 +24,11 @@ namespace SourceGit.ViewModels
|
|||
private set => SetProperty(ref _endPoint, value);
|
||||
}
|
||||
|
||||
public bool CanSaveAsPatch
|
||||
{
|
||||
get => _canSaveAsPatch;
|
||||
}
|
||||
|
||||
public List<Models.Change> VisibleChanges
|
||||
{
|
||||
get => _visibleChanges;
|
||||
|
@ -73,6 +78,7 @@ namespace SourceGit.ViewModels
|
|||
_repo = repo;
|
||||
_startPoint = (object)startPoint ?? new Models.Null();
|
||||
_endPoint = (object)endPoint ?? new Models.Null();
|
||||
_canSaveAsPatch = startPoint != null && endPoint != null;
|
||||
|
||||
Task.Run(Refresh);
|
||||
}
|
||||
|
@ -105,6 +111,16 @@ namespace SourceGit.ViewModels
|
|||
Task.Run(Refresh);
|
||||
}
|
||||
|
||||
public void SaveAsPatch(string saveTo)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var succ = Commands.SaveChangesAsPatch.ProcessRevisionCompareChanges(_repo, _changes, GetSHA(_startPoint), GetSHA(_endPoint), saveTo);
|
||||
if (succ)
|
||||
Dispatcher.UIThread.Invoke(() => App.SendNotification(_repo, App.Text("SaveAsPatchSuccess")));
|
||||
});
|
||||
}
|
||||
|
||||
public void ClearSearchFilter()
|
||||
{
|
||||
SearchFilter = string.Empty;
|
||||
|
@ -218,6 +234,7 @@ namespace SourceGit.ViewModels
|
|||
private string _repo;
|
||||
private object _startPoint = null;
|
||||
private object _endPoint = null;
|
||||
private bool _canSaveAsPatch = false;
|
||||
private List<Models.Change> _changes = null;
|
||||
private List<Models.Change> _visibleChanges = null;
|
||||
private List<Models.Change> _selectedChanges = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue