Search code examples
c#sharpsvn

Using client.status in c# with sharpsvn


I want to use the status method but i dont understand how it works. Could someone show me an example of use please?

EventHandler < SvnStatusEventArgs > statusHandler = new EventHandler<SvnStatusEventArgs>(void(object, SvnStatusEventArgs) target);
client.Status(path, statusHandler);

Solution

  • Well, it'll work exactly like the svn status command : http://svnbook.red-bean.com/en/1.0/re26.html

    You'll get the list of files pumped to the 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'
    }