How to set author of SVN commit using SharpSVN library in c# -
I use the SharpSvn library from Callsnet. I want to set up a revision writer while writing, but I always end a commitment with my Windows username.
This does not work for me:
System.Net.NetworkCredential oCred = New System.Net.NetworkCredential ("user", "pass"); Client.Authentication.DefaultCredentials = oCred; I have also tried:
client.SetProperty ("", "svn: author", "user"); But I get an error, the goal (the first argument) is bad.
Can you please tell me how to change the user in C #?
It all depends on how you join your repository, because the repository is responsible for adding A username for modification (this usually copies the credentials for the connection, but there is no need to do this).
When you use a file: /// store (which is usually not recommended - see) you can work around it directly on committed.
Using (SvnClient Client = New SVNClient ()) {client.Authentication.Clear (); // Clear the predefined handlers // Install a custom username handler client. Authentication UserNameHanders + = Delete (object sender, SVN Uuseram Ivant ARGS E) {e.UserName = "MyName"; }; SvnCommitArgs ca = New SvnCommitArgs {LogMessage = "Hello"} Customers Comet (dir, ca); } If you join a remote repository, you can change the author of a modification when a pre-modified change hook is established in the repository (see)
< Use of pre> (SVNCLent client = new SVN client ()) {client.SetRevisionProperty (New Yuri ("http: // my / repository"), 12345, SNN Proprobriernets. SNN author, "Mimaim"); // Large SharpSvn release only allowed obsolete syntax client only. Setting Property (new SVNUriTarget (new URI ("http: // my / repository"), 12345), SvnPropertyNames.SvnAuthor, "MyName"); } [2009-08-14] More recent SharpSvn releases also allow: using (SVNRipository client RC = new SVNRipository client ()) {SvnSetRevisionPropertyRepositoryArgs ra; Ra.CallPreRevPropChangeHook = false; Ra.CallPostRevPropChangeHook = false; Rc.SetRevisionProperty (@ "C: \ Repository in Path \", 12345, SvnPropertyNames.SvnAuthor, "MyName", RA); }
This final example considers direct file access to the repository, but bypasses the repository hooks for optimum performance.
Comments
Post a Comment