diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2021-11-24 17:02:59 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2021-11-24 17:03:01 -0800 |
commit | 95b0112fbdb1c0af720e05e62b5cc2eaf71e45b7 (patch) | |
tree | 9cc7323be7e9cdcba34accab1f90f747fddf604d | |
parent | 5bc5eeed5e3ba54c2129c4233b881291c5fa7449 (diff) | |
download | fatcat-95b0112fbdb1c0af720e05e62b5cc2eaf71e45b7.tar.gz fatcat-95b0112fbdb1c0af720e05e62b5cc2eaf71e45b7.zip |
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"
-rw-r--r-- | python/fatcat_tools/mergers/files.py | 6 |
1 files changed, 5 insertions, 1 deletions
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: |