Пример #1
0
        private void RunFormTest(Func <FormCommit, Task> testDriverAsync, CommitKind commitKind = CommitKind.Normal)
        {
            UITest.RunForm(
                () =>
            {
                switch (commitKind)
                {
                case CommitKind.Normal:
                    Assert.True(_commands.StartCommitDialog(owner: null));
                    break;

                case CommitKind.Squash:
                    Assert.True(_commands.StartSquashCommitDialog(owner: null, _referenceRepository.Module.GetRevision()));
                    break;

                case CommitKind.Fixup:
                    Assert.True(_commands.StartFixupCommitDialog(owner: null, _referenceRepository.Module.GetRevision()));
                    break;

                default:
                    throw new ArgumentException($"Unsupported commit kind: {commitKind}", nameof(commitKind));
                }
            },
                testDriverAsync);
        }
Пример #2
0
        private void diffCommitSubmoduleChanges_Click(object sender, EventArgs e)
        {
            GitUICommands submodulCommands = new GitUICommands(Module.WorkingDir + DiffFiles.SelectedItem.Name.EnsureTrailingPathSeparator());

            submodulCommands.StartCommitDialog(this, false);
            RefreshArtificial();
        }
Пример #3
0
        private void diffCommitSubmoduleChanges_Click(object sender, EventArgs e)
        {
            var submodules = DiffFiles.SelectedItems.Where(it => it.IsSubmodule).Select(it => it.Name).Distinct().ToList();

            foreach (var name in submodules)
            {
                GitUICommands submodulCommands = new GitUICommands(_fullPathResolver.Resolve(name.EnsureTrailingPathSeparator()));
                submodulCommands.StartCommitDialog(this, false);
            }
            RefreshArtificial();
        }
Пример #4
0
 private void RunFormTest(Func <FormCommit, Task> testDriverAsync, CommitKind commitKind = CommitKind.Normal)
 {
     UITest.RunForm(
         showForm: () =>
     {
         Assert.True(commitKind switch
         {
             CommitKind.Normal => _commands.StartCommitDialog(owner: null),
             CommitKind.Squash => _commands.StartSquashCommitDialog(owner: null, _referenceRepository.Module.GetRevision()),
             CommitKind.Fixup => _commands.StartFixupCommitDialog(owner: null, _referenceRepository.Module.GetRevision()),
             _ => throw new ArgumentException($"Unsupported commit kind: {commitKind}", nameof(commitKind))
         });
     },
Пример #5
0
        public void Should_display_branch_and_no_remote_info_in_statusbar()
        {
            using (var repository = new ReferenceRepository(new GitModuleTestHelper("branch_and_no_remote")))
            {
                var commands = new GitUICommands(repository.Module);
                repository.CheckoutMaster();
                UITest.RunForm <FormCommit>(
                    () => { Assert.True(commands.StartCommitDialog(owner: null)); },
                    form =>
                {
                    var currentBranchNameLabelStatus = form.GetTestAccessor().CurrentBranchNameLabelStatus;
                    var remoteNameLabelStatus        = form.GetTestAccessor().RemoteNameLabelStatus;

                    Assert.AreEqual("master →", currentBranchNameLabelStatus.Text);
                    Assert.AreEqual("(remote not configured)", remoteNameLabelStatus.Text);
                    return(Task.CompletedTask);
                });
            }
        }
Пример #6
0
        public void Should_display_detached_head_info_in_statusbar()
        {
            using (var repository = new ReferenceRepository(new GitModuleTestHelper("detached_head")))
            {
                var commands = new GitUICommands(repository.Module);
                repository.CheckoutRevision();
                UITest.RunForm <FormCommit>(
                    () => { Assert.True(commands.StartCommitDialog(owner: null)); },
                    form =>
                {
                    var currentBranchNameLabelStatus = form.GetTestAccessor().CurrentBranchNameLabelStatus;
                    var remoteNameLabelStatus        = form.GetTestAccessor().RemoteNameLabelStatus;

                    Assert.AreEqual("(no branch)", currentBranchNameLabelStatus.Text);
                    Assert.AreEqual(string.Empty, remoteNameLabelStatus.Text);
                    return(Task.CompletedTask);
                });
            }
        }
Пример #7
0
 private void commitSubmoduleChanges_Click(object sender, EventArgs e)
 {
     GitUICommands submodulCommands = new GitUICommands(Module.WorkingDir + _currentItem.Name + Settings.PathSeparator.ToString());
     submodulCommands.StartCommitDialog(this, false);
     Initialize();
 }
            public void CommitSubmodule(IWin32Window owner, SubmoduleNode node)
            {
                var submodulCommands = new GitUICommands(node.Info.Path.EnsureTrailingPathSeparator());

                submodulCommands.StartCommitDialog(owner);
            }