3 bup_python="$(dirname "$0")/../cmd/bup-python" || exit $?
4 exec "$bup_python" "$0" ${1+"$@"}
8 from __future__ import absolute_import
11 from bup.helpers import handle_ctrl_c, readpipe
12 from bup import options
16 subtree-hash ROOT_HASH [PATH_ITEM...]
22 o = options.Options(optspec)
23 (opt, flags, extra) = o.parse(sys.argv[1:])
26 o.fatal('must specify a root hash')
33 subtree_items = readpipe(['git', 'ls-tree', '-z', tree_hash])
35 for entry in subtree_items.split('\0'):
38 info, name = entry.split('\t', 1)
39 if name == target_name:
40 _, _, target_hash = info.split(' ')
43 print >> sys.stderr, "Can't find %r in %s" % (target_name, tree_hash)
45 tree_hash = target_hash