1

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つのクラスのみ)が変更されるかを見つけることです。

4

1 に答える 1

0

フックスクリプトは本当に必要ですか? VisualSVN Server の Web インターフェイスには、必要な機能が備わっているように思えます。

リビジョン ログ ビューアには変更された行番号が表示され、特定の行へのリンクを共有することもできます。デモ サーバーでの例を次に示します。

ここに画像の説明を入力

高度な Blame Viewer を使用することもできます。デモ サーバーでの例を次に示します。

ここに画像の説明を入力

于 2020-01-23T13:43:31.647 に答える