Differences between revisions 6 and 7
Revision 6 as of 2009-06-15 20:38:59
Size: 12480
Editor: 201
Comment: Added a big warning telling readers that the page is outdated.
Revision 7 as of 2010-02-24 21:10:58
Size: 8434
Editor: BarryWarsaw
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
~+Warning: this page is here for historical reasons only. Python developers already decided that Python's official DVCS will be Mercurial. The migration plan is [[http://www.python.org/dev/peps/pep-0385/|PEP 385]]+~ ~+Note: While Python has officially chosen Mercurial for its DVCS, you can still use Bazaar to develop Python. This page describes the current workflow. The migration plan is [[http://www.python.org/dev/peps/pep-0385/|PEP 385]].+~
Line 7: Line 7:
system. We are experimenting with
[[http://en.wikipedia.org/wiki/Distributed_Version_Control_System|distributed revision control systems]]
(dvcs) because of their greatly improved workflow, accessibility and merging
facilities over Subversion. While there are several serious dvcs contenders
in the open source world, this page describes the experimental
[[http://bazaar-vcs.org|Bazaar]] mirrors
of the Python Subversion tree that we are making available to developers.

Please note that we are making these branches available for experimental
purposes, so that developers (both core and otherwise) can try them out, and
so that we can debug our code hosting facilities should we decide to switch to
a dvcs. We have not selected a dvcs, nor have we even decided to switch from
Subversion yet. [[http://www.python.org/dev/peps/pep-0374/|PEP 374]] tracks this decision.
system. Unofficial [[http://bazaar-vcs.org|Bazaar]] mirrors of the Subversion repository are maintained on Launchpad and are kept up-to-date automatically.
Line 24: Line 11:
We are making a mirror of the Python 2.5, 2.6, trunk (2.7), 3.0, and 3.1 We currently have mirrors of the Python 2.6, trunk (2.7), 3.1, and py3k (3.2)
Line 27: Line 14:
made to Subversion, they will be available in Bazaar very soon thereafter.
T
here's a lag of a minute or few because we currently do the sync via cron.
made to Subversion, they will be available in Bazaar on Launchpad soon
thereafter.  Of course, there's a bit of a lag imposed by the Launchpad puller.
Line 30: Line 17:
There is a second mirror that is never automatically sync'd from Subversion,
although developers can sync to these branches manually. Core developers can
also push their own revisions to the official upstream branches, but these are
not sync'd to Subversion. The purpose of this mirror is primarily for us to
debug the workflow, authentication, pre- and post-hooks, etc. You'll probably rarely want to use this mirror, so it's not documented here.
All of the mirrored branches are available [[https://code.edge.launchpad.net/python|here]].
Line 36: Line 19:
We are also making code hosting available for core developers. This means
anybody with write access to the Subversion repository can push their own
branches to python.org. Of course, core developers are not ''required'' to
push their branches to python.org, and in fact can (if they wish) publish
their Bazaar branches anywhere, including free code hosting facilities such as
[[https://code.launchpad.net/python|Launchpad]].
Code hosting of Bazaar branches is also available on Launchpad. This means you can branch Python locally via Bazaar, do some development, and then push your branch to Launchpad to share with others. Of course because the master branches are in Subversion, you'll still have to go through the standard Python development process to get your changes into mainline. But short of that, you can do all your development in a nice, modern DVCS.
Line 43: Line 21:
There is a pretty good [[http://wiki.bazaar.canonical.com/BzrForeignBranches/Subversion|Bazaar/Subversion bridge]] which should allow you to commit your Bazaar branch to the Subversion master, but I have not tried it.
Line 46: Line 25:
* [[http://bazaar-vcs.org/Download|Bazaar 1.9 or newer]]. As of this writing (02-Mar-2009) Bazaar 1.12 is the most recent release. As Bazaar is written in Python (yay!), it is available for all major platforms, See the Bazaar home page for information about versions for your platform. * [[http://bazaar-vcs.org/Download|Bazaar 2.0 or newer]]. As of this writing (2010-02-24) Bazaar 2.1 is the most recent release. As Bazaar is written in Python (yay!), it is available for all major platforms, See the Bazaar home page for information about versions for your platform.
Line 50: Line 29:
* If you are a core developer and you want to develop branches in Bazaar but
push them into the Subversion master, you will need to install the
[[http://bazaar-vcs.org/BzrForeignBranches/Subversion|bzr-svn]] [[http://bazaar-vcs.org/BzrPlugins| plugin]]. This requires Subversion 1.5. The bzr-svn page and its [[https://launchpad.net/bzr-svn||Launchpad project page]] has details about how to install this plugin on your platform.
* A Launchpad login if you want to push branches to Launchpad. You do not need a login if all you're going to do is pull branches from Launchpad.
Line 54: Line 31:
* You will probably want Karl Fogel's [[http://bazaar.launchpad.net/~kfogel/pydev/trunk/annotate/head%3A/README|pydev]] [[http://bazaar-vcs.org/BzrPlugins|plugin]]. This isn't required, but it makes accessing branches much easier by providing a `py:` branch prefix.
Line 64: Line 40:
You will definitely want to create what Bazaar calls a ''shared repository'' on
your system. Because Bazaar (by default) keeps the entire branch history on
the local system, you will want to share this history across all your
You will definitely want to create what Bazaar calls a ''shared repository''
on your system. Because Bazaar (by default) keeps the entire branch history
on the local system, you will want to share this history across all your
Line 69: Line 45:
time you grab a branch, it can take a while.  We're making snapshots of the
his
tory and putting it in a downloadable tarball to get you bootstrapped much
mo
re quickly.
time you grab a branch, it might take a while depending on the speed of your
network connection. After
that, branching inside your shared repo should be
prett
y fast.
Line 73: Line 49:
Start by downloading and unpacking the repository snapshot. This file is
approximately 400MB, so plan accordingly::
To create the shared repo, cd to some convenient place and do the following:
Line 77: Line 52:
% wget http://code.python.org/snapshots/python-bzr-snapshot.tar.bz2
% tar jxf python-bzr-snapshot.tar.bz2
% bzr init-repo python
Line 82: Line 56:
This will leave you with a 'python' directory which will act as your shared
repository.
This `python` directory is your shared repo and you will create all your
branches inside of this. It doesn't matter which of the four branches you're
developing; all of your work can go in the same shared repo.
Line 85: Line 60:
Now, you can create a branch. Let's say you want a copy of the Python 3.0
branch from
the sync'd Subversion master. If you have Karl's pydev plugin
mentioned above, then it's as easy as
this::
Now, you can grab one of the branches. Let's say you want a copy of the
Python 3k trunk; do this:
Line 90: Line 64:
% bzr branch py:3.0 % bzr branch lp:python/py3k
Line 93: Line 67:
If you don't have the plugin, and you are a core Python developer with write
access, do this::
This will create a working directory called `py3k` in your shared repository
directory. Generally, you will want to keep this upstream branch fairly
pristine, updating it occasionally, as commits are made to the Subversion
master and mirrored to the Launchpad branch. Here's how you can pull any new
revisions:
Line 97: Line 74:
% bzr branch bzr+ssh://pythonbzr@code.python.org/python/3.0
}}}

This will create a working directory called `3.0` in your shared repository
directory. Generally, you will want to keep this upstream branch fairly
pristine, updating it occasionally, as commits are made to the upstream
master. Here's how you can pull in new revisions as they are committed to
Subversion and sync'd to the mirror (remember our lag due to cron)::

{{{
% cd 3.0
% cd py3k
Line 109: Line 76:
% cd ..
Line 113: Line 79:
require!) small, frequent branches focused on just the task at hand.  So
branch the pristine 3.0 branch for this bug fix:
require!) small, frequent branches focused on just the task at hand.
Line 117: Line 82:
% bzr branch 3.0 bug1974 % cd ..
% bzr branch py3k bug1974
Line 125: Line 91:
you could commit your changes:: you could commit your changes:
Line 132: Line 98:
to supply a commit message on the command line. to supply a commit message on the command line. You might also like to give
this the `--show-diff` argument to see your changes in the commit buffer.
Line 135: Line 102:
are ready to share your code with someone. If you are a core developer with
commit privileges to Python, you can do one of several things. We're making
space available for your own branches on `code.python.org`. You will not be
able to push your branches onto the sync'd master (yet... unless we someday
switch to Bazaar and turn off Subversion <wink>).

In the meantime, you can push your branch like so (the first time you do this,
you will need to add `--create-prefix`). If you have Karl's pydev plugin and
you've set the `pydev_user` option::
are ready to share your code with someone. To do this, push your branch like
so, substituting your Launchpad user name for `barry` of course.
Line 146: Line 106:
% bzr push py:~barry/bug1974 % bzr push py:~barry/python/bug1974
Line 149: Line 109:
If you don't have Karl's plugin, do this instead:: The last path component can be anything that doesn't already exist.
Line 151: Line 111:
{{{
% bzr push bzr+ssh://pythonbzr@code.python.org/python/users/barry/bug1974
}}}
Now everyone (not just core developers) will be able to view, branch, and
merge your branch, say to do a code review. You can even create a diff of
your branch against the trunk, say to generate a patch for the
[[http://bugs.python.org|Python bug tracker]].
Line 155: Line 116:
Obviously you should replace `barry` with your own user name, but this really
can be anything. As long as you put your branches under `users` you're fine.

Now everyone (not just core developers) will be able to merge your branch, say
to do a code review.

If you are not a core developer and do not have write access to `code.python.org`,
you can find a code hosting service for your branches. One option for example
is Launchpad, a free code hosting service. If you register on Launchpad and
upload your ssh key using the 'ssh key' tab of the profile edit screen,
you can push your branches to it like this, and Launchpad will automatically
associate it with the Python project on Launchpad:

{{{
% bzr push lp:~barry/python/bug1974
}}}

Again, replace `barry` with your Launchpad user name. Note the `lp:` prefix;
this is built into Bazaar and is used to reference Launchpad branches.

Now you can attach this URL to the issue in the Python bug tracker, and it
You can attach your branch URL to the issue in the Python bug tracker, and it
Line 177: Line 118:


== Branch details ==

Most people will use the Subversion mirrors. If you have Karl's `pydev`
plugin mentioned above, everyone can access the branches with these URLs.
Note that `trunk` currently means the future Python 2.7 code base, and `py3k`
means the future Python 3.1 code base::

{{{
py:py3k
py:3.0
py:2.6
py:2.5
py:trunk
}}}

If you don't have the plugin, and are a core developer with commit access, use
these branches::

{{{
bzr+ssh://pythonbzr@code.python.org/python/py3k
bzr+ssh://pythonbzr@code.python.org/python/3.0
bzr+ssh://pythonbzr@code.python.org/python/2.6
bzr+ssh://pythonbzr@code.python.org/python/2.5
bzr+ssh://pythonbzr@code.python.org/python/trunk
}}}

You cannot push new revisions to these branches, as updates are restricted to
the svn mirror process.

If you do not have commit access, use these branches::

{{{
http://code.python.org/python/py3k
http://code.python.org/python/3.0
http://code.python.org/python/2.6
http://code.python.org/python/2.5
http://code.python.org/python/trunk
}}}

All of these branches are mirrored on Launchpad, so you are welcome to
use those instead. Although the mirrors can lag in updates somewhat,
you might have better connectivity to Launchpad. See these urls for details:

{{{
https://code.launchpad.net/~python-dev
https://code.launchpad.net/python
}}}

Line 233: Line 123:
all the [[http://code.python.org/loggerhead/|branches on python.org]].
all the Python branches. E.g. the trunk is visible
[[http://bazaar.launchpad.net/~python-dev/python/trunk/files|here]]. Other
branches can be viewed
by clicking on the appropriate series as listed
[[https://code.edge.launchpad.net/python|here]].
Line 239: Line 132:
You want to create or edit your `~/.bazaar/bazaar.conf` file to set a few things
up. Unlike Subversion, Bazaar commits happen locally, so you have control
over the email address that gets associated with your changes. You should use
an email address that is identifiably you in the Python community.  You may
also decide to [[http://www.gnupg.org|GPG]] sign your commits, though this is not required. Here for
example is my `bazaar.conf` file::
You want to create or edit your `~/.bazaar/bazaar.conf` file to set a few
things up. Unlike Subversion, Bazaar commits happen locally, so you have
control over the email address that gets associated with your changes. You
should use an email address that is identifiably you in the Python community.
You may also decide to [[http://www.gnupg.org|GPG]] sign your commits, though
this is not required. Here for example is my `bazaar.conf` file::
Line 250: Line 143:
gpg_signing_command=gpgv4
Line 257: Line 149:
(The `gpgv4` command is a local script that lets me choose which GPG key gets
used to sign commits, since I have more than one key and Bazaar's config file
doesn't support an option to choose it, yet.)
Line 264: Line 152:
If you are running on Ubuntu, you should have a new enough Bazaar if you are
running Karmic (9.10) or newer. Lucid (10.04) will ship with Bazaar 2.1.
Line 265: Line 156:
bzr on Ubuntu: bzr on older versions of Ubuntu:

Experimental Bazaar Branches

Note: While Python has officially chosen Mercurial for its DVCS, you can still use Bazaar to develop Python. This page describes the current workflow. The migration plan is PEP 385.

Python's source code is maintained under the Subversion revision control system. Unofficial Bazaar mirrors of the Subversion repository are maintained on Launchpad and are kept up-to-date automatically.

What is available?

We currently have mirrors of the Python 2.6, trunk (2.7), 3.1, and py3k (3.2) branches available to the public. These branches are synchronized in near-real time with the Subversion master. This means that as commits are made to Subversion, they will be available in Bazaar on Launchpad soon thereafter. Of course, there's a bit of a lag imposed by the Launchpad puller.

All of the mirrored branches are available here.

Code hosting of Bazaar branches is also available on Launchpad. This means you can branch Python locally via Bazaar, do some development, and then push your branch to Launchpad to share with others. Of course because the master branches are in Subversion, you'll still have to go through the standard Python development process to get your changes into mainline. But short of that, you can do all your development in a nice, modern DVCS.

There is a pretty good Bazaar/Subversion bridge which should allow you to commit your Bazaar branch to the Subversion master, but I have not tried it.

What do I need?

* Bazaar 2.0 or newer. As of this writing (2010-02-24) Bazaar 2.1 is the most recent release. As Bazaar is written in Python (yay!), it is available for all major platforms, See the Bazaar home page for information about versions for your platform.

* Python 2.4 or newer. Bazaar requires at least Python 2.4.

* A Launchpad login if you want to push branches to Launchpad. You do not need a login if all you're going to do is pull branches from Launchpad.

How do I get started?

There are many ways to use Bazaar. Some like to use it the same way they use Subversion. Others like to take advantage of the disconnected and distributed features, so that they can develop code while off the net. The Bazaar web site outlines all these options. The documentation here will describe just one way of working with it.

You will definitely want to create what Bazaar calls a shared repository on your system. Because Bazaar (by default) keeps the entire branch history on the local system, you will want to share this history across all your branches. Having all the history local means you have a fully functional revision control system even when you are not on the 'net, however the first time you grab a branch, it might take a while depending on the speed of your network connection. After that, branching inside your shared repo should be pretty fast.

To create the shared repo, cd to some convenient place and do the following:

% bzr init-repo python
% cd python

This python directory is your shared repo and you will create all your branches inside of this. It doesn't matter which of the four branches you're developing; all of your work can go in the same shared repo.

Now, you can grab one of the branches. Let's say you want a copy of the Python 3k trunk; do this:

% bzr branch lp:python/py3k

This will create a working directory called py3k in your shared repository directory. Generally, you will want to keep this upstream branch fairly pristine, updating it occasionally, as commits are made to the Subversion master and mirrored to the Launchpad branch. Here's how you can pull any new revisions:

% cd py3k
% bzr pull

Now let's say you want to work on a fix for bug 1974. Bazaar encourages (but doesn't require!) small, frequent branches focused on just the task at hand.

% cd ..
% bzr branch py3k bug1974
% cd bug1974

Now you hack the code. You like your changes and want to commit them. Again, Bazaar encourages but does not require frequent commits. Unlike Subversion though, by default commits in Bazaar are completely local (although there is a style of workflow where commits happen to the remote repository). Here's how you could commit your changes:

% bzr commit

This will pop up an editor, but you could also use the -m or -F arguments to supply a commit message on the command line. You might also like to give this the --show-diff argument to see your changes in the commit buffer.

You can keep iterating on the hack-commit cycle as much as you want, until you are ready to share your code with someone. To do this, push your branch like so, substituting your Launchpad user name for barry of course.

% bzr push py:~barry/python/bug1974

The last path component can be anything that doesn't already exist.

Now everyone (not just core developers) will be able to view, branch, and merge your branch, say to do a code review. You can even create a diff of your branch against the trunk, say to generate a patch for the Python bug tracker.

You can attach your branch URL to the issue in the Python bug tracker, and it will be much easier for a core developer to review and apply your changes.

Loggerhead

Loggerhead is the ViewVC of Bazaar. It's a web interface that lets you explore Python's bzr branches, view history, etc. Loggerhead is available for all the Python branches. E.g. the trunk is visible here. Other branches can be viewed by clicking on the appropriate series as listed here.

Anything else?

You want to create or edit your ~/.bazaar/bazaar.conf file to set a few things up. Unlike Subversion, Bazaar commits happen locally, so you have control over the email address that gets associated with your changes. You should use an email address that is identifiably you in the Python community. You may also decide to GPG sign your commits, though this is not required. Here for example is my bazaar.conf file::

[DEFAULT]
email=Barry Warsaw <barry@python.org>
create_signatures=always
smtp_server = mail.example.com
[ALIASES]
last = log -r-10..-1 --line
commit = commit --strict

See the Bazaar documentation for more options on configuring Bazaar.

If you are running on Ubuntu, you should have a new enough Bazaar if you are running Karmic (9.10) or newer. Lucid (10.04) will ship with Bazaar 2.1.

Christian Heimes points out the following instructions for getting the latest bzr on older versions of Ubuntu:

sudo vi /etc/apt/sources.list.d/bzr.list
--- add ---
deb http://ppa.launchpad.net/bzr/ubuntu gutsy main
deb-src http://ppa.launchpad.net/bzr/ubuntu gutsy main
--- eof ---

sudo apt-get update

#  --force-yes because the packages aren't signed yet
sudo apt-get --force-yes -y install bzr bzr-gtk bzrtools

Also read https://launchpad.net/~bzr/+archive and http://bazaar-vcs.org/DistroDownloads

Where do I get help?

Start by reading the Bazaar documentation. There are many ways to use Bazaar and many options, commands and plugins (such as looms which rock) which are not described above. Explore!

Ask your questions on the python-dev@python.org mailing list. We'll keep an eye on things and try to help as much as possible.

Log onto irc.freenode.net and ask around on the #python, #python-dev, or #bzr channels. The former two are better for specific questions about Python's Bazaar branches, while the latter is better for more general Bazaar questions.

Keep refreshing this page! We'll try to keep it updated with new information and examples, based on your feedback.

Bazaar (last edited 2010-02-24 21:18:36 by BarryWarsaw)

Unable to edit the page? See the FrontPage for instructions.