How to find working dirs in a repository?

Asked by Ivan Vilata i Balaguer on 2007-09-03

Somehow related with my previous question #12119, and in general with having an automatic task for updating working dirs in a remote shared repository, I'd like to know if there is a recommended way of getting a list of working dirs in a (local) shared repository. To the moment I take advantage of the "checkout" dir inside ".bzr" with a command like "find . -wholename './*/.bzr/checkout' -type d" (where "." is the repository path), but again, looking at internal files doesn't seem quite neat.

Thanks a lot!

Question information

English Edit question
Bazaar Edit question
No assignee Edit question
Solved by:
David Clymer
Last query:
Last reply:
Best David Clymer (vezult) said : #1

I'm not sure there's a bzrlib mechanism for this. Given a bazaar branch, there are facilities for determining the root of the enclosing repository, but not for identifying its children. My guess is that this is because there is no deterministic way to find all branches within a repository, and as far as a bazaar repository is concerned, all the data is in the repository, not the branches, so there is no need to enumerate them. The branches just contain information that can be used to select a certain set of data in the encosing repository.

IOW, your method may be as good as any.

Thanks David Clymer, that solved my question.

BTW, here is the full script I run with cron under the server hosting Bazaar repositories (bzr-update-checkouts):

set -e

error() {
 echo "$1" > /dev/stderr
 exit 1

test $# -eq 1 || error "Usage: $0 REPOSITORY"
test -d "$repo/.bzr/repository" || error "$0: not a Bazaar repository: $repo"

cd "$repo"
for checkout in $(find . -wholename './*/.bzr/checkout' -type d); do
 (cd "$checkout" && bzr update -q)
chmod -R a+rX .