Example #1
0
        public void CreateTagWithMessageAssignsTagMessageFile()
        {
            var args = new GitCreateTagArgs(TagName, Revision, TagOperation.Annotate);

            _uiCommands.StartCommandLineProcessDialog(Arg.Do <IGitCommand>(
                                                          cmd =>
            {
                var createTagCmd = cmd as GitCreateTagCmd;
                Assert.AreEqual(_tagMessageFile, createTagCmd.TagMessageFileName);
            }
                                                          ), null);

            _controller.CreateTag(args, null);
            _uiCommands.Received(1).StartCommandLineProcessDialog(Arg.Any <IGitCommand>(), null);
        }
        /// <summary>
        /// Create the Tag depending on input parameter.
        /// </summary>
        /// <param name="args">tag creation arguments</param>
        /// <param name="parentWindow">the UI window to act as the parent of the create tag dialog</param>
        /// <returns>the true if the tag is created.</returns>
        public bool CreateTag(GitCreateTagArgs args, IWin32Window parentWindow)
        {
            if (parentWindow == null)
            {
                throw new ArgumentNullException(nameof(parentWindow));
            }

            string tagMessageFileName = null;

            if (args.Operation.CanProvideMessage())
            {
                tagMessageFileName = Path.Combine(GetWorkingDirPath(), "TAGMESSAGE");
                _fileSystem.File.WriteAllText(tagMessageFileName, args.TagMessage);
            }

            var createTagCmd = new GitCreateTagCmd(args, tagMessageFileName);

            try
            {
                return(_uiCommands.StartCommandLineProcessDialog(createTagCmd, parentWindow));
            }
            finally
            {
                if (tagMessageFileName != null && _fileSystem.File.Exists(tagMessageFileName))
                {
                    _fileSystem.File.Delete(tagMessageFileName);
                }
            }
        }
Example #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);
        }
Example #4
0
        /// <summary>
        /// Create the Tag depending on input parameter.
        /// </summary>
        /// <param name="revision">Commit revision to be tagged</param>
        /// <param name="inputTagName">Name of tag</param>
        /// <param name="force">Force parameter</param>
        /// <param name="operationType">The operation to perform on the tag (Lightweight, Annotate, Sign with defaul key, Sign with specific key)</param>
        /// <param name="tagMessage">Tag Message</param>
        /// <param name="keyId">Specific Key ID to be used instead of default one</param>
        /// <returns>Output string from RunGitCmd.</returns>
        public bool CreateTag(GitCreateTagArgs args, IWin32Window parentForm)
        {
            GitCreateTagCmd createTagCmd = new GitCreateTagCmd(args);

            if (args.OperationType.CanProvideMessage())
            {
                createTagCmd.TagMessageFileName = Path.Combine(_module.GetGitDirectory(), "TAGMESSAGE");
                _fileSystem.File.WriteAllText(createTagCmd.TagMessageFileName, args.TagMessage);
            }

            return(_uiCommands.StartCommandLineProcessDialog(createTagCmd, parentForm));
        }
        public void CreateTagWithMessageDeletesTheTemporaryFileForUiResult(bool uiResult)
        {
            var args = CreateAnnotatedTagArgs();

            _fileSystem.File.Exists(Arg.Is <string>(s => s != null)).Returns(true);

            _uiCommands.StartCommandLineProcessDialog(Arg.Any <IWin32Window>(), Arg.Any <GitCreateTagCmd>())
            .Returns(uiResult);

            Assert.AreEqual(uiResult, _controller.CreateTag(args, CreateTestingWindow()));

            _fileSystem.File.Received(1).Delete(_tagMessageFile);
        }
        /// <summary>
        /// Create the Tag depending on input parameter.
        /// </summary>
        /// <returns>Output string from RunGitCmd.</returns>
        public bool CreateTag(GitCreateTagArgs args, IWin32Window parentForm)
        {
            string tagMessageFileName = null;

            if (args.Operation.CanProvideMessage())
            {
                tagMessageFileName = Path.Combine(_module.WorkingDirGitDir, "TAGMESSAGE");
                _fileSystem.File.WriteAllText(tagMessageFileName, args.TagMessage);
            }

            var createTagCmd = new GitCreateTagCmd(args, tagMessageFileName);

            return(_uiCommands.StartCommandLineProcessDialog(createTagCmd, parentForm));
        }