繁体   English   中英

如何获取在 svnlook 中添加、删除或修改内容的行号? (钩)

[英]How to get Line numbers where content added, deleted or modified in svnlook ? (hooking)

我已经使用 c# for windows 为visualSVN 创建了预提交钩子和后提交钩子,但在预提交钩子中,我还需要获取每个更新文件的行号,其中内容已更改(添加、删除或修改。)。 例如
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 文件中 - 只有一个类)。

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

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

在此处输入图片说明

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

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM