diff --git a/projects/packages/changelogger/changelog/fix-changelogger-merge b/projects/packages/changelogger/changelog/fix-changelogger-merge new file mode 100644 index 000000000000..141e51059f58 --- /dev/null +++ b/projects/packages/changelogger/changelog/fix-changelogger-merge @@ -0,0 +1,5 @@ +Significance: minor +Type: changed + +Support merge strategy for jetpack changelogger, assuming that merge commits contains the pr number in the merge commit with format (#{pr_number}) towards the end. + diff --git a/projects/packages/changelogger/composer.json b/projects/packages/changelogger/composer.json index 352d88c1c67c..4dd5479f9274 100644 --- a/projects/packages/changelogger/composer.json +++ b/projects/packages/changelogger/composer.json @@ -55,7 +55,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": { diff --git a/projects/packages/changelogger/src/Application.php b/projects/packages/changelogger/src/Application.php index 0e29961dfe7a..024c4f61e2f1 100644 --- a/projects/packages/changelogger/src/Application.php +++ b/projects/packages/changelogger/src/Application.php @@ -18,7 +18,7 @@ */ class Application extends SymfonyApplication { - const VERSION = '3.2.3'; + const VERSION = '3.3.0-alpha'; /** * Constructor. diff --git a/projects/packages/changelogger/src/Utils.php b/projects/packages/changelogger/src/Utils.php index 93beef35f34c..b4585d1a099c 100644 --- a/projects/packages/changelogger/src/Utils.php +++ b/projects/packages/changelogger/src/Utils.php @@ -176,7 +176,7 @@ public static function getRepoData( $file, OutputInterface $output, DebugFormatt ); try { - $process = self::runCommand( array( 'git', 'log', '-1', "--format=%cI\n%s", $file ), $output, $formatter ); + $process = self::runCommand( array( 'git', 'log', '-1', '--first-parent', "--format=%cI\n%s", $file ), $output, $formatter ); if ( $process->isSuccessful() ) { $cmd_output = explode( "\n", trim( $process->getOutput() ) ); @@ -188,10 +188,13 @@ public static function getRepoData( $file, OutputInterface $output, DebugFormatt // PR number. if ( isset( $cmd_output[1] ) ) { $matches = array(); - preg_match( '/\(#(\d+)\)$/', $cmd_output[1], $matches ); - if ( isset( $matches[1] ) ) { + preg_match( '/(?:^Merge pull request #(\d+))|(?:\(#(\d+)\)$)/', $cmd_output[1], $matches ); + if ( ! empty( $matches[1] ) ) { $repo_data['pr-num'] = $matches[1]; } + if ( ! empty( $matches[2] ) ) { + $repo_data['pr-num'] = $matches[2]; + } } } // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch diff --git a/projects/packages/changelogger/tests/php/tests/src/UtilsTest.php b/projects/packages/changelogger/tests/php/tests/src/UtilsTest.php index ea725e11c76b..31d1c95d9382 100644 --- a/projects/packages/changelogger/tests/php/tests/src/UtilsTest.php +++ b/projects/packages/changelogger/tests/php/tests/src/UtilsTest.php @@ -349,7 +349,7 @@ public function testLoadChangeFile_badFile() { } /** - * Test getRepoData + * Test getRepoData with squash and merge commits. */ public function testGetRepoData() { $this->useTempDir(); @@ -389,10 +389,18 @@ public function testGetRepoData() { ), ), ); - Utils::runCommand( array( 'git', 'init', '.' ), ...$args ); + Utils::runCommand( array( 'git', 'init', '-b', 'main', '.' ), ...$args ); Utils::runCommand( array( 'git', 'add', 'in-git.txt' ), ...$args ); Utils::runCommand( array( 'git', 'commit', '-m', 'Commit (#123)' ), ...$args ); + // Let's create another branch, add a commit and merge to trunk. + Utils::runCommand( array( 'git', 'checkout', '-b', 'temp' ), ...$args ); + file_put_contents( 'in-git2.txt', '' ); + Utils::runCommand( array( 'git', 'add', 'in-git2.txt' ), ...$args ); + Utils::runCommand( array( 'git', 'commit', '-m', 'Dummy commit message.' ), ...$args ); + Utils::runCommand( array( 'git', 'checkout', 'main' ), ...$args ); + Utils::runCommand( array( 'git', 'merge', 'temp', '--no-ff', '-m', 'Merge pull request #124 from temp.' ), ...$args ); + $this->assertSame( array( 'timestamp' => '2021-02-02T22:22:22+00:00', @@ -401,6 +409,15 @@ public function testGetRepoData() { Utils::getRepoData( 'in-git.txt', $output, $helper ) ); + // Test the second commit. + $this->assertSame( + array( + 'timestamp' => '2021-02-02T22:22:22+00:00', + 'pr-num' => '124', + ), + Utils::getRepoData( 'in-git2.txt', $output, $helper ) + ); + // Test our non-git file again. $this->assertSame( array( diff --git a/projects/plugins/backup/changelog/changelogger-merge b/projects/plugins/backup/changelog/changelogger-merge new file mode 100644 index 000000000000..6eb3e9f9f8fa --- /dev/null +++ b/projects/plugins/backup/changelog/changelogger-merge @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Minor update to changelog package that supports git merge strategy. Should not affect shipped code. + + diff --git a/projects/plugins/backup/composer.lock b/projects/plugins/backup/composer.lock index 390094675ec0..0ae7abc79b62 100644 --- a/projects/plugins/backup/composer.lock +++ b/projects/plugins/backup/composer.lock @@ -1297,7 +1297,7 @@ "dist": { "type": "path", "url": "../../packages/changelogger", - "reference": "f5b5e04e8bab59d4bfb71c42d56d68a3003cebd0" + "reference": "902e0f17e8f54dd4b36f83e808a1385e4d001c72" }, "require": { "php": ">=5.6", @@ -1316,7 +1316,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": { diff --git a/projects/plugins/beta/changelog/changelogger-merge b/projects/plugins/beta/changelog/changelogger-merge new file mode 100644 index 000000000000..6eb3e9f9f8fa --- /dev/null +++ b/projects/plugins/beta/changelog/changelogger-merge @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Minor update to changelog package that supports git merge strategy. Should not affect shipped code. + + diff --git a/projects/plugins/beta/composer.lock b/projects/plugins/beta/composer.lock index a7a6d3caa19e..3343fb7bfc49 100644 --- a/projects/plugins/beta/composer.lock +++ b/projects/plugins/beta/composer.lock @@ -258,7 +258,7 @@ "dist": { "type": "path", "url": "../../packages/changelogger", - "reference": "f5b5e04e8bab59d4bfb71c42d56d68a3003cebd0" + "reference": "902e0f17e8f54dd4b36f83e808a1385e4d001c72" }, "require": { "php": ">=5.6", @@ -277,7 +277,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": { diff --git a/projects/plugins/boost/changelog/changelogger-merge b/projects/plugins/boost/changelog/changelogger-merge new file mode 100644 index 000000000000..6eb3e9f9f8fa --- /dev/null +++ b/projects/plugins/boost/changelog/changelogger-merge @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Minor update to changelog package that supports git merge strategy. Should not affect shipped code. + + diff --git a/projects/plugins/boost/composer.lock b/projects/plugins/boost/composer.lock index af12914076e5..6d7bff404188 100644 --- a/projects/plugins/boost/composer.lock +++ b/projects/plugins/boost/composer.lock @@ -1252,7 +1252,7 @@ "dist": { "type": "path", "url": "../../packages/changelogger", - "reference": "f5b5e04e8bab59d4bfb71c42d56d68a3003cebd0" + "reference": "902e0f17e8f54dd4b36f83e808a1385e4d001c72" }, "require": { "php": ">=5.6", @@ -1271,7 +1271,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": { diff --git a/projects/plugins/debug-helper/changelog/changelogger-merge b/projects/plugins/debug-helper/changelog/changelogger-merge new file mode 100644 index 000000000000..6eb3e9f9f8fa --- /dev/null +++ b/projects/plugins/debug-helper/changelog/changelogger-merge @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Minor update to changelog package that supports git merge strategy. Should not affect shipped code. + + diff --git a/projects/plugins/debug-helper/composer.lock b/projects/plugins/debug-helper/composer.lock index 3913da59d59b..bf87be5836f3 100644 --- a/projects/plugins/debug-helper/composer.lock +++ b/projects/plugins/debug-helper/composer.lock @@ -13,7 +13,7 @@ "dist": { "type": "path", "url": "../../packages/changelogger", - "reference": "f5b5e04e8bab59d4bfb71c42d56d68a3003cebd0" + "reference": "902e0f17e8f54dd4b36f83e808a1385e4d001c72" }, "require": { "php": ">=5.6", @@ -32,7 +32,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": { diff --git a/projects/plugins/jetpack-mu-wpcom/changelog/changelogger-merge b/projects/plugins/jetpack-mu-wpcom/changelog/changelogger-merge new file mode 100644 index 000000000000..6eb3e9f9f8fa --- /dev/null +++ b/projects/plugins/jetpack-mu-wpcom/changelog/changelogger-merge @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Minor update to changelog package that supports git merge strategy. Should not affect shipped code. + + diff --git a/projects/plugins/jetpack-mu-wpcom/composer.lock b/projects/plugins/jetpack-mu-wpcom/composer.lock index f522c4988491..894d0e62f047 100644 --- a/projects/plugins/jetpack-mu-wpcom/composer.lock +++ b/projects/plugins/jetpack-mu-wpcom/composer.lock @@ -13,7 +13,7 @@ "dist": { "type": "path", "url": "../../packages/changelogger", - "reference": "f5b5e04e8bab59d4bfb71c42d56d68a3003cebd0" + "reference": "902e0f17e8f54dd4b36f83e808a1385e4d001c72" }, "require": { "php": ">=5.6", @@ -32,7 +32,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": { diff --git a/projects/plugins/jetpack/changelog/changelogger-merge b/projects/plugins/jetpack/changelog/changelogger-merge new file mode 100644 index 000000000000..260c05d392bd --- /dev/null +++ b/projects/plugins/jetpack/changelog/changelogger-merge @@ -0,0 +1,4 @@ +Significance: patch +Type: enhancement + +Also support git merge strategy for changelog.' diff --git a/projects/plugins/jetpack/composer.lock b/projects/plugins/jetpack/composer.lock index ab387bb56b19..622f262b65ab 100644 --- a/projects/plugins/jetpack/composer.lock +++ b/projects/plugins/jetpack/composer.lock @@ -2553,7 +2553,7 @@ "dist": { "type": "path", "url": "../../packages/changelogger", - "reference": "f5b5e04e8bab59d4bfb71c42d56d68a3003cebd0" + "reference": "902e0f17e8f54dd4b36f83e808a1385e4d001c72" }, "require": { "php": ">=5.6", @@ -2572,7 +2572,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": { diff --git a/projects/plugins/protect/changelog/changelogger-merge b/projects/plugins/protect/changelog/changelogger-merge new file mode 100644 index 000000000000..6eb3e9f9f8fa --- /dev/null +++ b/projects/plugins/protect/changelog/changelogger-merge @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Minor update to changelog package that supports git merge strategy. Should not affect shipped code. + + diff --git a/projects/plugins/protect/composer.lock b/projects/plugins/protect/composer.lock index 4d5e1f971649..0cc6cefeef50 100644 --- a/projects/plugins/protect/composer.lock +++ b/projects/plugins/protect/composer.lock @@ -1457,7 +1457,7 @@ "dist": { "type": "path", "url": "../../packages/changelogger", - "reference": "f5b5e04e8bab59d4bfb71c42d56d68a3003cebd0" + "reference": "902e0f17e8f54dd4b36f83e808a1385e4d001c72" }, "require": { "php": ">=5.6", @@ -1476,7 +1476,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": { diff --git a/projects/plugins/search/changelog/changelogger-merge b/projects/plugins/search/changelog/changelogger-merge new file mode 100644 index 000000000000..6eb3e9f9f8fa --- /dev/null +++ b/projects/plugins/search/changelog/changelogger-merge @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Minor update to changelog package that supports git merge strategy. Should not affect shipped code. + + diff --git a/projects/plugins/search/composer.lock b/projects/plugins/search/composer.lock index dff0d1ebeb81..34bba8bd4920 100644 --- a/projects/plugins/search/composer.lock +++ b/projects/plugins/search/composer.lock @@ -1358,7 +1358,7 @@ "dist": { "type": "path", "url": "../../packages/changelogger", - "reference": "f5b5e04e8bab59d4bfb71c42d56d68a3003cebd0" + "reference": "902e0f17e8f54dd4b36f83e808a1385e4d001c72" }, "require": { "php": ">=5.6", @@ -1377,7 +1377,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": { diff --git a/projects/plugins/social/changelog/changelogger-merge b/projects/plugins/social/changelog/changelogger-merge new file mode 100644 index 000000000000..6eb3e9f9f8fa --- /dev/null +++ b/projects/plugins/social/changelog/changelogger-merge @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Minor update to changelog package that supports git merge strategy. Should not affect shipped code. + + diff --git a/projects/plugins/social/composer.lock b/projects/plugins/social/composer.lock index e045b26a1b80..8c728e023280 100644 --- a/projects/plugins/social/composer.lock +++ b/projects/plugins/social/composer.lock @@ -1395,7 +1395,7 @@ "dist": { "type": "path", "url": "../../packages/changelogger", - "reference": "f5b5e04e8bab59d4bfb71c42d56d68a3003cebd0" + "reference": "902e0f17e8f54dd4b36f83e808a1385e4d001c72" }, "require": { "php": ">=5.6", @@ -1414,7 +1414,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": { diff --git a/projects/plugins/starter-plugin/changelog/changelogger-merge b/projects/plugins/starter-plugin/changelog/changelogger-merge new file mode 100644 index 000000000000..6eb3e9f9f8fa --- /dev/null +++ b/projects/plugins/starter-plugin/changelog/changelogger-merge @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Minor update to changelog package that supports git merge strategy. Should not affect shipped code. + + diff --git a/projects/plugins/starter-plugin/composer.lock b/projects/plugins/starter-plugin/composer.lock index 20227efc0c37..a09517ea0118 100644 --- a/projects/plugins/starter-plugin/composer.lock +++ b/projects/plugins/starter-plugin/composer.lock @@ -1263,7 +1263,7 @@ "dist": { "type": "path", "url": "../../packages/changelogger", - "reference": "f5b5e04e8bab59d4bfb71c42d56d68a3003cebd0" + "reference": "902e0f17e8f54dd4b36f83e808a1385e4d001c72" }, "require": { "php": ">=5.6", @@ -1282,7 +1282,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": { diff --git a/projects/plugins/super-cache/changelog/changelogger-merge b/projects/plugins/super-cache/changelog/changelogger-merge new file mode 100644 index 000000000000..6eb3e9f9f8fa --- /dev/null +++ b/projects/plugins/super-cache/changelog/changelogger-merge @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Minor update to changelog package that supports git merge strategy. Should not affect shipped code. + + diff --git a/projects/plugins/super-cache/composer.lock b/projects/plugins/super-cache/composer.lock index 03bf684fb092..01c99e24f0dc 100644 --- a/projects/plugins/super-cache/composer.lock +++ b/projects/plugins/super-cache/composer.lock @@ -61,7 +61,7 @@ "dist": { "type": "path", "url": "../../packages/changelogger", - "reference": "f5b5e04e8bab59d4bfb71c42d56d68a3003cebd0" + "reference": "902e0f17e8f54dd4b36f83e808a1385e4d001c72" }, "require": { "php": ">=5.6", @@ -80,7 +80,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": { diff --git a/projects/plugins/vaultpress/changelog/changelogger-merge b/projects/plugins/vaultpress/changelog/changelogger-merge new file mode 100644 index 000000000000..6eb3e9f9f8fa --- /dev/null +++ b/projects/plugins/vaultpress/changelog/changelogger-merge @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Minor update to changelog package that supports git merge strategy. Should not affect shipped code. + + diff --git a/projects/plugins/vaultpress/composer.lock b/projects/plugins/vaultpress/composer.lock index 5362bf154657..9f6a9bed6167 100644 --- a/projects/plugins/vaultpress/composer.lock +++ b/projects/plugins/vaultpress/composer.lock @@ -116,7 +116,7 @@ "dist": { "type": "path", "url": "../../packages/changelogger", - "reference": "f5b5e04e8bab59d4bfb71c42d56d68a3003cebd0" + "reference": "902e0f17e8f54dd4b36f83e808a1385e4d001c72" }, "require": { "php": ">=5.6", @@ -135,7 +135,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": { diff --git a/projects/plugins/videopress/changelog/changelogger-merge b/projects/plugins/videopress/changelog/changelogger-merge new file mode 100644 index 000000000000..6eb3e9f9f8fa --- /dev/null +++ b/projects/plugins/videopress/changelog/changelogger-merge @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Minor update to changelog package that supports git merge strategy. Should not affect shipped code. + + diff --git a/projects/plugins/videopress/composer.lock b/projects/plugins/videopress/composer.lock index e9654ed92811..0b4adb18d512 100644 --- a/projects/plugins/videopress/composer.lock +++ b/projects/plugins/videopress/composer.lock @@ -1357,7 +1357,7 @@ "dist": { "type": "path", "url": "../../packages/changelogger", - "reference": "f5b5e04e8bab59d4bfb71c42d56d68a3003cebd0" + "reference": "902e0f17e8f54dd4b36f83e808a1385e4d001c72" }, "require": { "php": ">=5.6", @@ -1376,7 +1376,7 @@ "extra": { "autotagger": true, "branch-alias": { - "dev-trunk": "3.2.x-dev" + "dev-trunk": "3.3.x-dev" }, "mirror-repo": "Automattic/jetpack-changelogger", "version-constants": {