1#!/bin/sh 2"""": # -*-python-*- 3# https://sourceware.org/bugzilla/show_bug.cgi?id=26034 4export "BUP_ARGV_0"="$0" 5arg_i=1 6for arg in "$@"; do 7 export "BUP_ARGV_${arg_i}"="$arg" 8 shift 9 arg_i=$((arg_i + 1)) 10done 11# Here to end of preamble replaced during install 12bup_python="$(dirname "$0")/../../config/bin/python" || exit $? 13exec "$bup_python" "$0" 14""" 15# end of bup preamble 16 17from __future__ import absolute_import 18import os.path, sys 19 20sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..'] 21 22from bup import compat 23from bup.compat import argv_bytes 24from bup.git import check_repo_or_die 25from bup.options import Options 26from bup.helpers import die_if_errors, handle_ctrl_c, log 27from bup.repo import LocalRepo 28from bup.rm import bup_rm 29 30optspec = """ 31bup rm <branch|save...> 32-- 33#,compress= set compression level to # (0-9, 9 is highest) [6] 34v,verbose increase verbosity (can be specified multiple times) 35unsafe use the command even though it may be DANGEROUS 36""" 37 38handle_ctrl_c() 39 40o = Options(optspec) 41opt, flags, extra = o.parse(compat.argv[1:]) 42 43if not opt.unsafe: 44 o.fatal('refusing to run dangerous, experimental command without --unsafe') 45 46if len(extra) < 1: 47 o.fatal('no paths specified') 48 49check_repo_or_die() 50repo = LocalRepo() 51bup_rm(repo, [argv_bytes(x) for x in extra], 52 compression=opt.compress, verbosity=opt.verbose) 53die_if_errors() 54