return branch
+def find_branches(repo):
+ transport = repo.user_transport
+
+ for fn in transport.iter_files_recursive():
+ if not fn.endswith('.bzr/branch-format'):
+ continue
+
+ name = subdir = fn[:-len('/.bzr/branch-format')]
+ name = name if name != '' else 'master'
+ name = name.replace('/', '+')
+
+ try:
+ cur = transport.clone(subdir)
+ branch = bzrlib.branch.Branch.open_from_transport(cur)
+ except bzrlib.errors.NotBranchError:
+ continue
+ else:
+ yield name, branch
+
def get_repo(url, alias):
global dirname, peer, branches
else:
# repository
- for branch in repo.find_branches():
-
- name = repo.user_transport.relpath(branch.base)
- name = name if name != '' else 'master'
- name = name.replace('/', '+')
+ for name, branch in find_branches(repo):
if not is_local:
peers[name] = branch