1 # -*- coding: utf-8 -*-
2 from __future__
import (absolute_import
, division
, print_function
,
10 return (next_mark
- 1)
13 print('data %d' % len(s
))
23 def write_commit(branch
, files
, msg
, parent
= None):
24 print('commit %s' % branch
)
27 auth
= 'X Ample <xa@example.com> %d +0000' % (1000000000 + m
)
28 print('author %s' % auth
)
29 print('committer %s' % auth
)
31 if parent
is not None:
32 print('from :%d' % parent
)
33 for fn
, fm
in sorted(files
.items()):
34 print('M 100644 :%d %s' % (fm
, fn
))
37 def set_ref(ref
, mark
):
38 print('reset %s' % ref
)
39 print('from :%d' % mark
)
42 return ''.join('%d %s\n' % (x
, fn
) for x
in range(10))
48 yield '%02d/%02d/%02d' % (i
, j
, k
)
51 def t(name
): return 'refs/tags/%s' % name
52 files
= dict((fn
, write_blob(stdblob(fn
))) for fn
in iter_paths())
53 initial
= write_commit(t('bomb-base'), files
, 'Initial commit')
54 set_ref(t('bomb-top'), initial
)
55 for fn
in iter_paths():
56 write_commit(t('bomb-top'),
57 { fn
: write_blob(stdblob(fn
) + 'Last line\n') },
58 'Add last line to %s' % fn
)
59 write_commit(t('add-file'), { 'woo-hoo.txt': write_blob('woo-hoo\n') },
60 'Add a new file', parent
= initial
)
61 files
= dict((fn
, write_blob('First line\n' + stdblob(fn
)))
62 for fn
in iter_paths())
63 write_commit(t('modify-all'), files
, 'Add first line to all files',