1

I have created pre-commit hook and post-commit hook for visualSVN using c# for windows, but in pre-commit hook I also required to get the line numbers for each updated file where content got changed (added, deleted or modified.). e.g.
content of output.cs (in last revision):

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;
}

content of output.cs (in last revision):

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;
}

I need know the line number (8,9,14) as output in the pre-commit hook. For the pre-commit hooking through c# I followed this link .

NOTE : My end requirement is to find out the which function (in .cs file - with one class only) get modified.

BhushanK
  • 1,205
  • 6
  • 23
  • 39

1 Answers1

0

Do you really need a hook script? It seems to me that the web interface of VisualSVN Server has the feature you need.

Revision log viewer shows changed line numbers and you can also share a link to a specific line. Here is an example on the demo server:

enter image description here

You can also use an advanced blame viewer. Here is an example on the demo server:

enter image description here

bahrep
  • 29,961
  • 12
  • 103
  • 150