1

我已经使用 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 文件中 - 只有一个类)。

4

1 回答 1

0

你真的需要一个钩子脚本吗?在我看来,VisualSVN Server 的 Web 界面具有您需要的功能。

修订日志查看器显示更改的行号,您还可以共享指向特定行的链接。这是演示服务器上的示例

在此处输入图像描述

您还可以使用高级责备查看器。这是演示服务器上的示例

在此处输入图像描述

于 2020-01-23T13:43:31.647 回答