Reputation: 5839
How do I get a list of revisions from sharpsvn
Upvotes: 2
Views: 9026
Reputation: 112
This is the code form which you can get all the revisions no in list revisions numbers. UriSCpath will be uri for svn path.
SvnTarget tr = SvnTarget.FromUri(UriSCPath);
Collection<SvnLogEventArgs> logEventArgs;
List<Int64> revisionNumbers = new List<Int64>();
SvnLogArgs logArgs = new SvnLogArgs();
DPISVN_Clnt.GetLog(UriSCPath, logArgs, out logEventArgs);
Int64 latestReision = logEventArgs[0].Revision;
foreach (var item in logEventArgs)
{
revisionNumbers.Add(item.Revision);
}
Upvotes: 0
Reputation: 2787
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.
Upvotes: 4
Reputation: 4347
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.
Upvotes: 7
Reputation: 19612
Guessing at what your question really is about the answer is most likely SvnClient.Log(), to get you a list of changes of a path.
Another anwer would be:
for (int i = 1; i < 101; i++)
yield return i;
to get you the first 100 revisisions of a repository ;-)
See Using SharpSvn to retrieve log entries within a date range for some examples on how to use SvnClient.Log()
Upvotes: 2