Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/storage.py
Show First 20 Lines • Show All 517 Lines • ▼ Show 20 Lines | def directory_entry_get_by_path(self, directory, paths, db=None, cur=None): | ||||
""" | """ | ||||
res = db.directory_entry_get_by_path(directory, paths, cur) | res = db.directory_entry_get_by_path(directory, paths, cur) | ||||
if res: | if res: | ||||
return dict(zip(db.directory_ls_cols, res)) | return dict(zip(db.directory_ls_cols, res)) | ||||
def revision_add(self, revisions): | def revision_add(self, revisions): | ||||
"""Add revisions to the storage | """Add revisions to the storage | ||||
Args: | Args: | ||||
revisions (iterable): iterable of dictionaries representing the | revisions (Iterable[dict]): iterable of dictionaries representing | ||||
ardumont: as well. | |||||
individual revisions to add. Each dict has the following keys: | the individual revisions to add. Each dict has the following | ||||
keys: | |||||
- id (sha1_git): id of the revision to add | - id (sha1_git): id of the revision to add | ||||
- date (datetime.DateTime): date the revision was written | - date (dict): date the revision was written | ||||
- date_offset (int): offset from UTC in minutes the revision | - committer_date (dict): date the revision got | ||||
was written | added to the origin | ||||
- date_neg_utc_offset (boolean): whether a null date_offset | |||||
represents a negative UTC offset | |||||
- committer_date (datetime.DateTime): date the revision got | - committer_date (datetime.DateTime): date the revision got | ||||
added to the origin | added to the origin | ||||
- committer_date_offset (int): offset from UTC in minutes the | - committer_date_offset (int): offset from UTC in minutes the | ||||
revision was added to the origin | revision was added to the origin | ||||
- committer_date_neg_utc_offset (boolean): whether a null | - committer_date_neg_utc_offset (boolean): whether a null | ||||
committer_date_offset represents a negative UTC offset | committer_date_offset represents a negative UTC offset | ||||
- type (one of 'git', 'tar'): type of the revision added | - type (one of 'git', 'tar'): type of the revision added | ||||
- directory (sha1_git): the directory the revision points at | - directory (sha1_git): the directory the revision points at | ||||
- message (bytes): the message associated with the revision | - message (bytes): the message associated with the revision | ||||
- author_name (bytes): the name of the revision author | - author (Dict[str, bytes]): dictionary with keys: | ||||
- author_email (bytes): the email of the revision author | name, fullname, email | ||||
- committer_name (bytes): the name of the revision committer | - committer (Dict[str, bytes]): dictionary with keys: | ||||
- committer_email (bytes): the email of the revision committer | name, fullname, email | ||||
- metadata (jsonb): extra information as dictionary | - metadata (jsonb): extra information as dictionary | ||||
- synthetic (bool): revision's nature (tarball, directory | - synthetic (bool): revision's nature (tarball, directory | ||||
creates synthetic revision) | creates synthetic revision) | ||||
- parents (list of sha1_git): the parents of this revision | - parents (list of sha1_git): the parents of this revision | ||||
date dictionaries have the form defined in :mod:`swh.model`. | |||||
""" | """ | ||||
db = self.get_db() | db = self.get_db() | ||||
revisions_missing = set(self.revision_missing( | revisions_missing = set(self.revision_missing( | ||||
set(revision['id'] for revision in revisions))) | set(revision['id'] for revision in revisions))) | ||||
if not revisions_missing: | if not revisions_missing: | ||||
return | return | ||||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | def revision_shortlog(self, revisions, limit=None, db=None, cur=None): | ||||
""" | """ | ||||
yield from db.revision_shortlog(revisions, limit, cur) | yield from db.revision_shortlog(revisions, limit, cur) | ||||
def release_add(self, releases): | def release_add(self, releases): | ||||
"""Add releases to the storage | """Add releases to the storage | ||||
Args: | Args: | ||||
releases (iterable): iterable of dictionaries representing the | releases (Iterable[dict]): iterable of dictionaries representing | ||||
Not Done Inline Actionsas well. ardumont: as well. | |||||
individual releases to add. Each dict has the following keys: | the individual releases to add. Each dict has the following | ||||
keys: | |||||
- id (sha1_git): id of the release to add | - id (sha1_git): id of the release to add | ||||
- revision (sha1_git): id of the revision the release points to | - revision (sha1_git): id of the revision the release points to | ||||
- date (datetime.DateTime): the date the release was made | - date (dict): the date the release was made | ||||
- date_offset (int): offset from UTC in minutes the release was | |||||
made | |||||
- date_neg_utc_offset (boolean): whether a null date_offset | - date_neg_utc_offset (boolean): whether a null date_offset | ||||
represents a negative UTC offset | represents a negative UTC offset | ||||
- name (bytes): the name of the release | - name (bytes): the name of the release | ||||
- comment (bytes): the comment associated with the release | - comment (bytes): the comment associated with the release | ||||
- author_name (bytes): the name of the release author | - author (Dict[str, bytes]): dictionary with keys: | ||||
- author_email (bytes): the email of the release author | name, fullname, email | ||||
the date dictionary has the form defined in :mod:`swh.model`. | |||||
""" | """ | ||||
db = self.get_db() | db = self.get_db() | ||||
release_ids = set(release['id'] for release in releases) | release_ids = set(release['id'] for release in releases) | ||||
releases_missing = set(self.release_missing(release_ids)) | releases_missing = set(self.release_missing(release_ids)) | ||||
if not releases_missing: | if not releases_missing: | ||||
return | return | ||||
▲ Show 20 Lines • Show All 786 Lines • Show Last 20 Lines |
as well.