|
| 1 | +#!/usr/bin/env python3 |
| 2 | + |
| 3 | +""" |
| 4 | +You may want to create this in a tmpfs or ramfs, since deleting the generate repository can take a **huge** ammount of time. |
| 5 | +
|
| 6 | + ulimit -Sv 500000 |
| 7 | + sudo umount tmp && \ |
| 8 | + sudo mount -t tmpfs -o size=1g tmpfs tmp && \ |
| 9 | + sudo chown $USER:$USER tmp && |
| 10 | + ./imagine-all-the-people.py |
| 11 | +
|
| 12 | +The tags can be used to push by parts to GitHub, which does not accept 1M at once: |
| 13 | +
|
| 14 | + remote='[email protected]:cirosantilli/test-many-commits-1m.git' |
| 15 | + for i in `seq 10 10 100`; do |
| 16 | + git --git-dir=tmp/repo.tmp/.git push -f "$remote" "$i:master" |
| 17 | + done |
| 18 | + # TODO for some reason I needed this afterwards. |
| 19 | + git --git-dir=tmp/repo.tmp/.git push "$remote" 'master' |
| 20 | +""" |
| 21 | + |
| 22 | +import datetime |
| 23 | +import subprocess |
| 24 | + |
| 25 | +import util |
| 26 | + |
| 27 | +util.init() |
| 28 | + |
| 29 | +tree = util.create_tree_with_one_file() |
| 30 | +commit = None |
| 31 | +n = 1000000 |
| 32 | +percent = (n / 100) |
| 33 | +p = 0 |
| 34 | +for i in range(n): |
| 35 | + commit, _, _ = util.save_commit_object(tree, (commit,), |
| 36 | + message=(str(i).encode('ascii'))) |
| 37 | + if i % percent == 0: |
| 38 | + print(p) |
| 39 | + print(datetime.datetime.now()) |
| 40 | + p += 1 |
| 41 | + |
| 42 | + # Lose objects are too large and blow up the tmpfs. |
| 43 | + |
| 44 | + # Does clean packets, but the calculation takes more and more memory, |
| 45 | + # and slows down and blows up at the end. TODO which subcommand blows up eactly?. |
| 46 | + #subprocess.check_output(['git', 'gc']) |
| 47 | + |
| 48 | + subprocess.check_output(['git', 'repack']) |
| 49 | + subprocess.check_output(['git', 'prune-packed']) |
| 50 | + |
| 51 | + subprocess.check_output(['git', 'tag', str(p), commit]) |
| 52 | + |
| 53 | +# Finish. |
| 54 | +util.create_master(commit) |
| 55 | +util.clone() |
0 commit comments