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