Skip to content

Commit 9ee797d

Browse files
committed
Handle rm repo in external paths, fix test failure
1 parent 2a6c321 commit 9ee797d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

mlc/repo_action.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,21 @@ def find(self, run_args):
229229
lst.append(i)
230230
elif repo_name == i.meta['alias']:
231231
lst.append(i)
232-
elif utils.is_uid(repo) and not any(i.meta['uid'] == repo_uid for i in self.repos):
232+
233+
234+
# After loop, check if any match was found
235+
if not lst and not matched_repo_path:
236+
# Determine error message based on input
237+
if utils.is_uid(repo):
233238
return {"return": 1, "error": f"No repository with UID: '{repo_uid}' was found"}
234-
elif "," in repo and not matched_repo_path and not any(i.meta['uid'] == repo_uid for i in self.repos) and not any(i.meta['alias'] == repo_name for i in self.repos):
239+
elif "," in repo and not matched_repo_path:
235240
return {"return": 1, "error": f"No repository with alias: '{repo_name}' and UID: '{repo_uid}' was found"}
236-
elif not matched_repo_path and not any(i.meta['alias'] == repo_name for i in self.repos) and not any(i.meta['uid'] == repo_uid for i in self.repos ):
241+
else:
237242
return {"return": 1, "error": f"No repository with alias: '{repo_name}' was found"}
243+
238244

239245
# Append the matched repo path
240-
if(len(lst)==0):
246+
if(len(lst)==0 and matched_repo_path):
241247
lst.append(matched_repo_path)
242248

243249
return {'return': 0, 'list': lst}

0 commit comments

Comments
 (0)