mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
refactor<*>: rewrite all codes...
This commit is contained in:
parent
89ff8aa744
commit
30ab8ae954
342 changed files with 17208 additions and 19633 deletions
26
src/Commands/QueryFileContent.cs
Normal file
26
src/Commands/QueryFileContent.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace SourceGit.Commands {
|
||||
/// <summary>
|
||||
/// 取得指定提交下的某文件内容
|
||||
/// </summary>
|
||||
public class QueryFileContent : Command {
|
||||
private List<Models.TextLine> lines = new List<Models.TextLine>();
|
||||
private int added = 0;
|
||||
|
||||
public QueryFileContent(string repo, string commit, string path) {
|
||||
Cwd = repo;
|
||||
Args = $"show {commit}:\"{path}\"";
|
||||
}
|
||||
|
||||
public List<Models.TextLine> Result() {
|
||||
Exec();
|
||||
return lines;
|
||||
}
|
||||
|
||||
public override void OnReadline(string line) {
|
||||
added++;
|
||||
lines.Add(new Models.TextLine() { Number = added, Data = line });
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue