mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
optimize<*>: App.RaiseException should be called in UIThread; add default progress description for popups;
This commit is contained in:
parent
dc0b33ba21
commit
9c3294c285
35 changed files with 100 additions and 34 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using Avalonia.Threading;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace SourceGit.Commands {
|
namespace SourceGit.Commands {
|
||||||
public class GitFlow : Command {
|
public class GitFlow : Command {
|
||||||
|
@ -42,7 +43,9 @@ namespace SourceGit.Commands {
|
||||||
Args = $"flow hotfix start {name}";
|
Args = $"flow hotfix start {name}";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Dispatcher.UIThread.Invoke(() => {
|
||||||
App.RaiseException(Context, "Bad branch type!!!");
|
App.RaiseException(Context, "Bad branch type!!!");
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +65,9 @@ namespace SourceGit.Commands {
|
||||||
Args = $"flow hotfix finish {option} {name} -m \"HOTFIX_DONE\"";
|
Args = $"flow hotfix finish {option} {name} -m \"HOTFIX_DONE\"";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Dispatcher.UIThread.Invoke(() => {
|
||||||
App.RaiseException(Context, "Bad branch type!!!");
|
App.RaiseException(Context, "Bad branch type!!!");
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,20 @@
|
||||||
using System.IO;
|
using Avalonia.Threading;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace SourceGit.Commands {
|
namespace SourceGit.Commands {
|
||||||
public static class MergeTool {
|
public static class MergeTool {
|
||||||
public static bool OpenForMerge(string repo, string tool, string mergeCmd, string file) {
|
public static bool OpenForMerge(string repo, string tool, string mergeCmd, string file) {
|
||||||
if (string.IsNullOrWhiteSpace(tool) || string.IsNullOrWhiteSpace(mergeCmd)) {
|
if (string.IsNullOrWhiteSpace(tool) || string.IsNullOrWhiteSpace(mergeCmd)) {
|
||||||
|
Dispatcher.UIThread.Invoke(() => {
|
||||||
App.RaiseException(repo, "Invalid external merge tool settings!");
|
App.RaiseException(repo, "Invalid external merge tool settings!");
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!File.Exists(tool)) {
|
if (!File.Exists(tool)) {
|
||||||
|
Dispatcher.UIThread.Invoke(() => {
|
||||||
App.RaiseException(repo, $"Can NOT found external merge tool in '{tool}'!");
|
App.RaiseException(repo, $"Can NOT found external merge tool in '{tool}'!");
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,12 +27,16 @@ namespace SourceGit.Commands {
|
||||||
|
|
||||||
public static bool OpenForDiff(string repo, string tool, string diffCmd, Models.DiffOption option) {
|
public static bool OpenForDiff(string repo, string tool, string diffCmd, Models.DiffOption option) {
|
||||||
if (string.IsNullOrWhiteSpace(tool) || string.IsNullOrWhiteSpace(diffCmd)) {
|
if (string.IsNullOrWhiteSpace(tool) || string.IsNullOrWhiteSpace(diffCmd)) {
|
||||||
|
Dispatcher.UIThread.Invoke(() => {
|
||||||
App.RaiseException(repo, "Invalid external merge tool settings!");
|
App.RaiseException(repo, "Invalid external merge tool settings!");
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!File.Exists(tool)) {
|
if (!File.Exists(tool)) {
|
||||||
|
Dispatcher.UIThread.Invoke(() => {
|
||||||
App.RaiseException(repo, $"Can NOT found external merge tool in '{tool}'!");
|
App.RaiseException(repo, $"Can NOT found external merge tool in '{tool}'!");
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using Avalonia.Threading;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -35,7 +36,9 @@ namespace SourceGit.Commands {
|
||||||
|
|
||||||
return rs;
|
return rs;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Dispatcher.UIThread.Invoke(() => {
|
||||||
App.RaiseException(repo, "Save change to patch failed: " + e.Message);
|
App.RaiseException(repo, "Save change to patch failed: " + e.Message);
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using Avalonia.Threading;
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
@ -51,7 +52,9 @@ namespace SourceGit.Commands {
|
||||||
|
|
||||||
return rs;
|
return rs;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Dispatcher.UIThread.Invoke(() => {
|
||||||
App.RaiseException(repo, "Save file failed: " + e.Message);
|
App.RaiseException(repo, "Save file failed: " + e.Message);
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,9 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Adding remote ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription("Adding remote ...");
|
|
||||||
var succ = new Commands.Remote(_repo.FullPath).Add(_name, _url);
|
var succ = new Commands.Remote(_repo.FullPath).Add(_name, _url);
|
||||||
if (succ) {
|
if (succ) {
|
||||||
SetProgressDescription("Fetching from added remote ...");
|
SetProgressDescription("Fetching from added remote ...");
|
||||||
|
|
|
@ -47,6 +47,8 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Adding submodule...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
var succ = new Commands.Submodule(_repo.FullPath).Add(_url, _relativePath, Recursive, SetProgressDescription);
|
var succ = new Commands.Submodule(_repo.FullPath).Add(_url, _relativePath, Recursive, SetProgressDescription);
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
|
|
|
@ -51,6 +51,8 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Apply patch...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
var succ = new Commands.Apply(_repo.FullPath, _patchFile, _ignoreWhiteSpace, SelectedWhiteSpaceMode.Arg).Exec();
|
var succ = new Commands.Apply(_repo.FullPath, _patchFile, _ignoreWhiteSpace, SelectedWhiteSpaceMode.Arg).Exec();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
|
|
|
@ -42,9 +42,15 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Archiving ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
var succ = new Commands.Archive(_repo.FullPath, _revision, _saveFile, SetProgressDescription).Exec();
|
var succ = new Commands.Archive(_repo.FullPath, _revision, _saveFile, SetProgressDescription).Exec();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => {
|
||||||
|
_repo.SetWatcherEnabled(true);
|
||||||
|
if (succ) App.SendNotification(_repo.FullPath, $"Save archive to : {_saveFile}");
|
||||||
|
});
|
||||||
|
|
||||||
return succ;
|
return succ;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,9 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = $"Checkout '{Branch}' ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription($"Checkout '{Branch}' ...");
|
|
||||||
var succ = new Commands.Checkout(_repo.FullPath).Branch(Branch, SetProgressDescription);
|
var succ = new Commands.Checkout(_repo.FullPath).Branch(Branch, SetProgressDescription);
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
|
|
|
@ -21,8 +21,9 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = $"Cherry-Pick commit '{Target.SHA}' ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription($"Cherry-Pick commit '{Target.SHA}' ...");
|
|
||||||
var succ = new Commands.CherryPick(_repo.FullPath, Target.SHA, !AutoCommit).Exec();
|
var succ = new Commands.CherryPick(_repo.FullPath, Target.SHA, !AutoCommit).Exec();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
|
|
|
@ -10,8 +10,8 @@ namespace SourceGit.ViewModels {
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
ProgressDescription = "Cleanup (GC & prune) ...";
|
ProgressDescription = "Cleanup (GC & prune) ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription("Run GC ...");
|
|
||||||
new Commands.GC(_repo.FullPath, SetProgressDescription).Exec();
|
new Commands.GC(_repo.FullPath, SetProgressDescription).Exec();
|
||||||
|
|
||||||
var lfs = new Commands.LFS(_repo.FullPath);
|
var lfs = new Commands.LFS(_repo.FullPath);
|
||||||
|
|
|
@ -9,6 +9,8 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Clear all stashes...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
new Commands.Stash(_repo.FullPath).Clear();
|
new Commands.Stash(_repo.FullPath).Clear();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
|
|
|
@ -59,6 +59,8 @@ namespace SourceGit.ViewModels {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
|
ProgressDescription = "Clone ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
var cmd = new Commands.Clone(HostPageId, _parentFolder, _remote, _local, _useSSH ? _sshKey : "", _extraArgs, SetProgressDescription);
|
var cmd = new Commands.Clone(HostPageId, _parentFolder, _remote, _local, _useSSH ? _sshKey : "", _extraArgs, SetProgressDescription);
|
||||||
if (!cmd.Exec()) return false;
|
if (!cmd.Exec()) return false;
|
||||||
|
|
|
@ -50,6 +50,8 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Create tag...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
Commands.Tag.Add(_repo.FullPath, TagName, _basedOn, Message);
|
Commands.Tag.Add(_repo.FullPath, TagName, _basedOn, Message);
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
|
|
|
@ -15,6 +15,8 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Deleting branch...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
if (Target.IsLocal) {
|
if (Target.IsLocal) {
|
||||||
Commands.Branch.Delete(_repo.FullPath, Target.Name);
|
Commands.Branch.Delete(_repo.FullPath, Target.Name);
|
||||||
|
|
|
@ -15,8 +15,9 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Deleting remote ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription("Deleting remote ...");
|
|
||||||
var succ = new Commands.Remote(_repo.FullPath).Delete(Remote.Name);
|
var succ = new Commands.Remote(_repo.FullPath).Delete(Remote.Name);
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
|
|
|
@ -16,6 +16,8 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Deleting submodule ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
var succ = new Commands.Submodule(_repo.FullPath).Delete(Submodule);
|
var succ = new Commands.Submodule(_repo.FullPath).Delete(Submodule);
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
|
|
|
@ -21,8 +21,9 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = $"Deleting tag '{Target.Name}' ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription($"Deleting tag '{Target.Name}' ...");
|
|
||||||
var remotes = ShouldPushToRemote ? _repo.Remotes : null;
|
var remotes = ShouldPushToRemote ? _repo.Remotes : null;
|
||||||
var succ = Commands.Tag.Delete(_repo.FullPath, Target.Name, remotes);
|
var succ = Commands.Tag.Delete(_repo.FullPath, Target.Name, remotes);
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
|
|
|
@ -30,12 +30,12 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = _changes == null ? "Discard all local changes ..." : $"Discard total {_changes.Count} changes ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
if (_changes == null) {
|
if (_changes == null) {
|
||||||
SetProgressDescription("Discard all local changes ...");
|
|
||||||
Commands.Discard.All(_repo.FullPath);
|
Commands.Discard.All(_repo.FullPath);
|
||||||
} else {
|
} else {
|
||||||
SetProgressDescription($"Discard total {_changes.Count} changes ...");
|
|
||||||
Commands.Discard.Changes(_repo.FullPath, _changes);
|
Commands.Discard.Changes(_repo.FullPath, _changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ namespace SourceGit.ViewModels {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
|
ProgressDescription = $"Dropping stash: {Stash.Name}";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
new Commands.Stash(_repo).Drop(Stash.Name);
|
new Commands.Stash(_repo).Drop(Stash.Name);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -68,9 +68,9 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
return Task.Run(() => {
|
ProgressDescription = $"Editing remote '{_remote.Name}' ...";
|
||||||
SetProgressDescription($"Editing remote '{_remote.Name}' ...");
|
|
||||||
|
|
||||||
|
return Task.Run(() => {
|
||||||
if (_remote.Name != _name) {
|
if (_remote.Name != _name) {
|
||||||
var succ = new Commands.Remote(_repo.FullPath).Rename(_remote.Name, _name);
|
var succ = new Commands.Remote(_repo.FullPath).Rename(_remote.Name, _name);
|
||||||
if (succ) _remote.Name = _name;
|
if (succ) _remote.Name = _name;
|
||||||
|
|
|
@ -21,8 +21,9 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Fast-Forward ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription("Fast-Forward ...");
|
|
||||||
new Commands.Fetch(_repo.FullPath, To.Remote, Local.Name, To.Name, SetProgressDescription).Exec();
|
new Commands.Fetch(_repo.FullPath, To.Remote, Local.Name, To.Name, SetProgressDescription).Exec();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -14,8 +14,9 @@ namespace SourceGit.ViewModels {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
|
ProgressDescription = $"Initialize git repository at: '{_targetPath}'";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription($"Initialize git repository at: '{_targetPath}'");
|
|
||||||
var succ = new Commands.Init(HostPageId, _targetPath).Exec();
|
var succ = new Commands.Init(HostPageId, _targetPath).Exec();
|
||||||
if (!succ) return false;
|
if (!succ) return false;
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,8 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Init git-flow ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
var succ = new Commands.GitFlow(_repo.FullPath).Init(_repo.Branches, _master, _develop, _featurePrefix, _releasePrefix, _hotfixPrefix, _tagPrefix);
|
var succ = new Commands.GitFlow(_repo.FullPath).Init(_repo.Branches, _master, _develop, _featurePrefix, _releasePrefix, _hotfixPrefix, _tagPrefix);
|
||||||
if (succ) {
|
if (succ) {
|
||||||
|
|
|
@ -51,8 +51,9 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = $"Merging '{Source}' into '{Into}' ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription($"Merging '{Source}' into '{Into}' ...");
|
|
||||||
var succ = new Commands.Merge(_repo.FullPath, Source, SelectedMode.Arg, SetProgressDescription).Exec();
|
var succ = new Commands.Merge(_repo.FullPath, Source, SelectedMode.Arg, SetProgressDescription).Exec();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
|
|
|
@ -15,8 +15,9 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Run `prune` on remote ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription("Run `prune` on remote ...");
|
|
||||||
var succ = new Commands.Remote(_repo.FullPath).Prune(Remote.Name);
|
var succ = new Commands.Remote(_repo.FullPath).Prune(Remote.Name);
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
|
|
|
@ -111,9 +111,11 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
return Task.Run(() => {
|
|
||||||
var remoteBranchName = _selectedRemoteBranch.Name.Replace(" (new)", "");
|
var remoteBranchName = _selectedRemoteBranch.Name.Replace(" (new)", "");
|
||||||
SetProgressDescription($"Push {_selectedLocalBranch.Name} -> {_selectedRemote.Name}/{remoteBranchName} ...");
|
ProgressDescription = $"Push {_selectedLocalBranch.Name} -> {_selectedRemote.Name}/{remoteBranchName} ...";
|
||||||
|
|
||||||
|
return Task.Run(() => {
|
||||||
var succ = new Commands.Push(
|
var succ = new Commands.Push(
|
||||||
_repo.FullPath,
|
_repo.FullPath,
|
||||||
_selectedLocalBranch.Name,
|
_selectedLocalBranch.Name,
|
||||||
|
|
|
@ -26,8 +26,9 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = $"Pushing tag '{Target.Name}' to remote '{SelectedRemote.Name}' ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription($"Pushing tag '{Target.Name}' to remote '{SelectedRemote.Name}' ...");
|
|
||||||
var succ = new Commands.Push(_repo.FullPath, SelectedRemote.Name, Target.Name, false).Exec();
|
var succ = new Commands.Push(_repo.FullPath, SelectedRemote.Name, Target.Name, false).Exec();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
|
|
|
@ -37,6 +37,8 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Rebasing ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
var succ = new Commands.Rebase(_repo.FullPath, _revision, AutoStash).Exec();
|
var succ = new Commands.Rebase(_repo.FullPath, _revision, AutoStash).Exec();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
|
|
|
@ -39,8 +39,9 @@ namespace SourceGit.ViewModels {
|
||||||
if (_name == Target.Name) return null;
|
if (_name == Target.Name) return null;
|
||||||
|
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = $"Rename '{Target.Name}'";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription($"Rename '{Target.Name}'");
|
|
||||||
var succ = Commands.Branch.Rename(_repo.FullPath, Target.Name, _name);
|
var succ = Commands.Branch.Rename(_repo.FullPath, Target.Name, _name);
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
|
|
|
@ -53,8 +53,9 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = $"Reset current branch to {To.SHA} ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription($"Reset current branch to {To.SHA} ...");
|
|
||||||
var succ = new Commands.Reset(_repo.FullPath, To.SHA, SelectedMode.Arg).Exec();
|
var succ = new Commands.Reset(_repo.FullPath, To.SHA, SelectedMode.Arg).Exec();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
|
|
|
@ -21,8 +21,9 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = $"Revert commit '{Target.SHA}' ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription($"Revert commit '{Target.SHA}' ...");
|
|
||||||
var succ = new Commands.Revert(_repo.FullPath, Target.SHA, AutoCommit).Exec();
|
var succ = new Commands.Revert(_repo.FullPath, Target.SHA, AutoCommit).Exec();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
|
|
|
@ -25,8 +25,9 @@ namespace SourceGit.ViewModels {
|
||||||
if (_message == Head.FullMessage) return null;
|
if (_message == Head.FullMessage) return null;
|
||||||
|
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = $"Editing head commit message ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
SetProgressDescription($"Editing head commit message ...");
|
|
||||||
var succ = new Commands.Commit(_repo.FullPath, _message, true, true).Exec();
|
var succ = new Commands.Commit(_repo.FullPath, _message, true, true).Exec();
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
return succ;
|
return succ;
|
||||||
|
|
|
@ -29,6 +29,8 @@ namespace SourceGit.ViewModels {
|
||||||
|
|
||||||
public override Task<bool> Sure() {
|
public override Task<bool> Sure() {
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = "Squashing ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
var succ = new Commands.Reset(_repo.FullPath, Parent.SHA, "--soft").Exec();
|
var succ = new Commands.Reset(_repo.FullPath, Parent.SHA, "--soft").Exec();
|
||||||
if (succ) succ = new Commands.Commit(_repo.FullPath, _message, true).Exec();
|
if (succ) succ = new Commands.Commit(_repo.FullPath, _message, true).Exec();
|
||||||
|
|
|
@ -42,6 +42,8 @@ namespace SourceGit.ViewModels {
|
||||||
if (jobs.Count == 0) return null;
|
if (jobs.Count == 0) return null;
|
||||||
|
|
||||||
_repo.SetWatcherEnabled(false);
|
_repo.SetWatcherEnabled(false);
|
||||||
|
ProgressDescription = $"Stash changes ...";
|
||||||
|
|
||||||
return Task.Run(() => {
|
return Task.Run(() => {
|
||||||
new Commands.Stash(_repo.FullPath).Push(jobs, Message);
|
new Commands.Stash(_repo.FullPath).Push(jobs, Message);
|
||||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||||
|
|
Loading…
Reference in a new issue