minor formatting fixes, bumped to 0.6.0

This commit is contained in:
Łukasz Langa 2013-10-27 06:45:25 +01:00
parent a8faff93e1
commit 9521bdea00
2 changed files with 14 additions and 5 deletions

View File

@ -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 <mailto:lukasz@langa.pl>`_.
Glued together by `Łukasz Langa <mailto:lukasz@langa.pl>`_. Multiple
improvements by `Yang Zhang <mailto:yaaang@gmail.com>`_.

View File

@ -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)