Example #1
0
    public void AssertMergeMessage(string message, bool isMergeCommit, string expectedVersion)
    {
        var c = new MockCommit
        {
            MessageEx = message,
            ParentsEx = isMergeCommit ? new List <Commit> {
                null, null
            } : new List <Commit> {
                null
            }
        };

        string versionPart;
        var    parsed = MergeMessageParser.TryParse(c, out versionPart);

        if (expectedVersion == null)
        {
            parsed.ShouldBe(false);
        }
        else
        {
            parsed.ShouldBe(true);
            versionPart.ShouldBe(expectedVersion);
        }
    }
 public void ProcessAllTheCommits()
 {
     using (var repository = new Repository(@"C:\Code\NServiceBus"))
     {
         foreach (var branch in repository.Branches)
         {
             foreach (var commit in branch.Commits)
             {
                 ShortVersion version;
                 if (MergeMessageParser.TryParse(commit, out version))
                 {
                     Debug.WriteLine("{0}.{1}.{2}", version.Major, version.Minor, version.Patch);
                 }
             }
         }
     }
 }
 public void ProcessAllTheCommits()
 {
     using (var repository = new Repository(@"C:\Code\NServiceBus"))
     {
         foreach (var branch in repository.Branches)
         {
             foreach (var commit in branch.Commits)
             {
                 string versionPart;
                 if (MergeMessageParser.TryParse(commit, out versionPart))
                 {
                     Debug.WriteLine(versionPart);
                     SemanticVersion version;
                     if (SemanticVersion.TryParse(versionPart, out version))
                     {
                         Debug.WriteLine("{0}.{1}.{2}.{3}.{4}", version.Major, version.Minor, version.Patch, version.PreReleaseTag, version.BuildMetaData);
                     }
                 }
             }
         }
     }
 }
    static void AssertMereMessage(string message, string expectedVersion, List <Commit> parents)
    {
        var commit = new MockCommit
        {
            MessageEx = message,
            ParentsEx = parents
        };

        ShortVersion versionPart;
        var          parsed = MergeMessageParser.TryParse(commit, out versionPart);

        if (expectedVersion == null)
        {
            parsed.ShouldBe(false);
        }
        else
        {
            parsed.ShouldBe(true);
            var versionAsString = string.Format("{0}.{1}.{2}", versionPart.Major, versionPart.Minor, versionPart.Patch);
            versionAsString.ShouldBe(expectedVersion);
        }
    }