Search code examples
svnsharpsvn

How can I determine the trunk-revision used to create a branch with SharpSvn?


I am currently building a ChangeLog-generator, which is creating such a log by diff'ing the revisions of /trunk against /branch/... (which was created at some point from /trunk), to see which commits are not in the branch (and then does some fancy Redmine queries).

To minimize the log-range I wanted to optimize the query based on the revision used to create the branch as my offset.

I know the Stop on copy/rename feature of TortoiseSVN, to determine the revision used to create a specific branch or tag.

How can I achieve this with SharpSvn - or is there an easier way to determine the difference (to simplify the request: I will only diff /trunk against a descending branch ...).


Solution

  • I got this to work with the following code - yet I am unsure if this is the most elegant way to do so:

    var svnClient = new SvnClient();
    svnClient.GetLog(new Uri("http://..../REPOSITORY/BRANCH/FOO",
                     new SvnLogArgs
                     {
                       StrictNodeHistory = true
                     },
                     out logItems);
    var initRevision = logItems.OrderBy(arg => arg.Revision)
                               .First();
    var changedPath = initRevision.ChangedPaths.Single();
    //changedPath.CopyFromRevision
    //changedPath.CopyFromPath
    

    The thing that bugs me, is that I have to get the whole log, then order it accordingly to get the initial revision, which is used to retrieve the CopyFromRevision and CopyFromPath properties.