Skip to content
Snippets Groups Projects

postgresql: Rename db_to_revision to db_to_optional_revision, and add db_to_revision

Merged vlorentz requested to merge vlorentz/swh-storage:db_to_optional into master
1 unresolved thread

which crashes instead.

db_to_revision should be used to convert when selecting directly from tables, and db_to_optional_revision when doing an outer join with the table.

This allows skipping 'assert revision is not None' just to make mypy happy, which I would need to add while implementing #4672 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
202 representation.
203 This is similar to :func:`db_to_revision`, but this returns :const:`None`
204 instead of crashing if the revision does not exist (returned by an outer join).
205 """
203 206 if db_revision["type"] is None:
204 207 assert all(
205 208 v is None for (k, v) in db_revision.items() if k not in ("id", "parents")
206 209 )
207 210 return None
208 211
212 return db_to_revision(db_revision)
213
214
215 def db_to_revision(db_revision: Dict[str, Any]) -> Revision:
216 """Convert a database representation of a revision to its swh-model
217 representation."""
  • Nicolas Dandrimont approved this merge request

    approved this merge request

  • vlorentz added 6 commits

    added 6 commits

    • 7b730c26...12ab97a7 - 5 commits from branch swh/devel:master
    • 5c402ef2 - postgresql: Rename db_to_revision to db_to_optional_revision, and add db_to_revision

    Compare with previous version

  • vlorentz enabled an automatic merge when the pipeline for 5c402ef2 succeeds

    enabled an automatic merge when the pipeline for 5c402ef2 succeeds

  • Jenkins job DSTO/gitlab-builds #61 failed .
    See Console Output and Coverage Report for more details.

  • vlorentz aborted the automatic merge because target branch was updated

    aborted the automatic merge because target branch was updated

  • vlorentz added 1 commit

    added 1 commit

    • 7da05067 - Mention exceptions in docstrings

    Compare with previous version

  • vlorentz mentioned in merge request !1028 (closed)

    mentioned in merge request !1028 (closed)

  • Jenkins job DSTO/gitlab-builds #66 failed .
    See Console Output and Coverage Report for more details.

  • vlorentz mentioned in issue #4674 (moved)

    mentioned in issue #4674 (moved)

  • vlorentz mentioned in issue swh-model#4640

    mentioned in issue swh-model#4640

  • vlorentz added 4 commits

    added 4 commits

    • 7da05067...a4ffd7ba - 2 commits from branch swh/devel:master
    • 7a2249ad - postgresql: Rename db_to_revision to db_to_optional_revision, and add db_to_revision
    • 26a4a000 - Mention exceptions in docstrings

    Compare with previous version

  • vlorentz enabled an automatic merge when the pipeline for 26a4a000 succeeds

    enabled an automatic merge when the pipeline for 26a4a000 succeeds

  • Jenkins job DSTO/gitlab-builds #70 succeeded .
    See Console Output and Coverage Report for more details.

  • merged

  • Please register or sign in to reply
    Loading