How to store binaries along tree

John Arbash Meinel john at arbash-meinel.com
Wed May 4 07:03:41 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 5/3/2011 10:17 PM, Anteru wrote:
> Hi,
> 

...

> Is there a way to have one subfolder of the source code repository
> branch being linked to another repository, doing a lightweight checkout
> there? I.e. having a /bin subfolder which pulls in from another Bazaar
> repository? If it's not possible with Bazaar, could it be made to work
> with SVN for instance? Alternatively: Could we add a repository hook
> which gets executed on the client side using the Bazaar Python runtime?
> This would allow us to manually hack this in (even though I would like
> to avoid the last solution, as we would wind up with Python 2.x code
> while the rest of our codebase is Python 3.2, but it should be pretty
> limited/self-contained.)
> 
> Cheers,
>   Anteru
> 
> 

You can always have a subdirectory pointing at a different repository,
and it can be a lightweight checkout rather than a full branch if you
want to avoid having a local copy of the history. I think the biggest
part is how you want this subdirectory to be managed wrt the containing
directory. If you are okay with doing manual updates, then there
shouldn't be any problems, nor need any extra functionality.

This is how I would set it up from scratch:

$work => a directory containing all files, including 'bin/'
$server => the central location for your files, something like:
	bzr+ssh://host/srv/bzr

cd $work
bzr init
# You won't be versioning "bin" in the outer directory, so ignore it
bzr ignore ./bin
bzr add
bzr commit -m "Initial import"
bzr init-repo --no-trees $server/repo/
bzr push $server/repo/trunk

cd bin
bzr init
bzr add
bzr commit -m "Initial import of binaries"
bzr init-repo --no-trees $server/repo-bin
bzr push $server/repo-bin/trunk

# Now change the bin directory to be a lightweight checkout
# I don't know of a trivial way to do it without re-creating the
# directory, though the bzr data model would allow it, just isn't
# exposed. If it is an issue, I can work through it with you.
cd ..
rm -rf bin
bzr co --lightweight $server/repo-bin/trunk bin


At this point, you now have a full history branch+repository at $work,
and a separate lightweight checkout at $work/bin. When you want newer
binary files you can do:
 cd bin
 bzr up

There are more things I would tweak if you have a large project, etc.
But this was meant as a way to show how I would set up your specific
request. (I want to version large files in a separate repository, and
avoid having a local copy of history.)

Note that you can still create branches of bin and switch between it.
Just you would probably want to do that on the server side. So something
like:

 cd $work/bin
 bzr branch --switch $server/repo-bin/trunk $server/repo-bin/feature
 # alternatively, though it is fairly context sensitive, and always
 # branches from the 'current' branch to the new branch name, rather
 # than starting from a clean trunk each time:
 bzr switch -b feature

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3A+k0ACgkQJdeBCYSNAANFhwCcDR2cijbP+hRCmMwMjGPAorF6
y+sAoNS4dpl7zt5BqMZxEpRmfFh0vqKg
=StOV
-----END PGP SIGNATURE-----



More information about the bazaar mailing list