+ # merge tags if we have two with the same name
+ if new_name in seen_paths:
+ # identify what we're merging into
+ merge_keep_id = seen_paths[new_name]
+ merge_delete_id = tag_id
+
+ # reassociate all the highlight associated with tag 2 so they are associated with tag 1 intsead
+ sql_stmt_update = "UPDATE highlight_tags SET tag_id = ? WHERE tag_id = ?"
+ cur.execute(sql_stmt_update, (merge_keep_id, merge_delete_id))
+
+ # reassociate all the highlight associated with tag 2 so they are associated with tag 1 intsead
+ sql_stmt_update = "DELETE FROM tags WHERE project_id = ? AND id = ?"
+ cur.execute(sql_stmt_update, (project_id, merge_delete_id))
+
+ print(f"MERGE DUPLICATE TAGS for {project_id}: {new_name}")
+ continue
+
+ else:
+ seen_paths[new_name] = tag_id
+
+ if not oldname == new_name: