jenkins-bot has submitted this change and it was merged.

Change subject: Use the last minor version of the previous major version for 
make-deploy-notes
......................................................................


Use the last minor version of the previous major version for make-deploy-notes

Instead of hardcoding the last minor version of a previous master branch, now 
the script
tries to get it from the git history and will use that. If it's not available, 
it
will use 22 as a default.

Change-Id: I7baf314809489cbc371305d9839979a792e18593
---
M make-deploy-notes/uploadChangelog.php
1 file changed, 31 insertions(+), 1 deletion(-)

Approvals:
  20after4: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/make-deploy-notes/uploadChangelog.php 
b/make-deploy-notes/uploadChangelog.php
index ab0a182..0b6070d 100644
--- a/make-deploy-notes/uploadChangelog.php
+++ b/make-deploy-notes/uploadChangelog.php
@@ -73,7 +73,7 @@
        list( $major, $minor ) = $majorMinor;
        if ( $minor === 1 ) {
                $major--;
-               $minor = 22;
+               $minor = getPreviousMinorVersion( $major );
        } else {
                $minor--;
        }
@@ -89,6 +89,36 @@
 }
 
 /**
+ * Takes a major version and finds the last minor version of the previous 
major version.
+ * @param string $major
+ * @return string
+ */
+function getPreviousMinorVersion( $major ) {
+       // check, which filter should be used for the filter
+       // Note, that 27 is used here, because the previous version would be 
26, which uses the old
+       // non semantic versioning notation.
+       if ( $major <= 27 ) {
+               $filter = "wmf/1.{$major}wmf";
+       } else {
+               $filter = "wmf/1.{$major}.0-wmf";
+       }
+       // get the list in a raw output format which would be visible in the 
console for this command, sorted by version numbers
+       $rawList = shell_exec( "git branch -a --list */{$filter}* | sort -V" );
+       // convert the list (which is one string now) into an array of strings, 
splitted at the end of each line
+       $list = explode( PHP_EOL, $rawList );
+       $minor = '';
+       // there will be at least one (empty) line, check if there are more 
elements, which would be the list of versions.
+       if ( count( $list ) !== 1 ) {
+               // remove anythign before the correct version semantic 
(wmf/1.26wmf1 or wmf/1.27.0-wmf.1) using the filter defined above
+               // the array will start counting at 0 and will has one empty 
"line" at the end, so count all elements and subtract 2
+               list( $major, $minor ) = getMajorMinor( strstr( $list[ count( 
$list ) -2 ], $filter ) );
+       }
+
+       // check, if there was a good result, otherwise assume, that there are 
22 previous minor versions and use that
+       return ( $minor !== "" ) ? $minor : 22;
+}
+
+/**
  * @param $input string
  * @return array|null
  */

-- 
To view, visit https://gerrit.wikimedia.org/r/242262
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7baf314809489cbc371305d9839979a792e18593
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/tools/release
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: 20after4 <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Greg Grossmeier <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to