How to find working dirs in a repository?

Asked by Ivan Vilata i Balaguer

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

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
David Clymer
Solved:
Last query:
Last reply:
Revision history for this message
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.

Revision history for this message
Ivan Vilata i Balaguer (ivilata) said :
#2

Thanks David Clymer, that solved my question.

Revision history for this message
Ivan Vilata i Balaguer (ivilata) said :
#3

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

#!/bin/sh
set -e

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

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

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