Check for correct version.php numbers in pre-commit script
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Medium
|
Aaron Wells | ||
1.10 |
Fix Released
|
Medium
|
Aaron Wells | ||
1.8 |
Fix Released
|
Medium
|
Aaron Wells | ||
1.9 |
Fix Released
|
Medium
|
Aaron Wells | ||
15.04 |
Fix Released
|
Medium
|
Aaron Wells |
Bug Description
Mahara's version number policy for DB versions in version.php files is pretty simple:
1. in a _STABLE branch, a commit should only increment the version (whether for core or a plugin) by 1
2. in the master branch, a commit should increment the version to the day's date followed by 00
Since this is so simple, and we've recently had a mistake from it being manually checked, it's a perfect candidate to add to our pre-commit checks. The logic can be as follows:
IF you're modifying a version.php file && changing its $config->version value THEN
IF the branch ends with "_STABLE" THEN
Make sure the $config->version is being incremented by 1.
ELSE
Make sure the $config->version is higher than the old value, and ends with 00, and is less than or equal to today's date.
In some cases you might want to increment a version number on the master branch by 1 (like if you're pushing through multiple commits on the same day). But that's okay, that's what bypassing the pre-commit hook is for. ;)
no longer affects: | mahara/1.5 |
no longer affects: | mahara/1.6 |
no longer affects: | mahara/1.7 |
I've added a script, test/versionche ck.php, which compares the version numbers from lib/version.php in HEAD and HEAD~ and complains if has decreased or if you are on a stable release but have incremented more than the last 2 digits of the number.
While I was doing this I started thinking of a few additional steps we should take:
1. Check for decreasing version number in all the plugins. (Leaping version number is okay in plugins, because we don't increment these with each release... though maybe we should?)
2. If lib/db/upgrade.php has increased in length, check that you've incremented lib/version.php and that the version in version.php matches the last version in upgrade.php
3. A similar check for plugins.