开发者

How to programatically in c# get the latest top "n" commit messages from a svn repository

开发者 https://www.devze.com 2023-02-27 22:48 出处:网络
I\'d like to build a site whi开发者_StackOverflowch simply displays the top latest (by date, revision?) \"n\" commit logs plus other associated info.

I'd like to build a site whi开发者_StackOverflowch simply displays the top latest (by date, revision?) "n" commit logs plus other associated info.

What's the best way to do this? I started having a quick look at SharpSvn, but the GET seems to be based on Revision ranges rather than date.

I'd like a simple example for .Net in c# based on any available library which gets the job done.


Since you mentioned using SharpSVN, I happen to have written this in BuildMaster:

private static IList<string> GetLatestCommitMessages(Uri repository, int count)
{
    using (var client = new SvnClient())
    {
        System.Collections.ObjectModel.Collection<SvnLogEventArgs> logEntries;
        var args = new SvnLogArgs()
        {
            Limit = count
        };

        client.GetLog(repository, args, out logEntries);

        return logEntries.Select(log => log.LogMessage).ToList();
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消