I use SharpSvn library from CollabNET. I would like to set revision author while commiting, but I always end up with a commit with my Windows user name.
This does not work for me:
System.Net.NetworkCredential oCred = new
System.Net.NetworkCredential("user", "pass");
client.Authentication.DefaultCredentials = oCred;
I’ve tried also:
client.SetProperty("", "svn:author", "user");
But I get an error that target (first argument) is bad.
So could you please tell me how to set user (author) of commit to subversion repository in c#?
This all depends on how you connect to your repository, as the repository is responsible for adding a username to the revision. (It usually copies the credentials for the connections but it doesn’t have to do that).
When you use a file:/// repository (which is usually not recommended – See The Subversion Book) you can work around this directly on the commit.
If you connect to a remote repository you can change the author of a revision when a pre-revprop-change hook is installed in the repository (See The Subversion Book)
[2009-08-14]
More recent SharpSvn releases also allow this:
This last example assumes direct file access to the repository, but it bypasses repository hooks for optimal performance.