コード例 #1
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);
                var cmd           = _gitTagController.GetCreateTagCommand(createTagArgs);
                UICommands.StartCommandLineProcessDialog(cmd, this);
            }

            return(currentTag);
        }
コード例 #2
0
        public void CreateTagWithMessageWritesTagMessageFile()
        {
            var args = new GitCreateTagArgs("tagname", "00000", TagOperation.Annotate, "hello world");

            _controller.GetCreateTagCommand(args);

            _fileSystem.File.Received(1).WriteAllText(_tagMessageFile, "hello world");
        }
コード例 #3
0
ファイル: FormCreateTag.cs プロジェクト: zlolik/gitextensions
        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);
            var cmd = _gitTagController.GetCreateTagCommand(createTagArgs);

            if (!UICommands.StartCommandLineProcessDialog(cmd, this))
            {
                return(string.Empty);
            }

            DialogResult = DialogResult.OK;
            return(textBoxTagName.Text);
        }