我已经使用 c# for windows 为 visualSVN 创建了 pre-commit 钩子和 post-commit 钩子,但在 pre-commit 钩子中,我还需要获取每个更新文件的行号,其中内容发生了更改(添加、删除或修改。)。例如
output.cs 的内容(在最新版本中):
private static string GetSvnLookOutput(string repos, string txn, string subcommand)
{
var processStartInfo = new ProcessStartInfo
{
FileName = "svnlook.exe",
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true,
RedirectStandardError = true,
Arguments = String.Format("{0} -t \"{1}\" \"{2}\"", subcommand, txn, repos)
};
var process = Process.Start(processStartInfo);
var output = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return output;
}
output.cs 的内容(最新版本):
private static string GetSvnLookOutput(string repos, string txn, string subcommand)
{
var processStartInfo = new ProcessStartInfo
{
FileName = "svnlook.exe",
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = false, // modified the value
RedirectStandardError = false,// modified the value
Arguments = String.Format("{0} -t \"{1}\" \"{2}\"", subcommand, txn, repos)
};
var process = Process.Start(processStartInfo);// deleted one line after this line
process.WaitForExit();
return output;
}
我需要知道行号(8,9,14)作为预提交挂钩中的输出。对于通过 c# 进行的预提交挂钩,我遵循了这个链接。
注意:我的最终要求是找出修改了哪个函数(在 .cs 文件中 - 只有一个类)。