I'm not entirely sure from your post what you're looking for. I'm taking a stab at giving an answer; let me know if that's not what you need.
The following is a simple script to copy all branches from a source to a target repo. Note that it won't work if the branch directory names contain any whitespace. You will have to setup the target repository with bzr init-repo
first.
#!/bin/sh
SOURCEREPO=$1
TARGETREPO=$2
if [ ! -d "$TARGETREPO/.bzr" ]; then
echo "$TARGETREPO is not a Bazaar repository; create one with bzr init-repo"
exit 1
fi
BRANCHES=`cd "$SOURCEREPO"; find * -name .bzr -exec dirname '{}' ';'`
for branch in $BRANCHES; do
mkdir -p "$TARGETREPO/$branch"
if [ ! -d "$TARGETREPO/$branch/.bzr" ]; then
echo "Cloning $branch"
bzr branch --use-existing-dir "$SOURCEREPO/$branch" "$TARGETREPO/$branch" \
&& bzr config -d "$TARGETREPO/$branch" --remove parent_location
else
echo "Existing branch in $TARGETREPO/$branch"
fi
done
Basically, it does a bzr branch sourcerepo/branchdir targetrepo/branchdir
for all branches and then uses bzr config
to get rid of the parent location setting for each copy of a branch (because that location will presumably soon disappear).