Bazaar does not have a subrepository feature. [Correction: Apparently there's a bzr-externals plugin, available at lp:bzr-externals, though it emulates the svn:externals feature, not Git submodules or Mercurial subrepos.]
However, this can fairly easily be worked around if you do not want to switch version control systems.
Put the application and the library in two directories, say app
and lib
(I'll assume here that they are side-by-side, though they need not be). The following two scripts, lib-snapshot
and lib-sync
can then be used to link the current version of the application to a specific version of the library, which will be checked out in a subdirectory (also called lib
) of the app
checkout:
lib-snapshot:
#!/bin/sh
libsrc=../lib
bzr revno --tree $libsrc >libversion.txt
lib-sync:
#!/bin/sh
ver=`cat libversion.txt`
libsrc=../lib
libdst=lib
test -d $libdst/.bzr && bzr update -q -r $ver $libdst || bzr checkout -q --lightweight -r $ver $libsrc $libdst
The current version of the library is stored in libversion.txt
, which you need to put under version control (so that each version of the application is synced to the version you tested against).
The lib-snapshot
script will fetch the currently checked out version of your library and store it in libversion.txt
. Use it whenever you think the library is stable enough that you want your application to use the new version. The lib-sync
script can then be used to update the library subdirectory to contain the snapshot version; ideally, this script should also be used as part of the build/deployment process.
Bazaar will automatically skip directories that contain repositories when adding files, but you may want to still add the library subdirectory to .bzrignore
so that you don't get annoying warnings.