# or
# % git clone bzr::lp:myrepo
#
+# If you want to specify which branches you want track (per repo):
+# git config remote-bzr.branches 'trunk, devel, test'
+#
import sys
def gittz(tz):
return '%+03d%02d' % (tz / 3600, tz % 3600 / 60)
+def get_config(config):
+ cmd = ['git', 'config', '--get', config]
+ process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ output, _ = process.communicate()
+ return output
+
class Marks:
def __init__(self, path):
return branch
-def find_branches(repo):
+def find_branches(repo, wanted):
transport = repo.user_transport
for fn in transport.iter_files_recursive():
name = name if name != '' else 'master'
name = name.replace('/', '+')
+ if wanted and not name in wanted:
+ continue
+
try:
cur = transport.clone(subdir)
branch = bzrlib.branch.Branch.open_from_transport(cur)
else:
# repository
- for name, branch in find_branches(repo):
+ wanted = get_config('remote-bzr.branches').rstrip().split(', ')
+ # stupid python
+ wanted = [e for e in wanted if e]
+
+ for name, branch in find_branches(repo, wanted):
if not is_local:
peers[name] = branch