Check for correct version.php numbers in pre-commit script

Bug #1215662 reported by Aaron Wells
6
This bug affects 1 person
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. ;)

Tags: tests
Aaron Wells (u-aaronw)
no longer affects: mahara/1.5
no longer affects: mahara/1.6
Aaron Wells (u-aaronw)
no longer affects: mahara/1.7
Revision history for this message
Aaron Wells (u-aaronw) wrote :

I've added a script, test/versioncheck.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.

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Because this is just a test script update, I've gone ahead and pushed it to the branches, and I'll mark this ticket as "Fix released".

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.