Bugzilla:Moving From Bazaar To Git

From MozillaWiki
Jump to: navigation, search

The Bugzilla source is moving from Bazaar (bzr) to git. While existing supported releases will continue to be mirrored to Bazaar for some time to come, new releases will only be available on git. If your Bugzilla installation is a checkout from the Bazaar repository, eventually you will need to switch to using git to obtain updates.

You can tell if you have installed from a Bazaar branch by looking in your top-level Bugzilla directory. If there is a subdirectory called ".bzr", then your installation is a checkout from Bazaar.

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 5.0, can then happen as a separate step, pulling from git. It is recommended that you switch while using the latest point release for your version. You can update to the latest point release using bzr. The instructions on doing that are on the Bugzilla wiki. You should use the update command of the following form:

 bzr up -r tag:bugzilla-(version)

where (version) is the latest update to your current major release. See the Bugzilla download page for latest versions. 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:

 bzr diff > 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 git

Download a copy of your current version of Bugzilla from the git repository into a separate directory alongside your existing Bugzilla installation.

You will need a copy of the git program. All Linux installations have it; search your package manager for "git". On Windows, you can download the official build; there are also alternate packages for Windows out there.

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

 git clone https://git.mozilla.org/bugzilla/bugzilla bugzilla-git
 cd bugzilla-git
 git checkout X.Y

Replace X.Y with the version number of your current Bugzilla, e.g. 4.2. "bugzilla-git" is the name of the local directory into which the source code will be downloaded. The following examples presume that your existing installation is in a directory called "bugzilla" which is in the same directory as the new "bugzilla-git" directory.

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-git/:

 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 git. You can also run

 bzr status

to see if there are untracked (unknown to bzr) extensions (or other directories and files, for that matter). 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-git/:

 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-git 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-bzr, and rename your bugzilla directory to whatever name your Bugzilla directory had. Run checksetup.pl to confirm that all is well. From the directory containing the bugzilla and bugzilla-git directories, run

 mv bugzilla bugzilla-bzr
 mv bugzilla-git 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 git 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.

(These instructions were adapted from the previous migration instructions: Bugzilla:Moving_From_CVS_To_Bazaar)