Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9345934
D1056.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Subscribers
None
D1056.diff
View Options
diff --git a/swh/storage/storage.py b/swh/storage/storage.py
--- a/swh/storage/storage.py
+++ b/swh/storage/storage.py
@@ -154,7 +154,7 @@
if cont['sha1'] in missing_content)
db.copy_to(content_filtered, 'tmp_content',
- db.content_get_metadata_keys, cur)
+ db.content_get_metadata_keys, cur=cur)
# move metadata in place
try:
@@ -182,7 +182,7 @@
db.mktemp('skipped_content', cur)
db.copy_to(missing_filtered, 'tmp_skipped_content',
- db.skipped_content_keys, cur)
+ db.skipped_content_keys, cur=cur)
# move metadata in place
db.skipped_content_add_from_temp(cur)
@@ -217,7 +217,7 @@
db.mktemp('content', cur)
select_keys = list(set(db.content_get_metadata_keys).union(set(keys)))
- db.copy_to(content, 'tmp_content', select_keys, cur)
+ db.copy_to(content, 'tmp_content', select_keys, cur=cur)
db.content_update_from_temp(keys_to_update=keys,
cur=cur)
@@ -378,7 +378,7 @@
db.mktemp('skipped_content', cur)
db.copy_to(content, 'tmp_skipped_content',
- keys + ['length', 'reason'], cur)
+ keys + ['length', 'reason'], cur=cur)
yield from db.skipped_content_missing_from_temp(cur)
@@ -456,7 +456,7 @@
# Copy directory ids
dirs_missing_dict = ({'id': dir} for dir in dirs_missing)
db.mktemp('directory', cur)
- db.copy_to(dirs_missing_dict, 'tmp_directory', ['id'], cur)
+ db.copy_to(dirs_missing_dict, 'tmp_directory', ['id'], cur=cur)
# Copy entries
for entry_type, entry_list in dir_entries.items():
@@ -472,7 +472,7 @@
entries,
'tmp_directory_entry_%s' % entry_type,
['target', 'name', 'perms', 'dir_id'],
- cur,
+ cur=cur,
)
# Do the final copy
@@ -582,13 +582,13 @@
db.copy_to(
revisions_filtered, 'tmp_revision', db.revision_add_cols,
- cur,
- lambda rev: parents_filtered.extend(rev['parents']))
+ cur=cur,
+ item_cb=lambda rev: parents_filtered.extend(rev['parents']))
db.revision_add_from_temp(cur)
-
+ print('PARENT FILTERED', parents_filtered)
db.copy_to(parents_filtered, 'revision_history',
- ['id', 'parent_id', 'parent_rank'], cur)
+ ['id', 'parent_id', 'parent_rank'], cur=cur)
@db_transaction_generator()
def revision_missing(self, revisions, db=None, cur=None):
@@ -701,7 +701,7 @@
)
db.copy_to(releases_filtered, 'tmp_release', db.release_add_cols,
- cur)
+ cur=cur)
db.release_add_from_temp(cur)
@@ -780,7 +780,7 @@
),
'tmp_snapshot_branch',
['name', 'target', 'target_type'],
- cur,
+ cur=cur,
)
if not db.origin_visit_exists(origin, visit):
raise ValueError('Not origin visit with ids (%s, %s)' %
@@ -1353,7 +1353,7 @@
db.mktemp_tool(cur)
db.copy_to(tools, 'tmp_tool',
['name', 'version', 'configuration'],
- cur)
+ cur=cur)
tools = db.tool_add_from_temp(cur)
for line in tools:
diff --git a/swh/storage/tests/test_db.py b/swh/storage/tests/test_db.py
--- a/swh/storage/tests/test_db.py
+++ b/swh/storage/tests/test_db.py
@@ -43,7 +43,7 @@
'length': 3}],
'tmp_content',
['sha1', 'sha1_git', 'sha256', 'blake2s256', 'length'],
- cur)
+ cur=cur)
self.db.content_add_from_temp(cur)
self.cursor.execute('SELECT sha1 FROM content WHERE sha1 = %s',
(sha1,))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 3:37 PM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219085
Attached To
D1056: Use named 'cur' argument when cally Db.copy_to()
Event Timeline
Log In to Comment