Bugzilla:Moving From CVS To Bazaar

From MozillaWiki
Jump to: navigation, search

This page applies to people whose installation of Bugzilla is a checkout from the CVS version control system, and who wish to upgrade from Bugzilla 4.0 or earlier to Bugzilla 4.2 or later. Bugzilla 4.2 and up are not available from our legacy CVS repository, only our Bazaar (bzr) repository. Therefore, you will need to change your installation over to pull code from bzr before upgrading beyond 4.0.

You can tell if you need to follow these instructions by looking in your top-level Bugzilla directory. If there is a subdirectory called "CVS", then your installation is a checkout from CVS.

The switching procedure is as follows:

Update Your Bugzilla To The Latest Point Release

The aim when switching is to switch between two identical versions of Bugzilla, to minimise the risk of conflict or problems. Any upgrade, e.g. to 4.2, can then happen as a separate step, using the improved merge algorithms in bzr rather than those in CVS. It is recommended that you switch while using the latest point release for your version. You can update to the latest point release using CVS. The instructions on doing that are on the Bugzilla website. You should use the update command of the following form:

 cvs update -rBUGZILLA-X_Y-STABLE -dP

where X.Y is your Bugzilla version number (e.g. 3.6). Don't forget to run checksetup.pl afterwards.

You should then test your Bugzilla carefully, or just use it for a day or two, to make sure it's all still working fine.

Save Any Local Customizations

If you have customizations to your Bugzilla, and you made them by changing the Bugzilla code itself (rather than using the Extension system), you will have to keep a copy of those changes. If you made no changes, or all changes are contained into extensions, jump to the next step. If you aren't sure, do the below, and see if patch.diff has non-zero size.

To generate a patch with all the changes you made, go into your Bugzilla directory and run this command:

 cvs diff -puN > patch.diff

The file patch.diff will contain all the changes you made to your current installation. If it's empty, then you didn't make any local code customizations.

Download Code from bzr

Download a copy of your current version of Bugzilla from the bzr repository into a separate directory.

You will need a copy of the bzr program. All Linux installations have it; search your package manager for "bzr". On Windows, you can download it from Canonical; get the most highly-numbered stable release from the "Standalone" section.

Once bzr is installed, run this command to download Bugzilla:

 bzr co -r tag:bugzilla-stable bzr://bzr.mozilla.org/bugzilla/X.Y bugzilla-bzr

Replace X.Y with the version number of your current Bugzilla, e.g. 3.6. "bugzilla-bzr" is the name of the local directory into which the source code will be downloaded.

Shut Down Bugzilla

At this point, you should shut down Bugzilla to stop anyone changing the data you are about to copy. Go into the administrative interface and put an appropriate message into the "shutdownhtml" parameter, which is in the "General" section of the administration parameters. As the name implies, HTML is allowed.

This would be a good time to back up your database. We shouldn't be affecting it, but you can't be too careful.

Copy Across Data and Modules

Copy the contents of the following directories from your current installation of Bugzilla into the corresponding directory in bugzilla-bzr/:

 lib/
 data/
 extensions/

You should only copy extensions you have written or installed, not ones which ship with Bugzilla. To find which ones shipped with your version of Bugzilla, look in the extensions/ directory in the new checkout from bzr. Only copy across things which are not present there already.

Then, copy the following file from your current installation of Bugzilla into the corresponding place in bugzilla-bzr/:

 localconfig

This file contains your database password and access details. Because your two versions of Bugzilla are the same, this should all work fine.

Reapply Local Customizations

If you recorded any changes to your current Bugzilla installation in the earlier step, then you have to apply the patch.diff file you created earlier to your new installation. If you made no changes, you can jump to the next step. If you are on Windows and you don’t have the 'patch' program, you can download it from GNUWin. Once downloaded, you must copy patch.exe into the Windows directory.

Copy patch.diff into the bugzilla-bzr directory and then do:

 patch -p0 --dry-run < patch.diff

The patch should apply cleanly because you have exactly the same version of Bugzilla in both directories. If it does, remove the --dry-run and rerun the command to apply it for real. If it does not apply cleanly, it is likely that you have managed to get a version mismatch between the two directories.

Swap The New Version In

Rename your old Bugzilla directory to bugzilla-cvs, and rename your bugzilla-bzr directory to whatever name your Bugzilla directory had. Run checksetup.pl to confirm that all is well.

 mv bugzilla bugzilla-cvs
 mv bugzilla-bzr bugzilla
 cd bugzilla
 ./checksetup.pl

Running checksetup.pl should not result in any changes to your database at the end of the run. If it does, then it's most likely that the two versions of Bugzilla you have are not, in fact, the same.

Re-enable Bugzilla

Go into the administrative interface and clear the contents of the "shutdownhtml" parameter.

Upgrade Bugzilla

Use your Bugzilla for several days to check that the switch has had no detrimental effects. Then, follow the normal instructions for upgrading a bzr install of Bugzilla to the latest version.

(Rollback)

If something goes wrong at any stage of the switching process (e.g. your patch doesn't apply, or checksetup doesn't complete), you can always just switch the directories back (if you've got that far) and re-enable Bugzilla (if you disabled it) and then seek help. Even if you have re-enabled Bugzilla, and find a problem a little while down the road, you are still using the same version so there would be few side effects to switching the directories back a day or three later.