Using client.status in C # with sharpsvn

I want to use the status method, but I do not understand how this works. Can someone show me a usage example?

EventHandler < SvnStatusEventArgs > statusHandler = new EventHandler<SvnStatusEventArgs>(void(object, SvnStatusEventArgs) target); client.Status(path, statusHandler); 
+4
source share
3 answers

Well, it will work just like the svn status : http://svnbook.red-bean.com/en/1.0/re26.html

You will get a list of files loaded in EventHandler:

 using(SvnClient client = /* set up a client */ ){ EventHandler<SvnStatusEventArgs> statusHandler = new EventHandler<SvnStatusEventArgs>(HandleStatusEvent); client.Status(@"c:\foo\some-working-copy", statusHandler); } ... void HandleStatusEvent (object sender, SvnStatusEventArgs args) { switch(args.LocalContentStatus){ case SvnStatus.Added: // Handle appropriately break; } // review other properties of 'args' } 
+3
source

Or, if you don't mind the built-in delegates:

 using(SvnClient client = new SvnClient()) { client.Status(path, delegate(object sender, SvnStatusEventArgs e) { if (e.LocalContentStatus == SvnStatus.Added) Console.WriteLine("Added {0}", e.FullPath); }); } 

Note that delegated versions of SharpSvn functions are always (tiny) bits faster than versions returning a collection, since this method allows you to sort the smallest amount of information in a managed world. You can use Svn * EventArgs.Detach () to marshal anyway. (This is what the .GetXXX () functions inside)

+3
source

The built-in delegate job worked for me, but the EventHandler<T> version didn't work until I set the EventHandler<SvnStatusEventArgs> .

+1
source

Source: https://habr.com/ru/post/1304135/


All Articles