Esempio n. 1
0
        public static bool LocateRepository(LocateRepository task)
        {
            try
            {
                task.Id = GitOperations.LocateRepository(task.Directory);
            }
            catch (Exception e)
            {
#if NET461
                foreach (var message in TaskImplementation.GetLog())
                {
                    task.Log.LogMessage(message);
                }
#endif
                task.Log.LogWarningFromException(e, showStackTrace: true);

                return(true);
            }

            if (task.Id == null)
            {
                task.Log.LogWarning(Resources.UnableToLocateRepository, task.Directory);
            }

            return(!task.Log.HasLoggedErrors);
        }
Esempio n. 2
0
 private protected override void Execute(GitRepository repository)
 {
     RepositoryId     = repository.GitDirectory;
     WorkingDirectory = repository.WorkingDirectory;
     Url        = GitOperations.GetRepositoryUrl(repository, RemoteName, Log.LogWarning);
     Roots      = GitOperations.GetSourceRoots(repository, RemoteName, Log.LogWarning);
     RevisionId = repository.GetHeadCommitSha();
 }
        public override bool Execute()
        {
            Id = GitOperations.LocateRepository(Directory);

            if (Id == null)
            {
                Log.LogError(Resources.UnableToLocateRepository, Directory);
            }

            return(!Log.HasLoggedErrors);
        }
Esempio n. 4
0
        public static bool LocateRepository(LocateRepository task)
        {
            task.Id = GitOperations.LocateRepository(task.Directory);

            if (task.Id == null)
            {
                task.Log.LogError(Resources.UnableToLocateRepository, task.Directory);
            }

            return(!task.Log.HasLoggedErrors);
        }
Esempio n. 5
0
        public override bool Execute()
        {
            Id = GitOperations.LocateRepository(Directory);

            if (Id == null)
            {
                Log.LogError($"Unable to locate repository containing directory '{Directory}'.");
                return(false);
            }

            return(true);
        }
Esempio n. 6
0
 public static bool GetUntrackedFiles(GetUntrackedFiles task) =>
 Execute(task, (repo, t) =>
 {
     t.UntrackedFiles = GitOperations.GetUntrackedFiles(repo, t.Files, t.ProjectDirectory, dir => new Repository(dir));
 });
Esempio n. 7
0
 public static bool GetSourceRoots(GetSourceRoots task) =>
 Execute(task, (repo, t) =>
 {
     t.Roots = GitOperations.GetSourceRoots(repo, t.Log.LogWarning, File.Exists);
 });
Esempio n. 8
0
 public static bool GetSourceRevisionId(GetSourceRevisionId task) =>
 Execute(task, (repo, t) =>
 {
     t.RevisionId = GitOperations.GetRevisionId(repo);
 });
Esempio n. 9
0
 public static bool GetRepositoryUrl(GetRepositoryUrl task) =>
 Execute(task, (repo, t) =>
 {
     t.Url = GitOperations.GetRepositoryUrl(repo, t.RemoteName);
 });
Esempio n. 10
0
 private protected override void Execute(GitRepository repository)
 {
     UntrackedFiles = GitOperations.GetUntrackedFiles(repository, Files, ProjectDirectory);
 }
Esempio n. 11
0
 private protected override void Execute(GitRepository repository)
 {
     UntrackedFiles = GitOperations.GetUntrackedFiles(
         repository, Files, ProjectDirectory, dir => GitRepository.OpenRepository(dir, repository.Environment));
 }