3 bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
4 exec "$bup_python" "$0" ${1+"$@"}
11 exe = os.path.realpath(argv[0])
12 exepath = os.path.split(exe)[0] or '.'
13 exeprefix = os.path.split(os.path.abspath(exepath))[0]
15 # fix the PYTHONPATH to include our lib dir
16 libpath = os.path.join(exepath, '..', 'lib')
17 sys.path[:0] = [libpath]
18 os.environ['PYTHONPATH'] = libpath + ':' + os.environ.get('PYTHONPATH', '')
20 from bup.helpers import handle_ctrl_c, readpipe
21 from bup import options
24 subtree-hash ROOT_HASH [PATH_ITEM...]
30 o = options.Options(optspec)
31 (opt, flags, extra) = o.parse(sys.argv[1:])
34 o.fatal('must specify a root hash')
41 subtree_items = readpipe(['git', 'ls-tree', '-z', tree_hash])
43 for entry in subtree_items.split('\0'):
46 info, name = entry.split('\t', 1)
47 if name == target_name:
48 _, _, target_hash = info.split(' ')
51 print >> sys.stderr, "Can't find %r in %s" % (target_name, tree_hash)
53 tree_hash = target_hash