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.). eg
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.
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 :
You can also use an advanced blame viewer. Here is an example on the demo server :
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.