From 9521bdea005ce5ec5da7faeec120479bf66827cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Sun, 27 Oct 2013 06:45:25 +0100 Subject: [PATCH] minor formatting fixes, bumped to 0.6.0 --- README.rst | 10 ++++++++-- src/bitrot.py | 9 ++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index a2cd2d4..e496875 100644 --- a/README.rst +++ b/README.rst @@ -36,11 +36,16 @@ under 10 minutes. Both tests on HFS+. Change Log ---------- -0.5.2 +0.6.0 ~~~~~ +* more control over performance with ``--commit-interval`` and + ``--chunk-size`` command-line arguments + * bugfix: symbolic links are now properly skipped +* bugfix: fixed a rare division by zero when run in an empty directory + 0.5.1 ~~~~~ @@ -90,4 +95,5 @@ Change Log Authors ------- -Glued together by `Łukasz Langa `_. +Glued together by `Łukasz Langa `_. Multiple +improvements by `Yang Zhang `_. diff --git a/src/bitrot.py b/src/bitrot.py index e75475f..5e66e07 100644 --- a/src/bitrot.py +++ b/src/bitrot.py @@ -43,7 +43,7 @@ import time DEFAULT_CHUNK_SIZE = 16384 DOT_THRESHOLD = 200 -VERSION = (0, 5, 1) +VERSION = (0, 6, 0) def sha1(path, chunk_size): @@ -55,12 +55,14 @@ def sha1(path, chunk_size): d = f.read(chunk_size) return digest.hexdigest() + def throttled_commit(conn, commit_interval, last_commit_time): if time.time() - last_commit_time > commit_interval: conn.commit() - return time.time() + last_commit_time = time.time() return last_commit_time + def get_sqlite3_cursor(path, copy=False): if copy: if not os.path.exists(path): @@ -87,7 +89,8 @@ def get_sqlite3_cursor(path, copy=False): return conn -def run(verbosity=1, test=False, commit_interval=300, chunk_size=DEFAULT_CHUNK_SIZE): +def run(verbosity=1, test=False, commit_interval=300, + chunk_size=DEFAULT_CHUNK_SIZE): current_dir = b'.' # sic, relative path bitrot_db = os.path.join(current_dir, b'.bitrot.db') conn = get_sqlite3_cursor(bitrot_db, copy=test)