2

ツール svnmucc のように、SVN への複数のコミットを 1 回のパスで実行する C# コードを書いています。これまで、SVN との残りの必要な通信を SharpSvn を使用して行ってきたので、それを利用して次のことを達成できると考えています。

SharpSvn が使用する資格情報 (ユーザー名、パスワード) を取得するにはどうすればよいですか?

私はこのようなことをしたいと思います:

using (SvnClient svnClient = new SvnClient())
{
    SomeFictitiousCredentialsClass credentials = svnClient.Authentication.FictitiousGetCachedCredentialsMethod();

    // Call my code that performs svnmucc-like work here, passing username and password
    // obtained from 'credentials' variable.
}
4

2 に答える 2

1

Sharpsvn doesn't have an api that provides you the credentials from Subversion. It mostly implements the libsvn_client api, and at this level there is no access to this data.

SharpSvn gets a callback from the subversion libraries when these need credentials; in most cases after the builtin password store fails to authenticate.

If your svnmucc code also uses the Subversion apis, you can just plugin the subversion predefined authentication handlers..

SharpSvn itself doesn't have svnmucc support yet. (There was some talk about somebody who liked to add this to SharpSvn, but I haven't got any news about this lately)

于 2009-10-06T20:09:02.840 に答える
0

もう 1 つの答えは、SharpSvn の現在のすべてのバージョンで有効ですが、SvnMucc のサポートが SharpSvn の開発コードに組み込まれました。すぐに、.Net から SvnMucc のような操作を実行できるようになります。

using SharpSvn;

SvnCommitResult cr;
using (SvnMultiCommandClient mucc = new SvnMultiCommandClient("http://my-repos/svn/"))
{
    mucc.CreateDirectory("trunk");
    mucc.CreateDirectory("branches");
    mucc.CreateDirectory("tags");
    mucc.CreateDirectory("trunk/src");
    mucc.SetProperty("", "svn:auto-props", "*.cs = svn:eol-style=native");
    mucc.SetProperty("", "svn:global-ignores", "bin obj");

    mucc.Commit(out cr); // Commit r1
}
using (SvnClient client = new SvnClient())
{
   client.CheckOut("http://my-repos/svn/", @"C:\wc");
}

既存の SvnClient から操作を実行したい場合は、わずかに異なる構文を使用できますが、これが一般的な考え方です。

于 2013-12-15T20:04:41.567 に答える