]> arthur.barton.de Git - bup.git/blob - cmd/rm-cmd.py
Port rm and prune-older to vfs2
[bup.git] / cmd / rm-cmd.py
1 #!/bin/sh
2 """": # -*-python-*-
3 bup_python="$(dirname "$0")/bup-python" || exit $?
4 exec "$bup_python" "$0" ${1+"$@"}
5 """
6 # end of bup preamble
7
8 import sys
9
10 from bup.git import check_repo_or_die
11 from bup.options import Options
12 from bup.helpers import die_if_errors, handle_ctrl_c, log
13 from bup.repo import LocalRepo
14 from bup.rm import bup_rm
15
16 optspec = """
17 bup rm <branch|save...>
18 --
19 #,compress=  set compression level to # (0-9, 9 is highest) [6]
20 v,verbose    increase verbosity (can be specified multiple times)
21 unsafe       use the command even though it may be DANGEROUS
22 """
23
24 handle_ctrl_c()
25
26 o = Options(optspec)
27 opt, flags, extra = o.parse(sys.argv[1:])
28
29 if not opt.unsafe:
30     o.fatal('refusing to run dangerous, experimental command without --unsafe')
31
32 if len(extra) < 1:
33     o.fatal('no paths specified')
34
35 check_repo_or_die()
36 repo = LocalRepo()
37 bup_rm(repo, extra, compression=opt.compress, verbosity=opt.verbose)
38 die_if_errors()