diff options
author | 2012-10-16 04:55:25 -0700 | |
---|---|---|
committer | 2012-10-16 13:28:49 -0700 | |
commit | 1b2519db256e96c3261c318387d3c7605020eb66 (patch) | |
tree | a5018f77bcff84f6059f0e39a8547a6d93f7028a | |
parent | manifest recommit deduplication. (diff) | |
download | git-conversion-tools-1b2519db256e96c3261c318387d3c7605020eb66.tar.gz git-conversion-tools-1b2519db256e96c3261c318387d3c7605020eb66.tar.bz2 git-conversion-tools-1b2519db256e96c3261c318387d3c7605020eb66.zip |
tweak the progress output a bit; specifically, percentile increments
-rwxr-xr-x | rewrite-commit-dump.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/rewrite-commit-dump.py b/rewrite-commit-dump.py index 1df8211..8cf1f4c 100755 --- a/rewrite-commit-dump.py +++ b/rewrite-commit-dump.py @@ -168,14 +168,16 @@ def deserialize_records(source, blob_idx): # Bleh... of course namedtuple doesn't make this easy. line = source.readline() -def serialize_records(records, handle, target='refs/heads/master', progress=5000): +def serialize_records(records, handle, target='refs/heads/master', progress=100): write = handle.write write('reset %s\n' % target) total = len(records) + total_len = len(str(total)) + progress_interval = max(1, total // progress) for idx, record in enumerate(records, 1): - if idx % progress == 0: - write('progress %02.1f%%: %i of %i commits\n' - % ((100 * float(idx))/total, idx, total)) + if idx % progress_interval == 0: + write('progress %02.0f%%: %s of %i commits\n' + % ((100 * float(idx))/total, str(idx).rjust(total_len), total)) write('commit %s\n' % target) write('mark :%i\n' % idx) # fields = ('mark', 'author', 'committer', 'msg', 'files') |