]> arthur.barton.de Git - bup.git/blob - cmd/init-cmd.py
cmd/init: don't spit out a traceback on init error
[bup.git] / cmd / init-cmd.py
1 #!/usr/bin/env python
2 import sys
3
4 from bup import git, options, client
5 from bup.helpers import *
6
7
8 optspec = """
9 [BUP_DIR=...] bup init [-r host:path]
10 --
11 r,remote=  remote repository path
12 """
13 o = options.Options('bup init', optspec)
14 (opt, flags, extra) = o.parse(sys.argv[1:])
15
16 if extra:
17     o.fatal("no arguments expected")
18
19
20 try:
21     git.init_repo()  # local repo
22 except git.GitError, e:
23     log("bup: error: could not init repository: %s" % e)
24     sys.exit(1)
25
26 if opt.remote:
27     git.check_repo_or_die()
28     cli = client.Client(opt.remote, create=True)
29     cli.close()