8 print 'data %d' % len(s
)
18 def write_commit(branch
, files
, msg
, parent
= None):
19 print 'commit %s' % branch
22 auth
= 'X Ample <xa@example.com> %d +0000' % (1000000000 + m
)
23 print 'author %s' % auth
24 print 'committer %s' % auth
27 print 'from :%d' % parent
28 for fn
, fm
in sorted(files
.iteritems()):
29 print 'M 100644 :%d %s' % (fm
, fn
)
32 def set_ref(ref
, mark
):
33 print 'reset %s' % ref
34 print 'from :%d' % mark
37 return ''.join('%d %s\n' % (x
, fn
) for x
in xrange(10))
43 yield '%02d/%02d/%02d' % (i
, j
, k
)
46 def t(name
): return 'refs/tags/%s' % name
47 files
= dict((fn
, write_blob(stdblob(fn
))) for fn
in iter_paths())
48 initial
= write_commit(t('bomb-base'), files
, 'Initial commit')
49 set_ref(t('bomb-top'), initial
)
50 for fn
in iter_paths():
51 write_commit(t('bomb-top'),
52 { fn
: write_blob(stdblob(fn
) + 'Last line\n') },
53 'Add last line to %s' % fn
)
54 write_commit(t('add-file'), { 'woo-hoo.txt': write_blob('woo-hoo\n') },
55 'Add a new file', parent
= initial
)
56 files
= dict((fn
, write_blob('First line\n' + stdblob(fn
)))
57 for fn
in iter_paths())
58 write_commit(t('modify-all'), files
, 'Add first line to all files',