Repositories inside repositories
Ben Finney
ben at benfinney.id.au
Mon Sep 4 02:01:18 BST 2006
Howdy all,
With the advent of repositories -- directories that bzr is aware
contain branches at arbitrary subdirectory levels -- comes the desire
to organise the directory layout of the repository, and change it over
time, while retaining the full benefit to bzr of the repository.
Use case A:
- Create a repository
$ bzr init-repository ~/Projects/shizzle/
- Create branches in the repository
$ cd ~/Projects/shizzle/
$ bzr init shizzle.dev/
$ bzr init shizzle.release/
$ bzr init shizzle.feature-x/
- Work on all branches -- 'bzr commit', etc.
My understanding is that this causes the repository to collect
some of the version control information, such that the branches
themselves no longer contain everything necessary to operate
independently.
- Decide that (only) some branches should be published
- Create a subdirectory in the repository for the purpose
$ mkdir ~/Projects/shizzle/public/
$ cd ~/Projects/shizzle/public/
$ ln -s ../shizzle.dev ../shizzle.release .
- Publish the public branches to a remote location
$ rsync -az --copy-dirlinks ~/Projects/shizzle/public webhost:/srv/bzr/public
Unfortunately, this fails because the remote location is not a
repository, and the branches that have been copied don't contain
sufficient version information to operate outside the repository.
Even if the remote location were a repository, simply copying a
directory tree into it does not cause its version information to
become consistent.
So what if we were to create a repository inside the existing one, to
collect only those branches we want to publish?
- Create a repository inside the existing one
$ bzr init-repository ~/Projects/shizzle/public/
- Publish the public repository to a remote location
$ rsync -az --copy-dirlinks ~/Projects/shizzle/public webhost:/srv/bzr/public
This still fails, though, because creating the repository hasn't
brought it up to date with all the existing branches that are found
within it.
So perhaps what's needed here is a way to tell bzr to update a
repository so that its version information is normalised with all the
branches to be found in subdirectories.
- Update the repository and publish
$ bzr update-repository ~/Projects/shizzle/public/
$ rsync -az --copy-dirlinks ~/Projects/shizzle/public webhost:/srv/bzr/public
This would be done every time we want to publish, so we know the
repository is both normalised (is efficient in storing version
information, the way repositories should be) and up-to-date with all
branches in its subdirectories.
Possibly it would be useful to also have an option to do this when
first creating a repository.
- Create a repository that already contains subdirectory branches
$ bzr init-repository --collect ~/Projects/shizzle/public/
Or perhaps that should be the default behaviour for init-repository.
Thoughts?
[please don't send me copies of followups, I read via NNTP]
--
\ "When I was crossing the border into Canada, they asked if I |
`\ had any firearms with me. I said, 'Well, what do you need?'" |
_o__) -- Steven Wright |
Ben Finney
More information about the bazaar
mailing list