]> arthur.barton.de Git - bup.git/blob - cmd-init.py
Rewrite bup-join in python and add remote server support.
[bup.git] / cmd-init.py
1 #!/usr/bin/env python2.5
2 import git, options, client
3 from helpers import *
4
5 optspec = """
6 [BUP_DIR=...] bup init [-r host:path]
7 --
8 r,remote=  remote repository path
9 """
10 o = options.Options('bup init', optspec)
11 (opt, flags, extra) = o.parse(sys.argv[1:])
12
13 if extra:
14     log("bup init: no arguments expected\n")
15     o.usage()
16
17
18 if opt.remote:
19     git.init_repo()  # local repo
20     git.check_repo_or_die()
21     cli = client.Client(opt.remote, create=True)
22     cli.close()
23     exit(0)  # if close() didn't throw an exception
24 else:
25     exit(git.init_repo())