From ddc4e1090d39470d7100ccef68d1992f57f5f939 Mon Sep 17 00:00:00 2001 From: Rodge Fu Date: Wed, 27 Sep 2023 17:49:03 +0800 Subject: [PATCH] some improvements per feedback (#7018) * some improvements 1. make CHANGELOG.MD to CHANGELOG.md for case-sensitive environment 2. move spec version bump from Other Changes to Features Added group * small improve --- .../mergedChangelog1.md | 5 ++++- .../ChangeLogResult.cs | 8 ++++++-- .../Context.cs | 2 +- .../Report/Release.cs | 17 ++++++++++------- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen.Tests/mergedChangelog1.md b/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen.Tests/mergedChangelog1.md index c4204f3f239..80398308fb4 100644 --- a/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen.Tests/mergedChangelog1.md +++ b/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen.Tests/mergedChangelog1.md @@ -18,9 +18,12 @@ - Removed property method 'Set' for 'String PropertyToChangeToGet' in type Azure.ResourceManager.AppService.TestProperty - Removed type 'Azure.ResourceManager.AppService.TypeToBeDeleted' -### Other Changes +### Features Added - spec upgraded + +### Other Changes + - Azure Core upgraded - Azure RM upgraded - Obsoleted method 'Void StaticMethodToBeObsoleted()' in type Azure.ResourceManager.AppService.StaticTypeToBeObsoleted diff --git a/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen/ChangeLogResult.cs b/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen/ChangeLogResult.cs index 87ab76ab63d..08c91862519 100644 --- a/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen/ChangeLogResult.cs +++ b/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen/ChangeLogResult.cs @@ -31,9 +31,13 @@ public Release GenerateReleaseNote(string version, string date, List 0) + report.Groups.Add(featureAddedGroup); + + ReleaseNoteGroup othersGroup = new ReleaseNoteGroup("Other Changes"); if (AzureCoreVersionChange != null) othersGroup.Notes.Add(new ReleaseNote(AzureCoreVersionChange.Description, PREFIX)); if (AzureResourceManagerVersionChange != null) diff --git a/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen/Context.cs b/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen/Context.cs index d2aeee90ba8..a73395ee18d 100644 --- a/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen/Context.cs +++ b/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen/Context.cs @@ -49,7 +49,7 @@ public class Context public string AzureCoreChangeLogGithubKey => "sdk/core/Azure.Core/CHANGELOG.md"; public string AzureCoreChangeLogMdFile => Path.Combine(RepoRoot, AzureCoreChangeLogGithubKey); - public string AzureResourceManagerChangeLogGithubKey => "sdk/resourcemanager/Azure.ResourceManager/CHANGELOG.MD"; + public string AzureResourceManagerChangeLogGithubKey => "sdk/resourcemanager/Azure.ResourceManager/CHANGELOG.md"; public string AzureResourceManagerChangeLogMdFile => Path.Combine(RepoRoot, AzureResourceManagerChangeLogGithubKey); public bool IsPreview => Helper.IsPreviewRelease(this.ReleaseVersion); diff --git a/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen/Report/Release.cs b/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen/Report/Release.cs index db875237a8d..07a7ae6d274 100644 --- a/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen/Report/Release.cs +++ b/tools/net-changelog-gen-mgmt/Azure.SDK.Management.ChangelogGen/Report/Release.cs @@ -70,7 +70,7 @@ private void MergeByOverwrite(Release to) private void MergeByGrup(Release to) { - foreach(var fromGroup in this.Groups) + foreach (var fromGroup in this.Groups) { var found = to.Groups.FirstOrDefault(g => g.Name == fromGroup.Name); if (found != null) @@ -81,21 +81,24 @@ private void MergeByGrup(Release to) private void MergeByLine(Release to) { - foreach(var fromGroup in this.Groups) + foreach (var fromGroup in this.Groups) { var toGroup = to.Groups.FirstOrDefault(g => string.Equals(g.Name, fromGroup.Name, StringComparison.OrdinalIgnoreCase)); - if(toGroup == null) + if (toGroup == null) { to.Groups.Add(fromGroup); } else { - foreach(var fromItem in fromGroup.Notes) + int indexToInsert = toGroup.Notes.FindLastIndex(n => !string.IsNullOrEmpty(n.Note)) + 1; + int lastNonEmptyIndex = fromGroup.Notes.FindLastIndex(n => !string.IsNullOrEmpty(n.Note)); + for (int i = lastNonEmptyIndex; i >= 0; i--) { + var fromItem = fromGroup.Notes[i]; var toItem = toGroup.Notes.FirstOrDefault(t => string.Equals(fromItem.ToString(), t.ToString(), StringComparison.OrdinalIgnoreCase)); - if(toItem == null) + if (toItem == null) { - toGroup.Notes.Add(fromItem); + toGroup.Notes.Insert(indexToInsert, fromItem); } else { @@ -133,7 +136,7 @@ public static List FromChangelog(string changelog) Release curRelease = firstRelease!; ReleaseNoteGroup curGroup = new ReleaseNoteGroup(""); - for(i = i+1; i < lines.Length; i++) + for (i = i + 1; i < lines.Length; i++) { if (ReleaseNoteGroup.TryParseGroupTitle(lines[i], out ReleaseNoteGroup? newGroup)) {