Windows 用の c# を使用して、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;
}
pre-commit フックの出力として行番号 (8,9,14) を知る必要があります。c# を介したプレコミット フックについては、このリンクをたどりました。
注:私の最終要件は、どの関数(.csファイル内 - 1つのクラスのみ)が変更されるかを見つけることです。