6 exe = os.path.realpath(argv[0])
7 exepath = os.path.split(exe)[0] or '.'
8 exeprefix = os.path.split(os.path.abspath(exepath))[0]
10 # fix the PYTHONPATH to include our lib dir
11 libpath = os.path.join(exepath, '..', 'lib')
12 sys.path[:0] = [libpath]
13 os.environ['PYTHONPATH'] = libpath + ':' + os.environ.get('PYTHONPATH', '')
15 from bup.helpers import handle_ctrl_c, readpipe
16 from bup import options
19 subtree-hash ROOT_HASH [PATH_ITEM...]
25 o = options.Options(optspec)
26 (opt, flags, extra) = o.parse(sys.argv[1:])
29 o.fatal('must specify a root hash')
36 subtree_items = readpipe(['git', 'ls-tree', '-z', tree_hash])
38 for entry in subtree_items.split('\0'):
41 info, name = entry.split('\t', 1)
42 if name == target_name:
43 _, _, target_hash = info.split(' ')
46 print >> sys.stderr, "Can't find %r in %s" % (target_name, tree_hash)
48 tree_hash = target_hash