-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Labels
Description
In our current describe function we only accept one rev at a time and will try to get a reference for every reference in the repo. It will cost O(MN) in exp show in which we try to get a ref for every single experiment.
scmrepo/src/scmrepo/git/backend/dulwich/__init__.py
Lines 725 to 740 in ed17985
| def _describe( | |
| self, | |
| rev: str, | |
| base: Optional[str] = None, | |
| match: Optional[str] = None, | |
| exclude: Optional[str] = None, | |
| ) -> Optional[str]: | |
| if not base: | |
| base = "refs/tags" | |
| for ref in self.iter_refs(base=base): | |
| if (match and not fnmatch.fnmatch(ref, match)) or ( | |
| exclude and fnmatch.fnmatch(ref, exclude) | |
| ): | |
| continue | |
| if self.get_ref(ref, follow=False) == rev: | |
| return ref |
