2 import sys, os, re, time
7 path = re.sub(r'/+', '/', path)
9 p2 = re.sub(r'/[^/]+/\.\.(/|$)', '/', path) # handle ../ notation
12 l = path.split('/', 3)
23 return (ref, date, dir)
29 s,hash show hash for each file
31 o = options.Options('bup ls', optspec)
32 (opt, flags, extra) = o.parse(sys.argv[1:])
34 git.check_repo_or_die()
41 (ref, date, path) = namesplit(d)
43 for (name,sha) in git.list_refs():
44 name = re.sub('^refs/heads/', '', name)
46 print '%s %s' % (sha.encode('hex'), name)
50 dates = list(git.rev_list(ref))
52 for (date,commit) in dates:
53 l = time.localtime(date)
54 print repr((time.strftime('%Y-%m-%d-%H%M%S', l),commit))
56 dates = list(git.rev_list(ref))
57 dates.sort(reverse=True)
59 dp = time.strptime(date, '%Y-%m-%d-%H%M%S')
61 dp = time.strptime(date, '%Y-%m-%d')
64 for (d,commit) in dates:
67 it = cp.get('%s:%s' % (commit.encode('hex'), path or ''))
70 for (mode,name,sha) in git._treeparse(''.join(it)):
72 print '%s %s' % (sha.encode('hex'), name)
76 (dir,name) = os.path.split(path)
78 print '%s %s' % ('?', name) # FIXME