0

I am trying to do diff --summarize in sharp svn via date. BUT the start revision should not be the first revision after the start date(atleast thats my understanding of the diff command with dates as flags) but with the first revision before the start date.

for the syntax of getdiffsummary(sharpsvn equivalent to diff --summarize) qoutesource

using (var client = new SvnClient())
{
   var location = new Uri("http://my.example/repos/trunk");
   client.DiffSummary(new SvnUriTarget(location, 12), new SvnUriTarget(location, SvnRevision.Head),
                      delegate(object sender, SvnDiffSummaryEventArgs e)
                      {
                        // TODO: Handle result
                      });
}

The Problem is, I dont know how to get the revision before the given date.

The Objectbrowser gave me:

SharpSvn.SvnUriTarget.SvnUriTarget(System.Uri, System.DateTime)

The Problem is, unlike an Revision Object where i could just do "revision b - 1" the date would just change.

Any ideas?

Git
  • 214
  • 5
  • 16
  • Oh sorry, I miss understood. You want the current revision you are looking at back to the previous of that spot, not from the head back 1 revision. I've got no idea, especially since using SvnRevision.Previous doesn't seem to work at all for DiffSummary. – icepicker Apr 13 '16 at 09:57
  • Im currently testing it via blame, -> getting revision after date, going back 1 revision and using that one for blame. – Git Apr 13 '16 at 10:05

1 Answers1

0

This is my solution so far. Forgot to post it =)

        private static SharpSvn.SvnRevision TimeToPreRevision(DateTime date, Uri link, SharpSvn.SvnClient client)
    {
        SvnRevision retr = new SvnRevision();
        DateTime retr_date = new DateTime();
        SvnLogArgs args = new SvnLogArgs { Start = date};
        client.Log(link, args, delegate (object sender3, SvnLogEventArgs e)
         {
             if (e.Time.Date < date.Date)
             {
                 if(retr.Time < e.Time)
                 {
                     retr = e.Revision;
                     retr_date = e.Time;
                 }
             }
         });
        return retr;
    }
Git
  • 214
  • 5
  • 16