トランザクションがコミットされたブランチを決定する C# で SVN フックを作成しようとしています。複数のブランチにコミットする可能性は低く、常識に反しますが、関係するすべてのブランチを知りたいと思っています。その部分はかなりうまく機能します。私が抱えている問題は、TortoiseSVN または VisualSVN サーバーのいずれかを介して、ローカル リポジトリを使用してローカル マシンでプログラムをデバッグすると、期待どおりに動作することです。フックを実際のサーバーに移動したところ、次の例外が発生しました。
Unable to connect to a repository at URL 'file:///D:/SvnRepos/test'
at SharpSvn.SvnClientArgs.HandleResult(SvnClientContext client, SvnException error, Object targets)
at SharpSvn.SvnClientArgs.HandleResult(SvnClientContext client, svn_error_t* error, Object targets)
at SharpSvn.SvnClient.InternalLog(ICollection`1 targets, Uri logRoot, SvnRevision altPegRev, SvnLogArgs args, EventHandler`1 logHandler)
at SharpSvn.SvnClient.Log(Uri target, SvnLogArgs args, EventHandler`1 logHandler)
...
Unable to open an ra_local session to URL
私のコード:
HashSet<string> branches = new HashSet<string>();
// connect to SVN server
using (SvnClient client = new SvnClient())
{
client.Authentication.Clear(); // Clear predefined handlers
// authentication
if (Credentials != null)
{
client.Authentication.UserNamePasswordHandlers
+= delegate(object obj, SharpSvn.Security.SvnUserNamePasswordEventArgs args)
{
args.UserName = Credentials.UserName;
args.Password = Credentials.Password;
};
client.Authentication.SslServerTrustHandlers += delegate(object sender, SvnSslServerTrustEventArgs e)
{
e.AcceptedFailures = e.Failures;
e.Save = true; // Save acceptance to authentication store
};
}
client.Log(
// ... of the specified repository ...
repository,
// ... and revision.
new SvnLogArgs(new SvnRevisionRange(revision, revision)),
// since only one revision is affected, a single set of log events is called
(o, e) =>
{
if (e.ChangedPaths != null)
{
foreach (var p in e.ChangedPaths)
{
...
}
}
else throw new NoChangedPathsException("List of changed paths could not be retrieved.");
});
}
return branches.ToArray<string>();
ここに非常によく似た質問があったことを知っており、提案された解決策をすべて試しました。どれも機能しませんでした。助けに感謝します。