remote-bzr: trivial cleanups

Mostly from remote-hg. It's possible that there's a fix to delete files
with spaces.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-bzr: fix bad state issue

Carried from remote-hg.

The problem reportedly happened after doing a push that fails, the abort
causes the state of remote-hg to go bad, this happens because
remote-hg's marks are not stored, but 'git fast-export' marks are.

Ensure that the marks are _always_ stored.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-bzr: general fixes

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-bzr: add support to push URLs

Just like in remote-hg.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-bzr: store converted URL

Mercurial might convert the URL to something more appropriate, like an
absolute path. Lets store that instead of the original URL, which won't
work from a different working directory if it's relative.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-bzr: fix order of locking in CustomTree

It doesn't seem to make any difference, but revision_tree() requires a
lock.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-bzr: always try to update the worktree

And fail properly.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-bzr: fix partially pushed merge

If part of the merge was already pushed, we don't have the blob_marks
available, however, the commits are already stored in bazaar, so we can
use the revision_tree to fetch the contents.

We want to do this only when there's no other option.

There's no easy way to test this.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-bzr: use branch variable when appropriate

There should be no functional changes. Basically we want to reserve the
'repo' variable.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-bzr: add support for bzr repos

In bazaar, a repository can contain multiple branches, and previously we
were supporting only one branch at a time. Now we fetch them all.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-bzr: add support for shared repo

This way all the remotes share the same data, so adding multiple
remotes, or renaming them doesn't create extra overhead.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-bzr: split marks file

This way all the remotes can share the same git objects, and the same
marks. The information we want to store per remote is very small.

The code transparently converts from one organization of marks, to the
other. It's rather smooth and there shouldn't be any issues.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-bzr: improve author sanitazion

So that we don't end up with '<None>', and also synchronize it with the
one from remote-hg.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
remote-bzr: workaround bzr cloning issue

When branches have '/' in their name (aka. sub-branches), bazaar seems
to choke while creating the new directory. We could try to fix it
properly, but just just workaround it for now.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>