Skip to content

Commit 3e3982d

Browse files
[IMP] upgrade_analysis: better matches
1 parent 8778575 commit 3e3982d

File tree

1 file changed

+39
-7
lines changed

1 file changed

+39
-7
lines changed

upgrade_analysis/compare.py

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,6 @@ def clean_records(records):
210210
new_models = {column["model"] for column in new_records}
211211
old_models = {column["model"] for column in old_records}
212212

213-
matched_direct = 0
214-
matched_other_module = 0
215-
matched_other_type = 0
216213
in_obsolete_models = 0
217214

218215
obsolete_models = []
@@ -244,7 +241,7 @@ def match(match_fields, report_fields, warn=False):
244241
return count
245242

246243
matched_direct = match(
247-
["module", "mode", "model", "field"],
244+
["module", "model", "field", "type"],
248245
[
249246
"relation",
250247
"type",
@@ -259,7 +256,7 @@ def match(match_fields, report_fields, warn=False):
259256
],
260257
)
261258

262-
# other module, same type and operation
259+
# other module, same type
263260
matched_other_module = match(
264261
["mode", "model", "field", "type"],
265262
[
@@ -275,11 +272,44 @@ def match(match_fields, report_fields, warn=False):
275272
"_order",
276273
],
277274
)
275+
matched_other_module += match(
276+
["model", "field", "type"],
277+
[
278+
"module",
279+
"relation",
280+
"selection_keys",
281+
"_inherits",
282+
"stored",
283+
"isfunction",
284+
"isrelated",
285+
"required",
286+
"table",
287+
"_order",
288+
],
289+
)
278290

279-
# other module, same operation, other type
291+
# same module, other type
280292
matched_other_type = match(
281-
["module", "mode", "model", "field"],
293+
["module", "model", "field"],
294+
[
295+
"relation",
296+
"type",
297+
"selection_keys",
298+
"_inherits",
299+
"stored",
300+
"isfunction",
301+
"isrelated",
302+
"required",
303+
"table",
304+
"_order",
305+
],
306+
)
307+
308+
# other module, other type
309+
matched_other_module_other_type = match(
310+
["mode", "model", "field"],
282311
[
312+
"module",
283313
"relation",
284314
"type",
285315
"selection_keys",
@@ -352,6 +382,8 @@ def match(match_fields, report_fields, warn=False):
352382
"# Direct match: %d" % matched_direct,
353383
"# Found in other module: %d" % matched_other_module,
354384
"# Found with different type: %d" % matched_other_type,
385+
"# Found in other module with different type: %d"
386+
% matched_other_module_other_type,
355387
"# In obsolete models: %d" % in_obsolete_models,
356388
"# Not matched: %d" % len(old_records),
357389
"# New columns: %d" % len(new_records),

0 commit comments

Comments
 (0)