Exemplo n.º 1
0
        private SemanticVersion IncrementForEachCommit(IEnumerable <ICommit> directCommits, SemanticVersion mainlineVersion, IBranch mainline)
        {
            foreach (var directCommit in directCommits)
            {
                var directCommitIncrement = IncrementStrategyFinder.GetIncrementForCommits(context, new[] { directCommit })
                                            ?? FindDefaultIncrementForBranch(context, mainline.Name.Friendly);
                mainlineVersion = mainlineVersion.IncrementVersion(directCommitIncrement);
                log.Info($"Direct commit on master {directCommit} incremented base versions {directCommitIncrement}, now {mainlineVersion}");
            }

            return(mainlineVersion);
        }
 private static SemanticVersion IncrementForEachCommit(GitVersionContext context, List <Commit> directCommits, SemanticVersion mainlineVersion, Branch mainline)
 {
     foreach (var directCommit in directCommits)
     {
         var directCommitIncrement = IncrementStrategyFinder.GetIncrementForCommits(context, new[]
         {
             directCommit
         }) ?? IncrementStrategyFinder.FindDefaultIncrementForBranch(context, mainline.FriendlyName);
         mainlineVersion = mainlineVersion.IncrementVersion(directCommitIncrement);
         Logger.WriteInfo($"Direct commit on master {directCommit.Sha} incremented base versions {directCommitIncrement}, now {mainlineVersion}");
     }
     return(mainlineVersion);
 }
 private static SemanticVersion IncrementForEachCommit(GitVersionContext context, List <Commit> directCommits, SemanticVersion mainlineVersion, string branch = null)
 {
     foreach (var directCommit in directCommits)
     {
         var directCommitIncrement = IncrementStrategyFinder.GetIncrementForCommits(context, new[]
         {
             directCommit
         }) ?? IncrementStrategyFinder.FindDefaultIncrementForBranch(context, branch);
         mainlineVersion = mainlineVersion.IncrementVersion(directCommitIncrement);
         Logger.WriteInfo(string.Format("Direct commit on master {0} incremented base versions {1}, now {2}",
                                        directCommit.Sha, directCommitIncrement, mainlineVersion));
     }
     return(mainlineVersion);
 }
        private SemanticVersion AggregateMergeCommitIncrement(Commit commit, List <Commit> directCommits, SemanticVersion mainlineVersion, Branch mainline)
        {
            // Merge commit, process all merged commits as a batch
            var mergeCommit          = commit;
            var mergedHead           = GetMergedHead(mergeCommit);
            var findMergeBase        = repositoryMetadataProvider.FindMergeBase(mergeCommit.Parents.First(), mergedHead);
            var findMessageIncrement = FindMessageIncrement(mergeCommit, mergedHead, findMergeBase, directCommits);

            // If this collection is not empty there has been some direct commits against master
            // Treat each commit as it's own 'release', we need to do this before we increment the branch
            mainlineVersion = IncrementForEachCommit(directCommits, mainlineVersion, mainline);
            directCommits.Clear();

            // Finally increment for the branch
            mainlineVersion = mainlineVersion.IncrementVersion(findMessageIncrement);
            log.Info($"Merge commit {mergeCommit.Sha} incremented base versions {findMessageIncrement}, now {mainlineVersion}");
            return(mainlineVersion);
        }
        SemanticVersion AggregateMergeCommitIncrement(GitVersionContext context, Commit commit, List <Commit> directCommits, SemanticVersion mainlineVersion)
        {
            // Merge commit, process all merged commits as a batch
            var mergeCommit          = commit;
            var mergedHead           = GetMergedHead(mergeCommit);
            var findMergeBase        = context.Repository.ObjectDatabase.FindMergeBase(mergeCommit.Parents.First(), mergedHead);
            var findMessageIncrement = FindMessageIncrement(context, mergeCommit, mergedHead, findMergeBase, directCommits);

            // If this collection is not empty there has been some direct commits against master
            // Treat each commit as it's own 'release', we need to do this before we increment the branch
            mainlineVersion = IncrementForEachCommit(context, directCommits, mainlineVersion);
            directCommits.Clear();

            // Finally increment for the branch
            mainlineVersion = mainlineVersion.IncrementVersion(findMessageIncrement);
            Logger.WriteInfo(string.Format("Merge commit {0} incremented base versions {1}, now {2}",
                                           mergeCommit.Sha, findMessageIncrement, mainlineVersion));
            return(mainlineVersion);
        }
Exemplo n.º 6
0
 private static SemanticVersion IncrementForEachCommit(GitVersionContext context, List<Commit> directCommits, SemanticVersion mainlineVersion)
 {
     foreach (var directCommit in directCommits)
     {
         var directCommitIncrement = IncrementStrategyFinder.GetIncrementForCommits(context, new[]
                                     {
                                         directCommit
                                     }) ?? VersionField.Patch;
         mainlineVersion = mainlineVersion.IncrementVersion(directCommitIncrement);
         Logger.WriteInfo(string.Format("Direct commit on master {0} incremented base versions {1}, now {2}", 
             directCommit.Sha, directCommitIncrement, mainlineVersion));
     }
     return mainlineVersion;
 }
Exemplo n.º 7
0
        SemanticVersion AggregateMergeCommitIncrement(GitVersionContext context, Commit commit, List<Commit> directCommits, SemanticVersion mainlineVersion)
        {
// Merge commit, process all merged commits as a batch
            var mergeCommit = commit;
            var mergedHead = GetMergedHead(mergeCommit);
            var findMergeBase = context.Repository.ObjectDatabase.FindMergeBase(mergeCommit.Parents.First(), mergedHead);
            var findMessageIncrement = FindMessageIncrement(context, mergeCommit, mergedHead, findMergeBase, directCommits);

            // If this collection is not empty there has been some direct commits against master
            // Treat each commit as it's own 'release', we need to do this before we increment the branch
            mainlineVersion = IncrementForEachCommit(context, directCommits, mainlineVersion);
            directCommits.Clear();

            // Finally increment for the branch
            mainlineVersion = mainlineVersion.IncrementVersion(findMessageIncrement);
            Logger.WriteInfo(string.Format("Merge commit {0} incremented base versions {1}, now {2}",
                mergeCommit.Sha, findMessageIncrement, mainlineVersion));
            return mainlineVersion;
        }