Ejemplo n.º 1
0
        public ChangeLogEntry(
            DateTime date,
            CommitType type,
            string?scope,
            bool isBreakingChange,
            string summary,
            IReadOnlyList <string> body,
            IReadOnlyList <ChangeLogEntryFooter> footers,
            IReadOnlyList <string> breakingChangeDescriptions,
            GitId commit)
        {
            if (footers is null)
            {
                throw new ArgumentNullException(nameof(footers));
            }

            if (breakingChangeDescriptions is null)
            {
                throw new ArgumentNullException(nameof(breakingChangeDescriptions));
            }

            Date  = date;
            Type  = type;
            Scope = scope;
            ContainsBreakingChanges = isBreakingChange || breakingChangeDescriptions.Count > 0;
            Summary = summary ?? throw new ArgumentNullException(nameof(summary));
            Body    = body ?? throw new ArgumentNullException(nameof(body));
            Footers = footers;
            BreakingChangeDescriptions = breakingChangeDescriptions;
            Commit = commit;
        }
Ejemplo n.º 2
0
        private static void HandleCommitCommand(CommitType commitType, SharedCommandOptions sharedCommandOptions, IConsole console)
        {
            var messageFactory       = new ConventionalCommitMessageFactory();
            var commitMessageOptions = sharedCommandOptions.ToCommitMessageOptions();
            var commitMessage        = messageFactory.CreateCommitMessage(commitType, commitMessageOptions);

            console.Out.Write(commitMessage);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Gets all change log entries of the specified type
 /// </summary>
 /// <param name="commitType"></param>
 /// <returns></returns>
 public ChangeLogEntryGroup this[CommitType commitType]
 {
     get
     {
         var entries = AllEntries.Where(x => x.Type == commitType);
         return(new ChangeLogEntryGroup(commitType, entries));
     }
 }
Ejemplo n.º 4
0
        private void DoCommitizenGUI()
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(Styles.CommitAreaPadding);

                GUILayout.BeginVertical();
                {
                    GUILayout.Space(Styles.CommitAreaPadding);
                    EditorGUILayout.HelpBox(commitTypeHelpMessages[commitType], MessageType.Info);
                    GUILayout.BeginHorizontal();
                    {
                        commitType = (CommitType)EditorGUILayout.EnumPopup(TypeLabel, commitType);
                        GUILayout.Label(ScopeLabel);
                        scope = EditorGUILayout.TextField(scope, Styles.TextFieldStyle);
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.Label(SummaryLabel);
                    commitMessage = EditorGUILayout.TextField(commitMessage, Styles.TextFieldStyle);
                    GUILayout.Space(Styles.CommitAreaPadding * 2);

                    GUILayout.Label(DescriptionLabel);
                    commitBody = EditorGUILayout.TextArea(commitBody, Styles.CommitDescriptionFieldStyle, GUILayout.Height(6 * 15f));

                    GUILayout.Space(Styles.CommitAreaPadding);

                    GUILayout.Label(FooterLabel);
                    footer = EditorGUILayout.TextField(footer, Styles.TextFieldStyle);

                    GUILayout.Space(Styles.CommitAreaPadding);

                    // Disable committing when already committing or if we don't have all the data needed
                    //Debug.LogFormat("IsBusy:{0} string.IsNullOrEmpty(commitMessage): {1} treeChanges.GetCheckedFiles().Any(): {2}",
                    //    IsBusy, string.IsNullOrEmpty(commitMessage), treeChanges.GetCheckedFiles().Any());
                    EditorGUI.BeginDisabledGroup(IsBusy || string.IsNullOrEmpty(commitMessage) || !treeChanges.GetCheckedFiles().Any());
                    {
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.FlexibleSpace();
                            if (GUILayout.Button(String.Format(CommitButton, currentBranch), Styles.CommitButtonStyle))
                            {
                                GUI.FocusControl(null);
                                Commit();
                            }
                        }
                        GUILayout.EndHorizontal();
                    }
                    EditorGUI.EndDisabledGroup();

                    GUILayout.Space(Styles.CommitAreaPadding);
                }
                GUILayout.EndVertical();

                GUILayout.Space(Styles.CommitAreaPadding);
            }
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of <see cref="ChangeLogEntryGroup"/>
        /// </summary>
        public ChangeLogEntryGroup(CommitType type, IEnumerable <ChangeLogEntry> entries)
        {
            if (entries is null)
            {
                throw new ArgumentNullException(nameof(entries));
            }

            Type    = type;
            Entries = entries.ToList();
        }
Ejemplo n.º 6
0
 public TaskTimeItem(string branch, string description, string project, DateTime startTime, TimeSpan timeSpent, int commits,
                     int filesAffected = 1, string releaseVersion = "", CommitType type = CommitType.Task)
 {
     Branch         = branch;
     Description    = description;
     Project        = project;
     Commits        = commits;
     TimeSpent      = timeSpent;
     StartTime      = startTime;
     FilesAffected  = filesAffected;
     ReleaseVersion = releaseVersion;
     Type           = type;
 }
Ejemplo n.º 7
0
        private static void HandleCommitCommand(CommitType commitType, SharedCommandOptions options, DirectoryInfo path)
        {
            var commitMessageOptions = options.ToCommitMessageOptions();
            ConventionalCommitMessageFactory factory = new();
            string message = factory.CreateCommitMessage(commitType, commitMessageOptions);

            using var repo = new Repository(path.FullName);

            File.AppendAllText(Path.Join(path.FullName, Guid.NewGuid().ToString()), DateTime.Now.ToString());

            Commands.Stage(repo, "*");

            var author = repo.Config.BuildSignature(DateTimeOffset.Now);

            repo.Commit(message, author, author);
        }
        public void Indexer_returns_expected_entry_group_01()
        {
            // ARRANGE
            var sut = GetSingleVersionChangeLog("1.2.3", entries: new[]
            {
                GetChangeLogEntry(type: "feat"),
                GetChangeLogEntry(type: "fix")
            });

            var type = new CommitType("build");

            // ACT
            var group = sut[type];

            // ASSERT
            Assert.NotNull(group);
            Assert.Equal(type, group.Type);
            Assert.Empty(group.Entries);
        }
Ejemplo n.º 9
0
        private CreateCommitResponse CreateTypedCommit(CreateCommitRequest request, CommitType commitType)
        {
            var options  = request.ToCommitMessageOptions();
            var message  = this.factory.CreateCommitMessage(commitType, options);
            var response = new CreateCommitResponse
            {
                Message = message,
            };
            HttpRequest httpRequest = this.HttpContext.Request;

            response.Links = new[]
            {
                new LinkResponse(href: this.Url.ActionLink(nameof(this.Describe)), rel: "parent", method: "GET"),
                new LinkResponse(
                    href: $"{httpRequest.Scheme}://{httpRequest.Host}{httpRequest.Path}",
                    rel: "self",
                    method: "GET"),
            };
            return(response);
        }
Ejemplo n.º 10
0
        private static void AssertEntryTypes(IEnumerable <KeyValuePair <string, ChangeLogConfiguration.EntryTypeConfiguration> > entryTypes, CommitType expectedCommitType, string expectedDisplayName, int expectedOrder)
        {
            // Asserts the specified list of entry type configs contains a instance matching the expected values.
            // This is a method instead of an inline lambda-expression, because a multi-line lambda
            // cannot be converted to an expression-tree.
            // However, expression trees are preferable over lambdas because they make the actual assertion
            // visible in the test output.
            // (See https://twitter.com/bradwilson/status/1282374907670654976)

            var x = Assert.Single(entryTypes.Where(kvp => new CommitType(kvp.Key) == expectedCommitType));

            Assert.NotNull(x.Key);
            Assert.NotEmpty(x.Key);
            Assert.Equal(expectedCommitType, new CommitType(x.Key));
            Assert.Equal(expectedDisplayName, x.Value.DisplayName);
            Assert.Equal(expectedOrder, x.Value.Priority);
        }
Ejemplo n.º 11
0
 //------------------------------------------------------------------------------------
 /// <summary>
 ///  Commits the given collection of items to the backing store.
 /// </summary>
 //------------------------------------------------------------------------------------
 public void CommitItems(List <StoreItem> items, bool shouldShowProgress)
 {
     CommitType = CommitType.UserCommit;
     SetChangeList(items);
     DoCommit(shouldShowProgress);
 }
Ejemplo n.º 12
0
 //------------------------------------------------------------------------------------
 /// <summary>
 ///  Commits the given item to the backing store.
 /// </summary>
 //------------------------------------------------------------------------------------
 public void CommitItem(StoreItem item)
 {
     CommitType = CommitType.ImmediateCommit;
     SetCommitItem(item);
     DoCommit(false);
 }
Ejemplo n.º 13
0
        public ActionResult <CreateCommitResponse> CreateChore([FromBody] CreateCommitRequest request)
        {
            CommitType commitType = CommitType.Chore;

            return(this.CreateTypedCommit(request, commitType));
        }
Ejemplo n.º 14
0
        public ActionResult <CreateCommitResponse> CreateDocumentation([FromBody] CreateCommitRequest request)
        {
            CommitType commitType = ExtendedCommitType.Documentation;

            return(this.CreateTypedCommit(request, commitType));
        }
Ejemplo n.º 15
0
 public StoreCommitCompleteEventArgs(CommitType commitType, BackgroundTaskResult result)
 {
     CommitType = commitType;
     Result     = result;
 }