]> arthur.barton.de Git - bup.git/blob - cmd-join.py
b87319a74027ff1ebc841f288112f14b715cb41f
[bup.git] / cmd-join.py
1 #!/usr/bin/env python2.5
2 import sys, time, struct
3 import hashsplit, git, options, client
4 from helpers import *
5 from subprocess import PIPE
6
7
8 optspec = """
9 bup join [-r host:path] [refs or hashes...]
10 --
11 r,remote=  remote repository path
12 """
13 o = options.Options('bup join', optspec)
14 (opt, flags, extra) = o.parse(sys.argv[1:])
15
16 git.check_repo_or_die()
17
18 if not extra:
19     extra = linereader(sys.stdin)
20
21 if opt.remote:
22     cli = client.Client(opt.remote)
23     for id in extra:
24         for blob in cli.cat(id):
25             sys.stdout.write(blob)
26     cli.close()
27 else:
28     for id in extra:
29         for blob in git.cat(id):
30             sys.stdout.write(blob)