Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a list of revision using sharpsvn

Tags:

c#

sharpsvn

How do I get a list of revisions from sharpsvn

like image 497
Chris Meek Avatar asked Jan 23 '26 04:01

Chris Meek


2 Answers

If you look at the metadata for SvnLogEventArgs (which is returned as a collection from GetLog) it derives from SvnLoggingEventArgs, which has properties of Author, Revision, Time and LogMessage (amongst others)

Each SvnLogEventArgs item has a collection of ChangedPaths, which have properties for SvnChangeAction, and Path.

like image 116
Luke Duddridge Avatar answered Jan 25 '26 13:01

Luke Duddridge


You can get a list of all the log info by this method:

var client = new SvnClient();

System.Collections.ObjectModel.Collection<SvnLogEventArgs> logEventArgs;

client.GetLog("targetPath", out logEventArgs);

Iterating through all the logEventArgs will give you some useful information - LogMessage, Author, etc.


I don't know what you're doing, but I am checking the latest version of the working copy using SvnWorkingCopyClient:

var workingCopyClient = new SvnWorkingCopyClient();

SvnWorkingCopyVersion version;

workingCopyClient.GetVersion(workingFolder, out version);

The latest version of the local working repository is then available through

long localRev = version.End;

For a remote repository, use

 var client = new SvnClient();

 SvnInfoEventArgs info;

 client.GetInfo(targetUri, out info);

 long remoteRev = info.Revision;

instead.

This is similar to using the svnversion tool from the command line. Hope this helps.

like image 40
CJBrew Avatar answered Jan 25 '26 12:01

CJBrew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!