aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-11-24 17:02:59 -0800
committerBryan Newbold <bnewbold@robocracy.org>2021-11-24 17:03:01 -0800
commit95b0112fbdb1c0af720e05e62b5cc2eaf71e45b7 (patch)
tree9cc7323be7e9cdcba34accab1f90f747fddf604d /python/fatcat_tools
parent5bc5eeed5e3ba54c2129c4233b881291c5fa7449 (diff)
downloadfatcat-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"
Diffstat (limited to 'python/fatcat_tools')
-rw-r--r--python/fatcat_tools/mergers/files.py6
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: