From 95b0112fbdb1c0af720e05e62b5cc2eaf71e45b7 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 24 Nov 2021 17:02:59 -0800 Subject: file merger: allocate editgroup id later in 'merge' process The motivation is to avoid creating empty editgroups in dry-run mode, and when all entities are "skipped" --- python/fatcat_tools/mergers/files.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'python/fatcat_tools') diff --git a/python/fatcat_tools/mergers/files.py b/python/fatcat_tools/mergers/files.py index 3efe85fd..374c9983 100644 --- a/python/fatcat_tools/mergers/files.py +++ b/python/fatcat_tools/mergers/files.py @@ -116,7 +116,6 @@ class FileMerger(EntityMerger): updated_entities = 0 entities: Dict[str, FileEntity] = dict() - eg_id = self.get_editgroup_id() all_ids = dupe_ids.copy() if primary_id: @@ -143,6 +142,11 @@ class FileMerger(EntityMerger): assert primary_id not in dupe_ids + if self.dry_run_mode: + eg_id = "dummy-editgroup-id" + else: + eg_id = self.get_editgroup_id() + primary = entities[primary_id] primary_updated = False for other_id in dupe_ids: -- cgit v1.2.3