Skip to content

Commit f7e9f78

Browse files
committed
updates for dbx merge
1 parent 9a8c177 commit f7e9f78

2 files changed

Lines changed: 8 additions & 13 deletions

File tree

merge_vcr.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pprint import pprint
66
import argparse
77

8-
def mergeNewResultsIntoOrigDb(origVcrFile, newVcrFile, cursor_new, cursor_orig, table_name, del_old_table = False, verbose = False):
8+
def mergeNewResultsIntoOrigDb(origVcrFile, newVcrFile, outputVcrFile, cursor_new, cursor_orig, table_name, del_old_table = False, verbose = False):
99
'''
1010
This function merges the content of a specific table from an old cursor into a new cursor.
1111
@@ -52,7 +52,7 @@ def mergeNewResultsIntoOrigDb(origVcrFile, newVcrFile, cursor_new, cursor_orig,
5252
cursor_orig.executemany(s, new_data)
5353
if (cursor_orig.connection.commit() == None):
5454
# With Ephemeral RAM connections & testing, deleting the table may be ill-advised
55-
s = "[INFO] Table \"%s\" merged from %s to %s" % (table_name, origVcrFile, newVcrFile)
55+
s = "[INFO] Test results : merged from %s to %s" % (newVcrFile, outputVcrFile)
5656
print(s) # Consider logging.info()
5757

5858
return None
@@ -98,7 +98,7 @@ def run(origVcrFile, newVcrFile, outputVcrFile, verbose, keep):
9898
new_cursor = new_db.cursor()
9999
orig_cursor = orig_db.cursor()
100100

101-
mergeNewResultsIntoOrigDb(origVcrFile, newVcrFile, new_cursor, orig_cursor, "result", False, verbose)
101+
mergeNewResultsIntoOrigDb(origVcrFile, newVcrFile, outputVcrFile, new_cursor, orig_cursor, "result", False, verbose)
102102

103103
# Close cursors before closing database connections to release file handles
104104
new_cursor.close()
@@ -111,14 +111,11 @@ def run(origVcrFile, newVcrFile, outputVcrFile, verbose, keep):
111111
import update_cover_db_project_files
112112
update_cover_db_project_files.run(origCoverDbName, newCoverDbName, apply=True, verbose = verbose)
113113

114-
# if not keep:
115-
# os.remove(newVcrFile)
116-
# os.remove(origVcrFile)
114+
s = "[INFO] Cover database: merged from %s to %s" % (newVcrFile, outputVcrFile)
115+
print(s) # Consider logging.info()
117116

118117
shutil.make_archive(outputVcrFile, 'zip', "origVcr")
119118
shutil.copyfile(outputVcrFile+".zip", outputVcrFile)
120-
print(f"[INFO] Merged file: {outputVcrFile}")
121-
122119
os.remove(outputVcrFile+".zip")
123120
shutil.rmtree("newVcr")
124121
shutil.rmtree("origVcr")

update_cover_db_project_files.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -622,12 +622,10 @@ def run (database1, database2, apply, path_column = 'path', case_sensitive = Fal
622622
print("\nNo project_files rows require updating.")
623623
return 1 if (skipped or only_r1 or other_warnings) else 0
624624

625-
# if not no_backup:
626-
# backup = create_backup(db1, backup)
627-
# print(f"\nBackup created: {backup}")
628-
629625
updated = apply_updates(db1, plans)
630-
print(f"Updated {updated} project_files row(s) in {db1}")
626+
627+
if verbose:
628+
print(f"Updated {updated} project_files row(s) in {db1}")
631629

632630
return 1 if (skipped or only_r1 or other_warnings) else 0
633631

0 commit comments

Comments
 (0)