~abentley/bzrtools/bzrtools.dev

352 by Aaron Bentley
Added branches subcommand
1
from bzrlib.transport import get_transport
354 by Aaron Bentley
Added apache index scraping to the branches command
2
from bzrtools import iter_branches, apache_ls
352 by Aaron Bentley
Added branches subcommand
3
4
def branches(location=None):
5
    if location is None:
6
        location = '.'
7
    t = get_transport(location)
354 by Aaron Bentley
Added apache index scraping to the branches command
8
    if location.startswith('http://'):
9
        lister = apache_ls
10
    elif not t.listable():
352 by Aaron Bentley
Added branches subcommand
11
        print "Can't list this type of location."
12
        return 3
354 by Aaron Bentley
Added apache index scraping to the branches command
13
    else:
14
        lister = None
15
    for branch in iter_branches(t, lister):
352 by Aaron Bentley
Added branches subcommand
16
        print branch.base[len(t.base):].rstrip('/')