public static void OverrideVersionManuallyIfNeeded(this SemanticVersion version, IRepository repository, Config configuration)
 {
     var nextVersionTxtFileFinder = new NextVersionTxtFileFinder(repository.GetRepositoryDirectory(), configuration);
     SemanticVersion manualNextVersion ;
     if (nextVersionTxtFileFinder.TryGetNextVersion(out manualNextVersion))
     {
         if (manualNextVersion > version)
         {
             version.Major = manualNextVersion.Major;
             version.Minor = manualNextVersion.Minor;
             version.Patch = manualNextVersion.Patch;
         }
     }
 }
 public static void OverrideVersionManuallyIfNeeded(this SemanticVersion version, IRepository repository)
 {
     var nextVersionTxtFileFinder = new NextVersionTxtFileFinder(repository.GetRepositoryDirectory());
     var manualNextVersion = nextVersionTxtFileFinder.GetNextVersion();
     if (!manualNextVersion.IsEmpty())
     {
         if (manualNextVersion > version)
         {
             version.Major = manualNextVersion.Major;
             version.Minor = manualNextVersion.Minor;
             version.Patch = manualNextVersion.Patch;
         }
     }
 }
Example #3
0
 string GetKey(IRepository repo, string gitDir)
 {
     // Maybe using timestamp in .git/refs directory is enough?
     var ticks = fileSystem.GetLastDirectoryWrite(Path.Combine(gitDir, "refs"));
     var configPath = Path.Combine(repo.GetRepositoryDirectory(), "GitVersionConfig.yaml");
     var configText = fileSystem.Exists(configPath) ? fileSystem.ReadAllText(configPath) : null;
     var configHash = configText != null ? GetHash(configText) : null;
     return string.Join(":", gitDir, repo.Head.CanonicalName, repo.Head.Tip.Sha, ticks, configHash);
 }