sourcegit/src/Commands/Reset.cs

33 lines
907 B
C#
Raw Normal View History

using System.Collections.Generic;
2021-04-29 05:05:55 -07:00
using System.Text;
namespace SourceGit.Commands {
public class Reset : Command {
public Reset(string repo) {
WorkingDirectory = repo;
Context = repo;
2021-04-29 05:05:55 -07:00
Args = "reset";
}
public Reset(string repo, List<Models.Change> changes) {
WorkingDirectory = repo;
Context = repo;
2021-04-29 05:05:55 -07:00
var builder = new StringBuilder();
2021-04-29 05:05:55 -07:00
builder.Append("reset --");
foreach (var c in changes) {
2021-04-29 05:05:55 -07:00
builder.Append(" \"");
builder.Append(c.Path);
2021-04-29 05:05:55 -07:00
builder.Append("\"");
}
Args = builder.ToString();
}
public Reset(string repo, string revision, string mode) {
WorkingDirectory = repo;
Context = repo;
Args = $"reset {mode} {revision}";
}
2021-04-29 05:05:55 -07:00
}
}