Пример #1
0
        private string CreateTag()
        {
            var objectId = commitPickerSmallControl1.SelectedObjectId;

            if (objectId is null)
            {
                MessageBox.Show(this, _noRevisionSelected.Text, _messageCaption.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return("");
            }

            var createTagArgs = new GitCreateTagArgs(textBoxTagName.Text,
                                                     objectId,
                                                     GetSelectedOperation(annotate.SelectedIndex),
                                                     tagMessage.Text,
                                                     textBoxGpgKey.Text,
                                                     ForceTag.Checked);
            var success = _gitTagController.CreateTag(createTagArgs, this);

            if (!success)
            {
                return("");
            }

            DialogResult = DialogResult.OK;
            return(textBoxTagName.Text);
        }
Пример #2
0
        private int CreateLostFoundTags()
        {
            var selectedLostObjects = Warnings.Rows
                                      .Cast <DataGridViewRow>()
                                      .Select(row => row.Cells[columnIsLostObjectSelected.Index])
                                      .Where(cell => (bool?)cell.Value == true)
                                      .Select(cell => _filteredLostObjects[cell.RowIndex])
                                      .ToList();

            if (selectedLostObjects.Count == 0)
            {
                MessageBox.Show(this, _selectLostObjectsToRestoreMessage.Text, _selectLostObjectsToRestoreCaption.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(0);
            }

            var currentTag = 0;

            foreach (var lostObject in selectedLostObjects)
            {
                currentTag++;
                var createTagArgs = new GitCreateTagArgs($"{RestoredObjectsTagPrefix}{currentTag}", lostObject.Hash);
                _gitTagController.CreateTag(createTagArgs, this);
            }

            return(currentTag);
        }
Пример #3
0
        public void CreateTagWithMessageAssignsTagMessageFile()
        {
            GitCreateTagArgs args = CreateDefaultArgs();

            args.OperationType = TagOperation.Annotate;

            _uiCommands.StartCommandLineProcessDialog(Arg.Do <IGitCommand>(
                                                          cmd =>
            {
                GitCreateTagCmd createTagCmd = cmd as GitCreateTagCmd;
                Assert.AreEqual(Path.Combine(WorkingDir, "TAGMESSAGE"), createTagCmd.TagMessageFileName);
            }
                                                          ), null);

            _controller.CreateTag(args, null);
            _uiCommands.Received(1).StartCommandLineProcessDialog(Arg.Any <IGitCommand>(), null);
        }
Пример #4
0
        private string CreateTag()
        {
            if (string.IsNullOrWhiteSpace(commitPickerSmallControl1.SelectedCommitHash))
            {
                MessageBox.Show(this, _noRevisionSelected.Text, _messageCaption.Text);
                return(string.Empty);
            }

            var createTagArgs = new GitCreateTagArgs(textBoxTagName.Text,
                                                     commitPickerSmallControl1.SelectedCommitHash,
                                                     GetSelectedOperation(annotate.SelectedIndex),
                                                     tagMessage.Text,
                                                     textBoxGpgKey.Text,
                                                     ForceTag.Checked);

            if (!_gitTagController.CreateTag(createTagArgs, this))
            {
                return(string.Empty);
            }

            DialogResult = DialogResult.OK;
            return(textBoxTagName.Text);
        }
        public void CreateTagWithMessageThrowsIfTheWindowIsNull()
        {
            var args = CreateAnnotatedTagArgs();

            Assert.Throws <ArgumentNullException>(() => _controller.CreateTag(args, null));
        }
Пример #6
0
        public void Tag_sign_with_default_gpg(bool force)
        {
            var result = _controller.CreateTag(Revision, TagName, force, TagOperation.SignWithDefaultKey, TagMessage);

            _module.Received(1).RunGitCmd($"tag {(force ? "-f" : "")} -s -F \"{WorkingDir}\\TAGMESSAGE\" \"{TagName}\" -- \"{Revision}\"");
        }