mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
refactor<*>: rewrite all codes...
This commit is contained in:
parent
89ff8aa744
commit
30ab8ae954
342 changed files with 17208 additions and 19633 deletions
50
src/Commands/Stash.cs
Normal file
50
src/Commands/Stash.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue