Commit e46d55d1 authored by Benjamin Winger's avatar Benjamin Winger

migrate: Hide fuzzy matching behind a flag

Fuzzy matching on directory names has a tendency to aggressively match mods that are not in the repository against mods in the repository that vaguely match.
Hiding for now, as we should further test the different types of fuzzy matching algs provided by fuzzywuzzy.
Fuzzy matching is now always interactive with the interactive flat, even
if there is only one match.
parent eea9987b
Pipeline #60794874 passed with stage
in 1 minute and 4 seconds
......@@ -61,6 +61,11 @@ def migrate():
parser.add_argument(
"--interactive", help="Resolve ambiguity interactively", action="store_true"
)
parser.add_argument(
"--fuzzy",
help="Does fuzzy matching when scanning mods (experimental)",
action="store_true",
)
args = parser.parse_args()
......@@ -125,19 +130,21 @@ def migrate():
mods.append(result)
else:
ambiguousmods.append((path, modq.get().item))
else:
elif args.fuzzy:
fuzzymodq = find_fuzzy_mod(fullpath)
if fuzzymodq.qsize() == 1:
fuzzymods.append((path, fuzzymodq.get().item))
elif fuzzymodq.qsize() > 1:
if fuzzymodq.qsize() > 1:
if args.interactive:
result = prompt_mods(path, fuzzymodq)
if result is not None:
mods.append(result)
fuzzymods.append(result)
elif fuzzymodq.qsize() == 1:
fuzzymods.append((path, fuzzymodq.get().item))
else:
ambiguousfuzzymods.append((path, fuzzymodq.get().item))
else:
warn("Could not find mod in repo for {}".format(path))
else:
warn("Could not find mod in repo for {}".format(path))
else: # Is a pybuild that perfectly matched the directory
mods.append((path, modq))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment