mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 11:44:59 +00:00
code_style: move SourceGit.CommandExtensions
to SourceGit.ViewModels.CommandExtensions
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
afe5d4b969
commit
892f3b8032
4 changed files with 14 additions and 16 deletions
|
@ -1,11 +0,0 @@
|
|||
namespace SourceGit
|
||||
{
|
||||
public static class CommandExtensions
|
||||
{
|
||||
public static T Use<T>(this T cmd, Models.ICommandLog log) where T : Commands.Command
|
||||
{
|
||||
cmd.Log = log;
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -60,7 +60,7 @@
|
|||
{
|
||||
bool exists = new Remote(repo).HasBranch(remote, name);
|
||||
if (exists)
|
||||
return new Push(repo, remote, $"refs/heads/{name}", true).Use(log).Exec();
|
||||
return new Push(repo, remote, $"refs/heads/{name}", true) { Log = log }.Exec();
|
||||
|
||||
var cmd = new Command();
|
||||
cmd.WorkingDirectory = repo;
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace SourceGit.Commands
|
|||
{
|
||||
public static void All(string repo, bool includeIgnored, Models.ICommandLog log)
|
||||
{
|
||||
new Restore(repo).Use(log).Exec();
|
||||
new Clean(repo, includeIgnored).Use(log).Exec();
|
||||
new Restore(repo) { Log = log }.Exec();
|
||||
new Clean(repo, includeIgnored) { Log = log }.Exec();
|
||||
}
|
||||
|
||||
public static void Changes(string repo, List<Models.Change> changes, Models.ICommandLog log)
|
||||
|
@ -27,13 +27,13 @@ namespace SourceGit.Commands
|
|||
for (int i = 0; i < needClean.Count; i += 10)
|
||||
{
|
||||
var count = Math.Min(10, needClean.Count - i);
|
||||
new Clean(repo, needClean.GetRange(i, count)).Use(log).Exec();
|
||||
new Clean(repo, needClean.GetRange(i, count)) { Log = log }.Exec();
|
||||
}
|
||||
|
||||
for (int i = 0; i < needCheckout.Count; i += 10)
|
||||
{
|
||||
var count = Math.Min(10, needCheckout.Count - i);
|
||||
new Restore(repo, needCheckout.GetRange(i, count), "--worktree --recurse-submodules").Use(log).Exec();
|
||||
new Restore(repo, needCheckout.GetRange(i, count), "--worktree --recurse-submodules") { Log = log }.Exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,4 +84,13 @@ namespace SourceGit.ViewModels
|
|||
private StringBuilder _builder = new StringBuilder();
|
||||
private event Action<string> _onNewLineReceived;
|
||||
}
|
||||
|
||||
public static class CommandExtensions
|
||||
{
|
||||
public static T Use<T>(this T cmd, CommandLog log) where T : Commands.Command
|
||||
{
|
||||
cmd.Log = log;
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue