2 # amend HEAD commit to contain acab in its hash, it does so by repeatedly
3 # amending the commit with a new date.
10 parser = argparse.ArgumentParser()
11 parser.add_argument('--start', type=str, default='commit', help='now or commit')
12 parser.add_argument('--prefix', action='store_true')
13 parser.add_argument('-v', '--verbose', action='store_true')
14 args = parser.parse_args()
16 if args.start == 'commit':
17 p = subprocess.run(['git', 'show', '--format=format:%at'], capture_output=True)
18 timestamp = int(p.stdout[: p.stdout.index(b'\n')])
19 elif args.start == 'now':
20 timestamp = int(time.time())
22 sys.stderr('unknown value for --start')
30 timestamp += direction
31 if counter % 3600 == 0:
32 # don't move more than one hour in the past, going back to initial time
33 # will give new commit hashes as the commit date (not author date) will
35 direction = - direction
38 '%5d - %s - [%s:%02d]'
41 time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(timestamp)),
42 int((time.time() - t0) // 60),
43 int((time.time() - t0) % 60),
54 '--date=%s' % time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(timestamp)),
58 p = subprocess.run(['git', 'rev-parse', 'HEAD'], capture_output=True)
60 if b'acab' == p.stdout[:4]:
62 elif b'acab' in p.stdout:
66 print('\ngot %s' % p.stdout.decode().strip())