MySQL Bazaar Howto
Contents |
[edit] Getting Started
[edit] Overview
Bazaar is a distributed revision control system developed with focus on ease of use, accuracy and flexibility. Its commands are quite similar to those found in CVS or SVN and supports working with or without a central server. Bazaar is designed as a Python API with a plugin system, so it is easy to embed in your tools and projects and easy to extend or integrate with existing infrastructure, which made it a perfect fit for MySQL’s heterogeneous and distributed environment.
[edit] Installing Bazaar
You must have Bazaar installed in order to check out a mysql repository. You may install it using your distribution's packaging tool using the following commands (usually requires root privileges).
- Ubuntu:
Shell> apt-get install bzr
- Fedora:
Shell> yum install bzr
- openSUSE:
Shell> zypper install bzr
If your distribution does not provide Bazaar, you can get the latest stable version from here and install using the Python-based installer.
The only prerequisite for this method is having a working Python >= 2.4 installation.
- System-wide install:
Shell> sudo python setup.py install
- Install in home directory:
Shell> python setup.py install --home $HOME
If you use Microsoft Windows, the easiest way to install is to download the Bazaar Windows installer or the Python-based installer if you already have Python.
On Mac OS X, you can either use MacPorts or download the installer for Tiger or Leopard.
[edit] Bazaar Plugins
Bazaar can also be extended with external components known as plugins that ease and speed up your development. It's suggested that you install the Bzrtools plugin which provides other useful extra functionality.
Shell> mkdir -p ~/.bazaar/plugins/ Shell> cd ~/.bazaar/plugins/ Shell> bzr branch lp:bzrtools
[edit] Download the tree for the first time
The first thing to do is creating and initializing a shared repository to store a branch of the mysql source tree
Shell> mkdir mysql-repo && cd mysql-repo/ Shell> bzr init-repo .
After initializing the shared repository you are ready to branch the mysql source tree for the first time.
The repository is available from MySQL's project page at Launchpad.
Shell> bzr branch lp:mysql-server/6.0 mysql-6.0
Note that this may take a long time to download because the MySQL tree with full history is very large (~500 megabytes).
Another faster option is to perform a lightweight checkout (~100 megabytes) that contacts the remote branch when necessary.
Lightweight checkouts have no local branch, which makes them almost the same as CVS or SVN checkouts.
Shell> bzr checkout --lightweight lp:mysql-server/6.0 mysql-6.0
[edit] Building from source
In order to build MySQL on a stock Linux distribution or unix variant you will need GNU autotools (Autoconf, Automake and Libtool) and Bison.
Once those dependencies are satisfied, choose one of build scripts in the BUILD/ subdirectory which suits your platform.
Shell> $ cd mysql-6.0 && BUILD/compile-pentium-debug
Detailed instructions for building MySQL on Windows are available on the Building MySQL on Windows page.
For more complete instructions on building and installing from source, see the manual entry Installation Using a Source Distribution
[edit] Basic Tasks
[edit] Update the local mysql tree
Shell> cd mysql-6.0 Shell> bzr pull
[edit] Check in local modifications
Shell> bzr commit
[edit] Undo all local modifications
Shell> bzr revert
[edit] List changes
Show changes since last commit:
Shell> bzr diff
Show changes from branch xxx:
Shell> bzr diff --old xxx
Show all the changes made in branch:
Shell> bzr diff -r submit:
[edit] Undo last commit
Shell> bzr uncommit
[edit] List all commands
Shell> bzr help commands
[edit] Submit modifications for inclusion
Shell> bzr send --mail-to=internals@lists.mysql.com
Before submitting modifications you might want to let Bazaar know who you are:
Shell> bzr whoami "Jimmy Foobar <jimmy@foobar.com>"
[edit] Branches
[edit] List all branches
Shell> bzr branches
[edit] Create a new branch
Shell> bzr branch mysql-6.0 mysql-6.0-mypatch
[edit] Share your branch
Shell> bzr push --remember bzr+ssh://bazaar.launchpad.net/~user/project/name
[edit] Show log of a branch
Shell> bzr log
[edit] Merge changes
Merge changes from a branch:
Shell> bzr merge ../mysql-6.0
Merge changes from the parent branch:
Shell> bzr merge
[edit] Check out an older mysql version
Shell> bzr branch -r tag:mysql-3.23.58 5.1 3.23