コード例 #1
0
        public async Task BranchUsingLocalGit(long buildId, string branchName)
        {
            VcsCommit commit = await GetCommitInformationByBuildId(buildId);

            if (commit == null)
            {
                Log.Info("Could not find commit for build. Skipping creation of branch step.");
                return;
            }

            IGitRepository gitRepository = _gitRepositoryFactory.Clone(commit);

            if (gitRepository == null)
            {
                throw new Exception("Unable to Clone Git Repository and create branch");
            }

            if (gitRepository.AddBranch(branchName, commit.CommitSha))
            {
                gitRepository.CheckoutBranch(branchName);
                gitRepository.Push(branchName);
            }

            gitRepository.DeleteFolder();
        }
コード例 #2
0
        public void Push()
        {
            Log.Info($"==== Push changes to TeamCity's settings git repository ====");

            _gitRepository.Push("master");

            _gitRepository.DeleteFolder();
        }