refactor<*>: rewrite all codes...

This commit is contained in:
leo 2021-04-29 20:05:55 +08:00
parent 89ff8aa744
commit 30ab8ae954
342 changed files with 17208 additions and 19633 deletions

50
src/Commands/Stash.cs Normal file
View file

@ -0,0 +1,50 @@
using System.Collections.Generic;
using System.Text;
namespace SourceGit.Commands {
/// <summary>
/// 单个贮藏相关操作
/// </summary>
public class Stash : Command {
public Stash(string repo) {
Cwd = repo;
}
public bool Push(List<string> files, string message, bool includeUntracked) {
StringBuilder builder = new StringBuilder();
builder.Append("stash push ");
if (includeUntracked) builder.Append("-u ");
builder.Append("-m \"");
builder.Append(message);
builder.Append("\" ");
if (files != null && files.Count > 0) {
builder.Append("--");
foreach (var f in files) {
builder.Append(" \"");
builder.Append(f);
builder.Append("\"");
}
}
Args = builder.ToString();
return Exec();
}
public bool Apply(string name) {
Args = $"stash apply -q {name}";
return Exec();
}
public bool Pop(string name) {
Args = $"stash pop -q {name}";
return Exec();
}
public bool Drop(string name) {
Args = $"stash drop -q {name}";
return Exec();
}
}
}