Exemplo n.º 1
0
def main(argv):
    o = options.Options(optspec)
    opt, flags, extra = o.parse_bytes(argv[1:])
    if opt.remote:
        opt.remote = argv_bytes(opt.remote)

    git.check_repo_or_die()

    stdin = byte_stream(sys.stdin)

    if not extra:
        extra = linereader(stdin)

    ret = 0
    repo = RemoteRepo(opt.remote) if opt.remote else LocalRepo()

    if opt.o:
        outfile = open(opt.o, 'wb')
    else:
        sys.stdout.flush()
        outfile = byte_stream(sys.stdout)

    for ref in [argv_bytes(x) for x in extra]:
        try:
            for blob in repo.join(ref):
                outfile.write(blob)
        except KeyError as e:
            outfile.flush()
            log('error: %s\n' % e)
            ret = 1

    sys.exit(ret)
Exemplo n.º 2
0
(opt, flags, extra) = o.parse(sys.argv[1:])
if opt.remote:
    opt.remote = argv_bytes(opt.remote)

git.check_repo_or_die()

stdin = byte_stream(sys.stdin)

if not extra:
    extra = linereader(stdin)

ret = 0
repo = RemoteRepo(opt.remote) if opt.remote else LocalRepo()

if opt.o:
    outfile = open(opt.o, 'wb')
else:
    sys.stdout.flush()
    outfile = byte_stream(sys.stdout)

for ref in [argv_bytes(x) for x in extra]:
    try:
        for blob in repo.join(ref):
            outfile.write(blob)
    except KeyError as e:
        outfile.flush()
        log('error: %s\n' % e)
        ret = 1

sys.exit(ret)
Exemplo n.º 3
0
Arquivo: join-cmd.py Projeto: bup/bup
--
r,remote=  remote repository path
o=         output filename
"""
o = options.Options(optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])

git.check_repo_or_die()

if not extra:
    extra = linereader(sys.stdin)

ret = 0
repo = RemoteRepo(opt.remote) if opt.remote else LocalRepo()

if opt.o:
    outfile = open(opt.o, 'wb')
else:
    outfile = sys.stdout

for ref in extra:
    try:
        for blob in repo.join(ref):
            outfile.write(blob)
    except KeyError as e:
        outfile.flush()
        log('error: %s\n' % e)
        ret = 1

sys.exit(ret)