Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/db.py
Show First 20 Lines • Show All 292 Lines • ▼ Show 20 Lines | class Db(BaseDb): | ||||
revision_add_cols = [ | revision_add_cols = [ | ||||
'id', 'date', 'date_offset', 'date_neg_utc_offset', 'committer_date', | 'id', 'date', 'date_offset', 'date_neg_utc_offset', 'committer_date', | ||||
'committer_date_offset', 'committer_date_neg_utc_offset', 'type', | 'committer_date_offset', 'committer_date_neg_utc_offset', 'type', | ||||
'directory', 'message', 'author_fullname', 'author_name', | 'directory', 'message', 'author_fullname', 'author_name', | ||||
'author_email', 'committer_fullname', 'committer_name', | 'author_email', 'committer_fullname', 'committer_name', | ||||
'committer_email', 'metadata', 'synthetic', | 'committer_email', 'metadata', 'synthetic', | ||||
] | ] | ||||
revision_get_cols = revision_add_cols + [ | revision_get_cols = revision_add_cols + ['parents'] | ||||
'author_id', 'committer_id', 'parents'] | |||||
def origin_visit_add(self, origin, ts, type, cur=None): | def origin_visit_add(self, origin, ts, type, cur=None): | ||||
"""Add a new origin_visit for origin origin at timestamp ts with | """Add a new origin_visit for origin origin at timestamp ts with | ||||
status 'ongoing'. | status 'ongoing'. | ||||
Args: | Args: | ||||
origin: origin concerned by the visit | origin: origin concerned by the visit | ||||
ts: the date of the visit | ts: the date of the visit | ||||
▲ Show 20 Lines • Show All 466 Lines • ▼ Show 20 Lines | def origin_count(self, url_pattern, regexp=False, | ||||
regexp=regexp, with_visit=with_visit, cur=cur) | regexp=regexp, with_visit=with_visit, cur=cur) | ||||
return cur.fetchone()[0] | return cur.fetchone()[0] | ||||
release_add_cols = [ | release_add_cols = [ | ||||
'id', 'target', 'target_type', 'date', 'date_offset', | 'id', 'target', 'target_type', 'date', 'date_offset', | ||||
'date_neg_utc_offset', 'name', 'comment', 'synthetic', | 'date_neg_utc_offset', 'name', 'comment', 'synthetic', | ||||
'author_fullname', 'author_name', 'author_email', | 'author_fullname', 'author_name', 'author_email', | ||||
] | ] | ||||
release_get_cols = release_add_cols + ['author_id'] | release_get_cols = release_add_cols | ||||
def release_get_from_list(self, releases, cur=None): | def release_get_from_list(self, releases, cur=None): | ||||
cur = self._cursor(cur) | cur = self._cursor(cur) | ||||
query_keys = ', '.join( | query_keys = ', '.join( | ||||
self.mangle_query_key(k, 'release') | self.mangle_query_key(k, 'release') | ||||
for k in self.release_get_cols | for k in self.release_get_cols | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |