1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#!/usr/bin/env python
import sys
from bup import git, options, client
from bup.helpers import *
optspec = """
bup join [-r host:path] [refs or hashes...]
--
r,remote= remote repository path
"""
o = options.Options('bup join', optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])
git.check_repo_or_die()
if not extra:
extra = linereader(sys.stdin)
ret = 0
if opt.remote:
cli = client.Client(opt.remote)
cat = cli.cat
else:
cp = git.CatPipe()
cat = cp.join
for id in extra:
try:
for blob in cat(id):
sys.stdout.write(blob)
except KeyError, e:
sys.stdout.flush()
log('error: %s\n' % e)
ret = 1
sys.exit(ret)
|