2024-02-05 23:08:37 -08:00
|
|
|
|
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) {
|
2024-02-05 23:08:37 -08:00
|
|
|
|
WorkingDirectory = repo;
|
|
|
|
|
Context = repo;
|
2021-04-29 05:05:55 -07:00
|
|
|
|
Args = "reset";
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
|
public Reset(string repo, List<Models.Change> changes) {
|
|
|
|
|
WorkingDirectory = repo;
|
|
|
|
|
Context = repo;
|
2021-04-29 05:05:55 -07:00
|
|
|
|
|
2024-02-05 23:08:37 -08:00
|
|
|
|
var builder = new StringBuilder();
|
2021-04-29 05:05:55 -07:00
|
|
|
|
builder.Append("reset --");
|
2024-02-05 23:08:37 -08:00
|
|
|
|
foreach (var c in changes) {
|
2021-04-29 05:05:55 -07:00
|
|
|
|
builder.Append(" \"");
|
2024-02-05 23:08:37 -08:00
|
|
|
|
builder.Append(c.Path);
|
2021-04-29 05:05:55 -07:00
|
|
|
|
builder.Append("\"");
|
|
|
|
|
}
|
|
|
|
|
Args = builder.ToString();
|
|
|
|
|
}
|
2024-02-05 23:08:37 -08:00
|
|
|
|
|
|
|
|
|
public Reset(string repo, string revision, string mode) {
|
|
|
|
|
WorkingDirectory = repo;
|
|
|
|
|
Context = repo;
|
|
|
|
|
Args = $"reset {mode} {revision}";
|
|
|
|
|
}
|
2021-04-29 05:05:55 -07:00
|
|
|
|
}
|
|
|
|
|
}
|