2024-02-05 23:08:37 -08:00
|
|
|
|
using System.Collections.Generic;
|
2021-04-29 05:05:55 -07:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
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-03-17 18:37:06 -07:00
|
|
|
|
public Reset(string repo, List<Models.Change> changes)
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
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-03-17 18:37:06 -07: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
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public Reset(string repo, string revision, string mode)
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
WorkingDirectory = repo;
|
|
|
|
|
Context = repo;
|
|
|
|
|
Args = $"reset {mode} {revision}";
|
2024-03-17 18:37:06 -07:00
|
|
|
|
}
|
2021-04-29 05:05:55 -07:00
|
|
|
|
}
|
2024-03-17 18:37:06 -07:00
|
|
|
|
}
|