LoadFromPath() публичный статический Метод

Creates a new RepositoryInfo based on a path (that can be below the folder with the '.git' sub folder) and a function that can create a RepositoryInfoOptions from the actual Git repository path.
public static LoadFromPath ( string path, RepositoryInfoOptions>.Func optionsBuilder ) : RepositoryInfo
path string The path to lookup.
optionsBuilder RepositoryInfoOptions>.Func Function that can create a from the Git working directory (the Solution folder).
Результат RepositoryInfo
 public static RepositoryInfo GetRepositoryInfo(this ICakeContext context, RepositoryInfoOptions options = null)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     return(RepositoryInfo.LoadFromPath(context.Environment.WorkingDirectory.FullPath, options));
 }
Пример #2
0
        /// <summary>
        /// Creates a new <see cref="SimpleRepositoryInfo"/> based on a path (that can be below the folder with the '.git' sub folder).
        /// </summary>
        /// <param name="path">The path to lookup.</param>
        /// <param name="logger">Logger that will be used.</param>
        /// <param name="optionsChecker">
        /// Optional action that accepts the logger, a boolean that is true if a RepositoryInfo.xml has been
        /// found, and the <see cref="RepositoryInfoOptions"/> that will be used.
        /// </param>
        /// <returns>An immutable SimpleRepositoryInfo instance.</returns>
        static public SimpleRepositoryInfo LoadFromPath(ILogger logger, string path, Action <ILogger, bool, RepositoryInfoOptions> optionsChecker = null)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            RepositoryInfo info = RepositoryInfo.LoadFromPath(path, gitPath =>
            {
                string optionFile = Path.Combine(gitPath, "RepositoryInfo.xml");
                bool fileExists   = File.Exists(optionFile);
                var options       = fileExists ? RepositoryInfoOptions.Read(optionFile) : new RepositoryInfoOptions();
                optionsChecker?.Invoke(logger, fileExists, options);
                return(options);
            });

            return(new SimpleRepositoryInfo(logger, info));
        }
Пример #3
0
 public RepositoryInfo GetRepositoryInfo(string commitSha, TagsOverride tags = null)
 {
     return(RepositoryInfo.LoadFromPath(Path, new RepositoryInfoOptions {
         StartingCommitSha = commitSha, OverriddenTags = tags != null ? tags.Overrides : null
     }));
 }
Пример #4
0
 public RepositoryInfo GetRepositoryInfo(RepositoryInfoOptions options = null)
 {
     return(RepositoryInfo.LoadFromPath(Path, options));
 }