Page MenuHomeSoftware Heritage

Reimplement swh_db_version with psycopg2
ClosedPublic

Authored by olasd on Sep 18 2020, 3:58 PM.

Details

Summary

This allows us to reuse an existing connection if needed, and to be more
specific which errors we ignore or not.

Test Plan

ran swh db-init on some modules successfully

Diff Detail

Repository
rDCORE Foundations and core functionalities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D3992 (id=14070)

Could not rebase; Attempt merge onto 28d61c8cf1...

Updating 28d61c8..e5312bd
Fast-forward
 swh/core/cli/db.py              |  3 +-
 swh/core/db/db_utils.py         | 71 ++++++++++++++++++++++++++++++++++-------
 swh/core/db/tests/db_testing.py | 37 ---------------------
 tox.ini                         |  2 +-
 4 files changed, 62 insertions(+), 51 deletions(-)
Changes applied before test
commit e5312bdaa865565d1a6c88ddcdc2ffabfa0bb70c
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Fri Sep 18 15:43:27 2020 +0200

    Reimplement swh_db_version with psycopg2
    
    This allows us to reuse an existing connection if needed, and to be more
    specific which errors we ignore or not.

commit 30be93846340bb289f9e780c5b0d6c50dfe8b506
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Fri Sep 18 15:42:24 2020 +0200

    Pin black to the same version as the pre-commit hook

commit b63d7f432caeb9d75da6151fb20f3764beec7f80
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Fri Sep 18 14:39:50 2020 +0200

    Fix license statements on db_utils.py
    
    When the code was migrated from swh.storage, some other ancillary functions were
    merged into this file. So bits of it are under the LGPLv3 (the code pulled from
    psycopg2) and bits are under the GPLv3 (the code we wrote).

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/65/ for more details.

anlambert added a subscriber: anlambert.

Looks good to me.

swh/core/db/db_utils.py
54

No need to repeat typing here

This revision is now accepted and ready to land.Sep 18 2020, 4:19 PM
This revision was automatically updated to reflect the committed changes.