Search code examples
c#sharpsvnsvn-update

SharpSVN update to specific revision c#


I'm iterating over the svn revisions from sourceRevision to targetRevision. In each iteration, I wish to update my repository to the revision I'm current in.

Something like:

SvnClient svnClient = new SvnClient();

svnClient.Update ("C:\Svn", 26592);

Any ideas?


Solution

  • You were on the right track. The revision number can be passed in via the SvnUpdateArgs object:

    SvnUpdateResult result;
    SvnUpdateArgs args = new SvnUpdateArgs();
    
    // If args.Revision is not set, it defaults to fetch the HEAD revision.
    if (revision > 0)
    {
        args.Revision = revision;
    }
    
    // Perform the update
    using (SvnClient client = GetClient())
    {
        client.Update(localPath, args, out result);
    }