using System; namespace SourceGit.Commands { /// /// 子树相关操作 /// public class SubTree : Command { private Action handler = null; public SubTree(string repo) { Cwd = repo; TraitErrorAsOutput = true; } public override void OnReadline(string line) { handler?.Invoke(line); } public bool Add(string prefix, string source, string revision, bool squash, Action onProgress) { handler = onProgress; Args = $"subtree add --prefix=\"{prefix}\" {source} {revision}"; if (squash) Args += " --squash"; return Exec(); } public void Pull(string prefix, string source, string branch, bool squash, Action onProgress) { handler = onProgress; Args = $"subtree pull --prefix=\"{prefix}\" {source} {branch}"; if (squash) Args += " --squash"; Exec(); } public void Push(string prefix, string source, string branch, Action onProgress) { handler = onProgress; Args = $"subtree push --prefix=\"{prefix}\" {source} {branch}"; Exec(); } } }