Example #1
0
        public override GitCommit GetLastCommit(IGitRepository repo, string branch)
        {
            var rev    = new byte[20];
            var revStr = this.ExecuteGitCommand(repo, "log -1", "--pretty=format:%H");

            return(new GitCommit(revStr));
        }
Example #2
0
 public AmendCommitCommandTests()
 {
     eventStream = Mock.Of <IEventStream>();
     repository  = Mock.Of <IGitRepository>(x => x.Config == Mock.Of <LibGit2Sharp.Configuration>());
     mainThread  = Mock.Of <MainThread>();
     view        = Mock.Of <IChangesView>();
 }
Example #3
0
 public GitController(IGitRepository gitRepository, IFileParserService fileParserService, IRssFeedService rssFeedService, IConfiguration configuration)
 {
     _gitRepository     = gitRepository;
     _fileParserService = fileParserService;
     _rssFeedService    = rssFeedService;
     _configuration     = configuration;
 }
        public RepositoryTab(string git_repository_path)
        {
            git_repository_path_ = git_repository_path;

            InitializeComponent();

            UserControls.PendingTabViewModel pendingTabViewModel = (UserControls.PendingTabViewModel)PendingTab.DataContext;
            UserControls.StashTabViewModel   stashTabViewModel   = (UserControls.StashTabViewModel)StashTab.DataContext;
            UserControls.BranchTabViewModel  branchTabViewModel  = (UserControls.BranchTabViewModel)BranchTab.DataContext;
            UserControls.TagTabViewModel     tagTabViewModel     = (UserControls.TagTabViewModel)TagTab.DataContext;
            UserControls.RemoteTabViewModel  remoteTabViewModel  = (UserControls.RemoteTabViewModel)RemoteTab.DataContext;

            var viewModel = new ViewModels.RepositoryViewModel(git_repository_path,
                                                               this,
                                                               pendingTabViewModel,
                                                               stashTabViewModel,
                                                               branchTabViewModel,
                                                               tagTabViewModel,
                                                               remoteTabViewModel);

            DataContext = viewModel;

            pendingTabViewModel.SetGitRepository(viewModel);
            stashTabViewModel.SetGitRepository(viewModel);
            branchTabViewModel.SetGitRepository(viewModel);
            tagTabViewModel.SetGitRepository(viewModel);
            remoteTabViewModel.SetGitRepository(viewModel);

            IGitRepository gitRepository = viewModel;

            Plugin.PluginController.ConstructPluginToolbarButtons(toolBar, gitRepository);
        }
Example #5
0
        public override IEnumerable <string> EnumBranches(IGitRepository repo)
        {
            string stdout = this.ExecuteGitCommand(repo, "ls-remote --heads origin");

            return(BranchParsingRegex.Matches(stdout).Cast <Match>()
                   .Select(match => match.Groups["branch"].Value));
        }
Example #6
0
        public GetResponse <ResetResults> Reset(
            IGitRepository repo,
            GitPatcherVersioning patcherVersioning,
            CancellationToken cancel)
        {
            CheckoutRunnerBranch.Checkout(repo);

            var targets = GetRepoTarget.Get(
                repo,
                patcherVersioning);

            if (targets.Failed)
            {
                return(targets.BubbleFailure <ResetResults>());
            }

            var commit = RetrieveCommit.TryGet(
                repo,
                targets.Value,
                patcherVersioning,
                cancel);

            if (commit.Failed)
            {
                return(commit.BubbleFailure <ResetResults>());
            }

            cancel.ThrowIfCancellationRequested();

            _logger.Information("Checking out {TargetSha}", targets.Value.TargetSha);
            repo.ResetHard(commit.Value);

            return(new ResetResults(targets.Value, commit.Value.CommitMessage, commit.Value.CommitDate));
        }
        private static IEnumerable <ICommit> GetIntermediateCommits(IGitRepository repo, ICommit baseCommit, ICommit headCommit)
        {
            if (baseCommit == null)
            {
                yield break;
            }

            IEnumerable <ICommit> commitCache = intermediateCommitCache;

            if (commitCache == null || !Equals(commitCache.LastOrDefault(), headCommit))
            {
                commitCache             = repo.GetCommitsReacheableFromHead(headCommit);
                intermediateCommitCache = commitCache;
            }

            var found = false;

            foreach (var commit in commitCache)
            {
                if (found)
                {
                    yield return(commit);
                }

                if (commit.Sha == baseCommit.Sha)
                {
                    found = true;
                }
            }
        }
Example #8
0
 public LoadMessageOverridesFromFileSystemTask(ILogger <LoadMessageOverridesFromFileSystemTask> logger, ChangeLogConfiguration configuration, IGitRepository repository) : base(logger)
 {
     m_Logger           = logger ?? throw new ArgumentNullException(nameof(logger));
     m_Configuration    = configuration ?? throw new ArgumentNullException(nameof(configuration));
     m_Repository       = repository ?? throw new ArgumentNullException(nameof(repository));
     m_OverrideMessages = new(LoadOverrideMessages);
 }
Example #9
0
 public void RepositoryDesirableOtherwise(
     IGitRepository repo,
     CheckIfRepositoryDesirable sut)
 {
     sut.IsDesirable(repo)
     .Should().BeTrue();
 }
Example #10
0
 public static int Do(IGitRepository repository, Action<GitIndexInfo> indexAction)
 {
     int nr = 0;
     repository.CommandInputPipe(stdin => nr = Do(stdin, repository, indexAction),
         "update-index", "-z", "--index-info");
     return nr;
 }
Example #11
0
 public AppController(IHostingEnvironment hosting, IGitRepository repository, IMapper mapper, ILogger <AppController> logger)
 {
     _hosting    = hosting;
     _repository = repository;
     _mapper     = mapper;
     _logger     = logger;
 }
Example #12
0
        void CommitChanges(IGitRepository repository, IEnumerable <StatusEntry> entries, CommitDialog dialog)
        {
            if (mainThread.ShowDialog(dialog) == true)
            {
                if (!string.IsNullOrEmpty(dialog.NewBranchName))
                {
                    repository.Checkout(repository.CreateBranch(dialog.NewBranchName));
                }

                foreach (var entry in entries)
                {
                    repository.Stage(entry.FilePath);
                }

                eventStream.Push <Status>(0.5f);

                var signature = repository.Config.BuildSignature(DateTimeOffset.Now);

                repository.Commit(
                    dialog.Message,
                    signature,
                    signature,
                    CreateCommitOptions());
            }
        }
Example #13
0
        public static Branch SwitchToTargetBranch(this IGitRepository repository, CherryPickConfig config)
        {
            GetLocalAndRemoteBranch(repository, config.TargetBranch, config.TargetBranchRemote, out var targetBranch, out var targetBranchRemote);

            if (targetBranch == null && targetBranchRemote != null)
            {
                targetBranch = repository.CreateBranch(config.TargetBranch, targetBranchRemote.Tip);
            }

            if (targetBranch is null)
            {
                throw new InvalidOperationException(string.Format("Branch {0} not found", config.TargetBranch));
            }

            // Checkout target branch
            repository.Checkout(targetBranch);

            if (config.SyncTargetBranch && targetBranchRemote != null)
            {
                try
                {
                    // And try pull with fast forward from remote
                    repository.Merge(
                        targetBranchRemote,
                        repository.Config.BuildSignature(DateTimeOffset.Now),
                        new MergeOptions {
                        FastForwardStrategy = FastForwardStrategy.FastForwardOnly
                    });
                }
                catch (NonFastForwardException) { }
            }

            return(targetBranch);
        }
        public static VersionField?DetermineIncrementedField(IGitRepository repository, GitVersionContext context, BaseVersion baseVersion)
        {
            var commitMessageIncrement = FindCommitMessageIncrement(repository, context, baseVersion);
            var defaultIncrement       = context.Configuration.Increment.ToVersionField();

            // use the default branch config increment strategy if there are no commit message overrides
            if (commitMessageIncrement == null)
            {
                return(baseVersion.ShouldIncrement ? defaultIncrement : (VersionField?)null);
            }

            // cap the commit message severity to minor for alpha versions
            if (baseVersion.SemanticVersion < new SemanticVersion(1) && commitMessageIncrement > VersionField.Minor)
            {
                commitMessageIncrement = VersionField.Minor;
            }

            // don't increment for less than the branch config increment, if the absence of commit messages would have
            // still resulted in an increment of configuration.Increment
            if (baseVersion.ShouldIncrement && commitMessageIncrement < defaultIncrement)
            {
                return(defaultIncrement);
            }

            return(commitMessageIncrement);
        }
Example #15
0
        public CherryPickConfig(IGitRepository repository, string?baseBranch = default, string?targetBranch = default)
        {
            Repository = repository;

            BaseBranch        = baseBranch;
            this.targetBranch = targetBranch;
        }
 public async Task FailedGetRepoTargetReturnsFailure(
     IGitRepository repo,
     GitPatcherVersioning patcherVersioning,
     CancellationToken cancel,
     ResetToTarget sut)
 {
     sut.GetRepoTarget.Get(default !, default !).ReturnsForAnyArgs(GetResponse <RepoTarget> .Failure);
Example #17
0
 public RenameEdit(IGitRepository repository, string path, string pathTo, string newSha)
 {
     _repository = repository;
     _newSha = newSha;
     _path = path;
     _pathTo = pathTo;
 }
Example #18
0
        public GetResponse <ICommit> TryGet(
            IGitRepository repo,
            RepoTarget targets,
            GitPatcherVersioning patcherVersioning,
            CancellationToken cancel)
        {
            var commit = repo.TryGetCommit(targets.TargetSha, out var validSha);

            if (!validSha)
            {
                return(GetResponse <ICommit> .Fail("Malformed sha string"));
            }

            cancel.ThrowIfCancellationRequested();
            if (commit == null)
            {
                bool fetchIfMissing = ShouldFetchIfMissing.Should(patcherVersioning);
                if (!fetchIfMissing)
                {
                    return(GetResponse <ICommit> .Fail("Could not locate commit with given sha"));
                }
                repo.Fetch();
                commit = repo.TryGetCommit(targets.TargetSha, out _);
                if (commit == null)
                {
                    return(GetResponse <ICommit> .Fail("Could not locate commit with given sha"));
                }
            }

            return(GetResponse <ICommit> .Succeed(commit));
        }
Example #19
0
 public GeneralViewController(IGeneralView view, IGitRepository repository, ILogger logger)
 {
     m_view       = view;
     m_repository = repository;
     m_logger     = logger;
     m_view.SetController(this);
 }
Example #20
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();
        }
Example #21
0
        private IReadOnlyList <GitTag> GetMatchingTags(IExecutionContext context, IGitRepository repository)
        {
            IReadOnlyList <GitTag> matchingTags;

            if (m_TagNames is null)
            {
                matchingTags = Array.Empty <GitTag>();
            }
            else if (m_TagNames.Any())
            {
                var tagPatterns = m_TagNames.Select(x => new Wildcard(x)).ToList();

                // get tags matching the patterns
                matchingTags = repository.Tags
                               .Where(tag => tagPatterns.Any(pattern => pattern.IsMatch(tag.Name)))
                               .ToList();

                if (!matchingTags.Any())
                {
                    context.LogWarning($"The repository contains no tags matching any of the configured tag names {String.Join(", ", m_TagNames.Select(x => $"'{x}'"))}");
                }
            }
            else
            {
                matchingTags = Array.Empty <GitTag>();
            }

            return(matchingTags);
        }
Example #22
0
 public CommitCommand(IEventStream eventStream, MainThread mainThread, IGitRepository repository, IChangesView view)
 {
     this.eventStream = eventStream;
     this.mainThread  = mainThread;
     this.repository  = repository;
     this.view        = view;
 }
Example #23
0
        public IActionResult EditGitToken([FromBody] GitCredentialInputModel model,
                                          [FromServices] IGitRepository gitRepository)
        {
            //入力値チェック
            if (!ModelState.IsValid)
            {
                return(JsonBadRequest("Invalid inputs."));
            }

            var tenantId = CurrentUserInfo.SelectedTenant.Id;

            //まずは今の情報を取得
            var userGitMap = gitRepository.GetUserTenantGitMap(CurrentUserInfo.Id, tenantId, model.Id);

            if (userGitMap == null)
            {
                //今の値がないのはオカシイ。紐づけられていない情報を変更しようとしているとみなす。
                return(JsonBadRequest("Couldn't map the git to the current user & tenant. Please contact a user administrator."));
            }

            //変更
            userGitMap.GitToken = model.Token;

            unitOfWork.Commit();

            GitCredentialOutputModel result = new GitCredentialOutputModel(userGitMap);

            return(JsonOK(result));
        }
Example #24
0
 public void ResetsHard(
     IGitRepository repo,
     CheckoutRunnerBranch sut)
 {
     sut.Checkout(repo);
     repo.Received(1).ResetHard();
 }
Example #25
0
        static private List <GitDiffSection> getDiffSections(IGitRepository gitRepository,
                                                             string sha1, string sha2, string filename1, string filename2)
        {
            List <GitDiffSection> sections = new List <GitDiffSection>();

            List <string> diff = gitRepository.Diff(sha1, sha2, filename1, filename2, 0);

            foreach (string line in diff)
            {
                Match m = diffSectionRe.Match(line);
                if (!m.Success || m.Groups.Count < 3)
                {
                    continue;
                }

                if (!m.Groups["left_start"].Success || !m.Groups["right_start"].Success)
                {
                    continue;
                }

                // @@ -1 +1 @@ is essentially the same as @@ -1,1 +1,1 @@
                int leftSectionLength  = m.Groups["left_len"].Success ? int.Parse(m.Groups["left_len"].Value) : 1;
                int rightSectionLength = m.Groups["right_len"].Success ? int.Parse(m.Groups["right_len"].Value) : 1;

                GitDiffSection section;
                section.LeftSectionStart  = int.Parse(m.Groups["left_start"].Value);
                section.LeftSectionEnd    = section.LeftSectionStart + leftSectionLength;
                section.RightSectionStart = int.Parse(m.Groups["right_start"].Value);
                section.RightSectionEnd   = section.RightSectionStart + rightSectionLength;
                sections.Add(section);
            }

            return(sections);
        }
Example #26
0
 public void TryCreatesRunnerBranch(
     IGitRepository repo,
     CheckoutRunnerBranch sut)
 {
     sut.Checkout(repo);
     repo.Received(1).TryCreateBranch(CheckoutRunnerBranch.RunnerBranch);
 }
Example #27
0
 public GitLabLinkTask(ILogger <GitLabLinkTask> logger, ChangeLogConfiguration configuration, IGitRepository repository, IGitLabClientFactory clientFactory)
 {
     m_Logger        = logger ?? throw new ArgumentNullException(nameof(logger));
     m_Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
     m_Repository    = repository ?? throw new ArgumentNullException(nameof(repository));
     m_ClientFactory = clientFactory ?? throw new ArgumentNullException(nameof(clientFactory));
 }
 public void TagTargetEmptyReturnsFail(
     [Frozen] IGitRepository repo,
     GetRepoTarget sut)
 {
     sut.Get(repo, new GitPatcherVersioning(PatcherVersioningEnum.Tag, string.Empty))
     .Succeeded.Should().BeFalse();
 }
Example #29
0
 public RenameEdit(IGitRepository repository, GitChangeInfo changeInfo)
 {
     _repository = repository;
     NewSha = changeInfo.newSha;
     Path = changeInfo.path;
     PathTo = changeInfo.pathTo;
     Score = changeInfo.score;
 }
 public void TagTargetFetches(
     [Frozen] IGitRepository repo,
     string target,
     GetRepoTarget sut)
 {
     sut.Get(repo, new GitPatcherVersioning(PatcherVersioningEnum.Tag, target));
     repo.Received(1).Fetch();
 }
Example #31
0
 public RenameEdit(IGitRepository repository, GitChangeInfo changeInfo)
 {
     _repository = repository;
     NewSha      = changeInfo.newSha;
     Path        = changeInfo.path;
     PathTo      = changeInfo.pathTo;
     Score       = changeInfo.score;
 }
Example #32
0
 private static int Do(TextWriter stdin, IGitRepository repository, Action<GitIndexInfo> action)
 {
     using (var indexInfo = new GitIndexInfo(stdin, repository))
     {
         action(indexInfo);
         return indexInfo.nr;
     }
 }
 public void TagPassesToRepo(
     [Frozen] IGitRepository repo,
     string target,
     GetRepoTarget sut)
 {
     sut.Get(repo, new GitPatcherVersioning(PatcherVersioningEnum.Tag, target));
     repo.Received(1).TryGetTagSha(target, out Arg.Any <string?>());
 }
Example #34
0
        public override IEnumerable<string> EnumBranches(IGitRepository repo)
        {
            var result = this.ExecuteGitCommand(repo, "branches", "\"" + repo.RemoteRepositoryUrl + "\"");
            if (result.ExitCode != 0)
                throw new InvalidOperationException(string.Join(Environment.NewLine, result.Error.ToArray()));

            return result.Output;
        }
Example #35
0
 public PushCommand(IEventStream eventStream, MainThread mainThread, IGitRepository repository, CredentialsHandler credentialsProvider, SyncView view)
 {
     this.eventStream         = eventStream;
     this.mainThread          = mainThread;
     this.repository          = repository;
     this.credentialsProvider = credentialsProvider;
     this.view = view;
 }
Example #36
0
        public override byte[] GetLastCommit(IGitRepository repo, string branch)
        {
            var rev = new byte[20];
            var revStr = this.ExecuteGitCommand(repo, "log -1", "--pretty=format:%H");
            if (string.IsNullOrEmpty(revStr))
                return rev;

            for (int i = 0; i < rev.Length; i++)
                rev[i] = byte.Parse(revStr.Substring(i * 2, 2), NumberStyles.HexNumber);

            return rev;
        }
Example #37
0
        public override void UpdateLocalRepo(IGitRepository repo, string branch, string tag)
        {
            /*
             *  git fetch origin <branch>    | Get all changesets for the specified branch but does not apply them
             *  git reset --hard FETCH_HEAD  | Resets to the HEAD revision and removes commits that haven't been pushed
             *  git clean -dfq               | Remove all non-Git versioned files and directories from the repository directory
             */

            this.ExecuteGitCommand(repo, "fetch", repo.RemoteRepositoryUrl, branch, "--quiet");
            this.ExecuteGitCommand(repo, "reset --hard FETCH_HEAD --quiet");
            this.ExecuteGitCommand(repo, "clean -dfq");
        }
Example #38
0
        private void InitMocks4Tests(out IGitRepository gitRepository, out IGitTfsRemote remote)
        {
            // mock git repository
            gitRepository = _mocks.Get<IGitRepository>();
            gitRepository.Stub(r => r.HasRemote(Arg<string>.Is.Anything)).Return(true);
            _mocks.Get<Globals>().Repository = gitRepository;

            // mock tfs remote
            _mocks.Get<Globals>().UserSpecifiedRemoteId = "default";
            remote = MockRepository.GenerateStub<IGitTfsRemote>();
            gitRepository.Stub(r => r.ReadTfsRemote(Arg<string>.Is.Anything)).Return(remote);
        }
 /// <summary>
 /// Initializes a repository to always export meta data
 /// </summary>
 /// <param name="repository"></param>
 /// <param name="mappingFile"></param>
 public void InitializeConfig(IGitRepository repository, string mappingFile = null)
 {
     repository.SetConfig(GitTfsConstants.ExportMetadatasConfigKey, "true");
     if (!string.IsNullOrEmpty(mappingFile))
     {
         if (File.Exists(mappingFile))
         {
             File.Copy(mappingFile, exportMetadatasFilePath);
         }
         else
             throw new GitTfsException("error: the work items mapping file doesn't exist!");
     }
 }
Example #40
0
        public override byte[] GetLastCommit(IGitRepository repo, string branch)
        {
            var result = this.ExecuteGitCommand(repo, "lastcommit");
            if (result.ExitCode != 0)
                throw new InvalidOperationException(string.Join(Environment.NewLine, result.Error.ToArray()));

            var revStr = string.Join(string.Empty, result.Output.ToArray()).Trim();
            var rev = new byte[revStr.Length / 2];
            for (int i = 0; i < rev.Length; i++)
                rev[i] = byte.Parse(revStr.Substring(i * 2, 2), NumberStyles.HexNumber);

            return rev;
        }
Example #41
0
        public override void UpdateLocalRepo(IGitRepository repo, string branch, string tag)
        {
            ProcessResults result;

            var refspec = string.Format("refs/heads/{0}", string.IsNullOrEmpty(branch) ? "master" : branch);

            if (string.IsNullOrEmpty(tag))
                result = this.ExecuteGitCommand(repo, "get", "\"" + repo.RemoteRepositoryUrl + "\"", "\"" + refspec + "\"");
            else
                result = this.ExecuteGitCommand(repo, "gettag", "\"" + repo.RemoteRepositoryUrl + "\"", "\"" + tag + "\"", "\"" + refspec + "\"");

            if (result.ExitCode != 0)
                throw new InvalidOperationException(string.Join(Environment.NewLine, result.Error.ToArray()));
        }
Example #42
0
        private void InitMocks4Tests(string gitBranchToInit, out IGitRepository gitRepository, out IGitTfsRemote remote, out IGitTfsRemote newBranchRemote)
        {
            gitRepository = mocks.Get<IGitRepository>();
            mocks.Get<Globals>().Repository = gitRepository;
            mocks.Get<Globals>().GitDir = ".git";
            remote = MockRepository.GenerateStub<IGitTfsRemote>();
            remote.TfsUsername = "******";
            remote.TfsPassword = "******";
            remote.TfsRepositoryPath = "$/MyProject/Trunk";
            remote.TfsUrl = "http://myTfsServer:8080/tfs";
            remote.Tfs = new VsFake.TfsHelper(mocks.Container, null, null);
            gitRepository.Stub(r => r.GitDir).Return(".");

            newBranchRemote = MockRepository.GenerateStub<IGitTfsRemote>();
            newBranchRemote.Id = gitBranchToInit;
        }
Example #43
0
        public GitTfsRemote(RemoteInfo info, IGitRepository repository, RemoteOptions remoteOptions, Globals globals, ITfsHelper tfsHelper, TextWriter stdout)
        {
            this.remoteOptions = remoteOptions;
            this.globals = globals;
            this.stdout = stdout;
            Tfs = tfsHelper;
            Repository = repository;

            Id = info.Id;
            TfsUrl = info.Url;
            TfsRepositoryPath = info.Repository;
            TfsUsername = info.Username;
            TfsPassword = info.Password;
            Aliases = (info.Aliases ?? Enumerable.Empty<string>()).ToArray();
            IgnoreRegexExpression = info.IgnoreRegex;
            Autotag = info.Autotag;
        }
Example #44
0
        public GitTfsRemote(RemoteInfo info, IGitRepository repository, RemoteOptions remoteOptions, Globals globals,
            ITfsHelper tfsHelper, ConfigProperties properties)
        {
            _remoteOptions = remoteOptions;
            _globals = globals;
            _properties = properties;
            Tfs = tfsHelper;
            Repository = repository;

            RemoteInfo = info;
            Id = info.Id;
            TfsUrl = info.Url;
            TfsRepositoryPath = info.Repository;
            TfsUsername = info.Username;
            TfsPassword = info.Password;
            Aliases = (info.Aliases ?? Enumerable.Empty<string>()).ToArray();
            IgnoreRegexExpression = info.IgnoreRegex;
            IgnoreExceptRegexExpression = info.IgnoreExceptRegex;

            Autotag = info.Autotag;

            IsSubtree = CheckSubtree();
        }
Example #45
0
 public void RebaseOnto(IGitRepository repository, string tfsLatest, string target)
 {
     repository.CommandNoisy("rebase", "--preserve-merges", "--onto", tfsLatest, target);
 }
Example #46
0
 public RCheckinCommit(IGitRepository repo)
     : this()
 {
     _repo = repo;
     Commit = null;
     Sha = null;
     Message = null;
     Parents = null;
 }
Example #47
0
 public override void ApplyTag(IGitRepository repo, string tag)
 {
     var result = this.ExecuteGitCommand(repo, "tag", "\"" + repo.RemoteRepositoryUrl + "\"", "\"" + tag + "\"", "BuildMaster", "\"Tagged by BuildMaster\"");
     if (result.ExitCode != 0)
         throw new InvalidOperationException(string.Join(Environment.NewLine, result.Error.ToArray()));
 }
Example #48
0
 public override void CloneRepo(IGitRepository repo)
 {
     var result = this.ExecuteGitCommand(repo, "clone", "\"" + repo.RemoteRepositoryUrl + "\"");
     if (result.ExitCode != 0)
         throw new InvalidOperationException(string.Join(Environment.NewLine, result.Error.ToArray()));
 }
Example #49
0
 public Add(IGitRepository repository, GitChangeInfo changeInfo)
 {
     Repository = repository;
     Path = changeInfo.path;
     NewSha = changeInfo.newSha;
 }
Example #50
0
 public Copy(IGitRepository repository, GitChangeInfo changeInfo) : base(repository, changeInfo)
 {
     Path = changeInfo.pathTo;
 }
Example #51
0
 public override IEnumerable<string> EnumBranches(IGitRepository repo)
 {
     string stdout = this.ExecuteGitCommand(repo, "ls-remote --heads origin");
     return BranchParsingRegex.Matches(stdout).Cast<Match>()
         .Select(match => match.Groups["branch"].Value);
 }
Example #52
0
 private GitIndexInfo(TextWriter stdin, IGitRepository repository)
 {
     this.stdin = stdin;
     this.repository = repository;
 }
Example #53
0
 public Modify(IGitRepository repository, GitChangeInfo changeInfo)
 {
     _repository = repository;
     NewSha = changeInfo.newSha;
     Path = changeInfo.path;
 }
 public GitInfoController(IGitRepository _gitRepository)
 {
     gitRepository = _gitRepository;
 }
Example #55
0
 public override void ApplyTag(IGitRepository repo, string tag)
 {
     // tag the default branch (where -f replaces existing tag) with the value of label
     this.ExecuteGitCommand(repo, "tag -f", tag);
     this.ExecuteGitCommand(repo, "push", repo.RemoteRepositoryUrl, "--tags --quiet");
 }
Example #56
0
 public override void CloneRepo(IGitRepository repo)
 {
     throw new NotImplementedException();
 }
Example #57
0
 public RCheckinCommit(IGitRepository repo)
     : this()
 {
     this.repo = repo;
     this.Commit = null;
     this.Sha = null;
     this.Message = null;
     this.Parents = null;
 }
Example #58
0
 public Modify(IGitRepository repository, string path, string newSha)
 {
     _repository = repository;
     _newSha = newSha;
     _path = path;
 }
Example #59
0
 public void RebaseOnto(IGitRepository repository, string newBaseCommit, string oldBaseCommit)
 {
     repository.CommandNoisy("rebase", "--preserve-merges", "--onto", newBaseCommit, oldBaseCommit);
 }
Example #60
0
        private new string ExecuteGitCommand(IGitRepository repo, string gitCommand, params string[] options)
        {
            var results = base.ExecuteGitCommand(repo, gitCommand, options);
            if (results.ExitCode != 0)
                throw new InvalidOperationException(string.Join(" ", results.Error.ToArray()));

            return string.Join(Environment.NewLine, results.Output.ToArray());
        }