コード例 #1
0
            static GitAutoVersion CalculateVersion(GitAutoVersion baseVersion, GitAutoVersionGitSubData data, Config config)
            {
                var branch = data.GitBranch;

                if (config.Branches.ContainsKey(branch))
                {
                    var configBranch      = config.Branches[branch];
                    var firstParentNumber = GitTool.GetCommitNumberCurrentBranchFirstParent(configBranch.ParentSha);
                    var sem           = SemVersion.Parse(configBranch.Version);
                    var patchNewValue = sem.Patch + firstParentNumber - 1;
                    var pathNewValue2 = patchNewValue < 0 ? 0 : patchNewValue;
                    var simple        = new GitAutoVersionSimple(sem.Major, sem.Minor,
                                                                 pathNewValue2,
                                                                 baseVersion.Special, baseVersion.BuildCounter, baseVersion.DateTime, baseVersion.Env);
                    return(new GitAutoVersion(data, simple));
                }
                else
                {
                    var firstParentNumber = data.GitCommitsCurrentBranchFirstParent;
                    var simple            = new GitAutoVersionSimple(baseVersion.Major, baseVersion.Minor,
                                                                     firstParentNumber, baseVersion.Special, baseVersion.BuildCounter, baseVersion.DateTime,
                                                                     baseVersion.Env);

                    return(new GitAutoVersion(data, simple));
                }
            }
コード例 #2
0
            static GitAutoVersion GetBaseGitAutoVersion(string special, int buildCounter, DateTime dateTime, string env)
            {
                var data        = GitTool.GetAllGitData();
                var simple      = new GitAutoVersionSimple(0, 0, 0, special, buildCounter, dateTime, env);
                var baseVersion = new GitAutoVersion(data, simple);

                return(baseVersion);
            }
コード例 #3
0
 public static GitAutoVersion Create(int buildCounter, DateTime buildDate)
 {
     if (GitAutoVersion != null)
     {
         return(GitAutoVersion);
     }
     lock (_padlock)
     {
         return(GitAutoVersion ?? (GitAutoVersion = GitAutoVersionFactoryInternal.CreateInternal(buildCounter, buildDate)));
     }
 }
コード例 #4
0
 public static GitAutoVersion Create()
 {
     if (GitAutoVersion != null)
     {
         return(GitAutoVersion);
     }
     lock (_padlock)
     {
         return(GitAutoVersion ?? (GitAutoVersion = GitAutoVersionFactoryInternal.CreateInternal()));
     }
 }