diff --git a/swh/storage/tests/test_storage.py b/swh/storage/tests/test_storage.py --- a/swh/storage/tests/test_storage.py +++ b/swh/storage/tests/test_storage.py @@ -13,7 +13,6 @@ import psycopg2 from nose.plugins.attrib import attr -from swh.core.tests.db_testing import DbTestFixture from swh.model import from_disk, identifiers from swh.model.hashutil import hash_to_bytes from swh.storage.tests.storage_testing import StorageTestFixture diff --git a/utils/dump_revisions.py b/utils/dump_revisions.py --- a/utils/dump_revisions.py +++ b/utils/dump_revisions.py @@ -8,6 +8,7 @@ from swh.storage import converters, db from swh.model import identifiers + QUERY = ''' select r.id, @@ -44,6 +45,7 @@ if id != computed_id: dump_revision(revision) + if __name__ == '__main__': swh_db = db.Db.connect('service=swh', cursor_factory=psycopg2.extras.RealDictCursor) diff --git a/utils/fix_revisions_from_dump.py b/utils/fix_revisions_from_dump.py --- a/utils/fix_revisions_from_dump.py +++ b/utils/fix_revisions_from_dump.py @@ -16,6 +16,7 @@ def author_date_to_negutc(rev): rev['date']['negative_utc'] = True + DATE_NEGUTC_FIX = ('set author negutc', [ (None, None), (author_date_to_negutc, 'date_neg_utcoffset = true'), @@ -29,6 +30,7 @@ def committer_date_to_negutc(rev): rev['committer_date']['negative_utc'] = True + COMMITTER_DATE_NEGUTC_FIX = ('set committer negutc', [ (None, None), (committer_date_to_negutc, 'committer_date_neg_utcoffset = true'), @@ -38,6 +40,7 @@ def message_to_empty(rev): rev['message'] = b'' + MESSAGE_EMPTY_FIX = ('empty instead of null message', [ (None, None), (message_to_empty, "message = ''"), @@ -47,6 +50,7 @@ def message_to_null(rev): rev['message'] = None + MESSAGE_NULL_FIX = ('null instead of empty message', [ (None, None), (message_to_null, "message = NULL"), @@ -88,6 +92,7 @@ def author_name_doublespace(rev): rev['author']['name'] = b''.join([rev['author']['name'], b' ']) + AUTHOR_NAME_ADD_SPC_FIX = ('author double space', [ (None, None), (author_name_doublespace, 'trailing space author name') @@ -97,6 +102,7 @@ def committer_name_doublespace(rev): rev['committer']['name'] = b''.join([rev['committer']['name'], b' ']) + COMMITTER_NAME_ADD_SPC_FIX = ('committer double space', [ (None, None), (committer_name_doublespace, 'trailing space committer name') @@ -106,6 +112,7 @@ def author_name_null(rev): rev['author']['name'] = None + AUTHOR_NAME_NULL_FIX = ('author name null', [ (None, None), (author_name_null, 'None author name') @@ -115,6 +122,7 @@ def author_email_null(rev): rev['author']['email'] = None + AUTHOR_EMAIL_NULL_FIX = ('author email null', [ (None, None), (author_email_null, 'None author email') @@ -124,6 +132,7 @@ def committer_name_null(rev): rev['committer']['name'] = None + COMMITTER_NAME_NULL_FIX = ('committer name null', [ (None, None), (committer_name_null, 'None committer name') @@ -133,6 +142,7 @@ def committer_email_null(rev): rev['committer']['email'] = None + COMMITTER_EMAIL_NULL_FIX = ('committer email null', [ (None, None), (committer_email_null, 'None committer email') @@ -143,6 +153,7 @@ rev['author'] = b''.join([ identifiers.normalize_author(rev['author']), b' ']) + AUTHOR_ADD_SPC_FIX = ('add trailing space to author specification', [ (None, None), (author_add_spc, 'add trailing space to author spec') @@ -153,6 +164,7 @@ rev['committer'] = b''.join([ identifiers.normalize_author(rev['committer']), b' ']) + COMMITTER_ADD_SPC_FIX = ('add trailing space to committer specification', [ (None, None), (committer_add_spc, 'add trailing space to committer spec') @@ -224,6 +236,7 @@ else: return id, [] + if __name__ == '__main__': for hash in sys.stdin.readlines():