scmrepo 3.3.2__py3-none-any.whl → 3.3.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of scmrepo might be problematic. Click here for more details.

@@ -264,7 +264,7 @@ class DulwichBackend(BaseGitBackend): # pylint:disable=abstract-method
264
264
  cls._set_mirror(repo, progress=progress)
265
265
  else:
266
266
  cls._set_default_tracking_branch(repo)
267
- except Exception as exc: # noqa: BLE001
267
+ except Exception as exc:
268
268
  raise CloneError(url, os.fsdecode(to_path)) from exc
269
269
 
270
270
  @staticmethod
@@ -580,7 +580,7 @@ class DulwichBackend(BaseGitBackend): # pylint:disable=abstract-method
580
580
  try:
581
581
  _remote, location = get_remote_repo(self.repo, url)
582
582
  client, path = get_transport_and_path(location, **kwargs)
583
- except Exception as exc: # noqa: BLE001
583
+ except Exception as exc:
584
584
  raise InvalidRemote(url) from exc
585
585
 
586
586
  try:
@@ -617,7 +617,7 @@ class DulwichBackend(BaseGitBackend): # pylint:disable=abstract-method
617
617
  try:
618
618
  _remote, location = get_remote_repo(self.repo, url)
619
619
  client, path = get_transport_and_path(location, **kwargs)
620
- except Exception as exc: # noqa: BLE001
620
+ except Exception as exc:
621
621
  raise SCMError(f"'{url}' is not a valid Git remote or URL") from exc
622
622
 
623
623
  change_result = {}
@@ -910,7 +910,7 @@ class DulwichBackend(BaseGitBackend): # pylint:disable=abstract-method
910
910
  try:
911
911
  _, location = get_remote_repo(self.repo, url)
912
912
  client, path = get_transport_and_path(location, **kwargs)
913
- except Exception as exc: # noqa: BLE001
913
+ except Exception as exc:
914
914
  raise InvalidRemote(url) from exc
915
915
  if isinstance(client, LocalGitClient) and not os.path.exists(
916
916
  os.path.join("", path)
@@ -989,5 +989,5 @@ def ls_remote(url: str) -> dict[str, str]:
989
989
  return {os.fsdecode(ref): sha.decode("ascii") for ref, sha in refs.items()}
990
990
  except HTTPUnauthorized as exc:
991
991
  raise AuthError(url) from exc
992
- except Exception as exc: # noqa: BLE001
992
+ except Exception as exc:
993
993
  raise InvalidRemote(url) from exc
scmrepo/git/lfs/fetch.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import fnmatch
2
2
  import io
3
3
  import os
4
+ import re
4
5
  from collections.abc import Iterable, Iterator
5
6
  from typing import TYPE_CHECKING, Callable, Optional
6
7
 
@@ -98,6 +99,9 @@ def get_fetch_url(scm: "Git", remote: Optional[str] = None): # noqa: C901,PLR09
98
99
  return scm.get_remote_url(remote)
99
100
 
100
101
 
102
+ _ROOT_PATH_PREFIX_REGEX = re.compile(r"^(?P<prefix>[^*?\[]*(?:/|$))")
103
+
104
+
101
105
  def _collect_objects(
102
106
  scm: "Git",
103
107
  rev: str,
@@ -105,7 +109,25 @@ def _collect_objects(
105
109
  exclude: Optional[list[str]],
106
110
  ) -> Iterator[Pointer]:
107
111
  fs = scm.get_fs(rev)
108
- for path in _filter_paths(fs.find("/"), include, exclude):
112
+ # Optimize path filtering if the `include` list contains exactly one path.
113
+ # First, determine the root directory wherein to initiate the file search.
114
+ # If the `include` path is a Unix filename pattern, determine the static
115
+ # path prefix and set it as the root directory. Second, if the path and the
116
+ # root are identical or the Unix filename pattern matches *any* (i.e., `**`)
117
+ # file under the root directory, unset `include` to avoid unnecessary
118
+ # filtering work.
119
+ if (
120
+ include
121
+ and len(include) == 1
122
+ and (result := _ROOT_PATH_PREFIX_REGEX.match(path := include[0]))
123
+ ):
124
+ root = result.group("prefix")
125
+ if path in {root, f'{root.rstrip("/")}/**'}:
126
+ include = []
127
+ else:
128
+ root = "/"
129
+
130
+ for path in _filter_paths(fs.find(root), include, exclude):
109
131
  check_path = path.lstrip("/")
110
132
  if scm.check_attr(check_path, "filter", source=rev) == "lfs":
111
133
  try:
@@ -53,7 +53,7 @@ class LFSStorage:
53
53
  raise
54
54
  try:
55
55
  self.fetch(fetch_url, [obj], batch_size=batch_size)
56
- except BaseException as exc: # noqa: BLE001
56
+ except BaseException as exc:
57
57
  raise FileNotFoundError(
58
58
  errno.ENOENT, os.strerror(errno.ENOENT), path
59
59
  ) from exc
scmrepo/git/stash.py CHANGED
@@ -53,7 +53,7 @@ class Stash:
53
53
  rev = self.scm.resolve_rev(ref)
54
54
  try:
55
55
  self.apply(rev, **kwargs)
56
- except Exception as exc: # noqa: BLE001
56
+ except Exception as exc:
57
57
  raise SCMError("Could not apply stash commit") from exc
58
58
  self.drop()
59
59
  return rev
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scmrepo
3
- Version: 3.3.2
3
+ Version: 3.3.3
4
4
  Summary: scmrepo
5
5
  Author-email: Iterative <support@dvc.org>
6
6
  License: Apache-2.0
@@ -26,7 +26,7 @@ Requires-Dist: funcy >=1.14
26
26
  Requires-Dist: aiohttp-retry >=2.5.0
27
27
  Requires-Dist: tqdm
28
28
  Provides-Extra: dev
29
- Requires-Dist: mypy ==1.9.0 ; extra == 'dev'
29
+ Requires-Dist: mypy ==1.10.0 ; extra == 'dev'
30
30
  Requires-Dist: scmrepo[tests] ; extra == 'dev'
31
31
  Requires-Dist: types-certifi ; extra == 'dev'
32
32
  Requires-Dist: types-mock ; extra == 'dev'
@@ -12,11 +12,11 @@ scmrepo/git/__init__.py,sha256=6giWgQpgAlJslOkFmSAYkw8pb7nuefrbpZZf5Np3Iyo,17189
12
12
  scmrepo/git/config.py,sha256=0t0OBmJ9SIa5tf22QdcGzhZfdMzzppvEmceUDg8ZPyE,943
13
13
  scmrepo/git/credentials.py,sha256=LvCCK4BQRtIduz4rnTnfSP6zEbngQtzCNvNYUmiQtkw,20944
14
14
  scmrepo/git/objects.py,sha256=vqeFpUlMFHL9Yv1h3wTA7mbRWHCVC_4KgLy5aAISD2g,4674
15
- scmrepo/git/stash.py,sha256=rnZDeOsO9P-k2e7ulCLUmZKSxSCxaRKl3XJlh97F084,2801
15
+ scmrepo/git/stash.py,sha256=wKWnYj_xpdT_3pvHiXtE7_I_By4S-Zbxf4Lv-ZY2sxI,2785
16
16
  scmrepo/git/backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  scmrepo/git/backend/base.py,sha256=nVMkUIeSVu-ZLCd2QPxMfTgrjnTOejM1UET9R7qKJRc,13560
18
18
  scmrepo/git/backend/gitpython.py,sha256=RTDNUVLiJmhcRgdaJpApTQi6sMN-an9P9xKZBKwk7co,25350
19
- scmrepo/git/backend/dulwich/__init__.py,sha256=x6DsVddlEeUW39-0WPjRFjRlqc3U2f0opZ1Hm2pvBts,34820
19
+ scmrepo/git/backend/dulwich/__init__.py,sha256=WT6B8LKzQN4pgNrA82CFqwKkR1wWVBRHwwA9LwuSHV4,34740
20
20
  scmrepo/git/backend/dulwich/asyncssh_vendor.py,sha256=y0mvx3tRR99Nv85e2n39nPYlhme8dplmQQSbSpx7FDM,11562
21
21
  scmrepo/git/backend/dulwich/client.py,sha256=bcDroljSvNz6s5WWv9UVvZHKkOJOVTK_zU7YCq62TN4,2360
22
22
  scmrepo/git/backend/pygit2/__init__.py,sha256=gNOFVLgB8gpXSKfuL_-Vk7GhVkZk6DiwuJMahel0Ue0,37035
@@ -25,14 +25,14 @@ scmrepo/git/backend/pygit2/filter.py,sha256=2NlWfQ7soXN1H7Es6-LctE74hpj3QKQTlYqX
25
25
  scmrepo/git/lfs/__init__.py,sha256=at5blRIKnKpg_g5dLRDsGWBFi6SbucRlF_DX6aAkGtE,257
26
26
  scmrepo/git/lfs/client.py,sha256=SLlGFC09YD55nTDQ7MjuKD9alql-eOriyNePZikFaYo,10171
27
27
  scmrepo/git/lfs/exceptions.py,sha256=cLlImmPXWJJUl44S4xcRBa2T9wYRkWTaKQGwJylwOhA,77
28
- scmrepo/git/lfs/fetch.py,sha256=ADNpskbDrvMI7ru4AiOf_c1gfw8TQ7Wct0EiN2Pq-qc,4683
28
+ scmrepo/git/lfs/fetch.py,sha256=5zuIt3L1LmF_Abc8nuMNHjwhXKMG6xth9EqWdSorPDE,5540
29
29
  scmrepo/git/lfs/object.py,sha256=rAYY_z9EYoHPfbpF1QHwL7ecYgaETPyCl-zBx0E1oIQ,337
30
30
  scmrepo/git/lfs/pointer.py,sha256=BcVbtjoOUG9cEzyJSJDeweqehGZvq43P6NNLDYUGYEI,3181
31
31
  scmrepo/git/lfs/progress.py,sha256=ELlBs2SeXhAcnPDN23w3FTeBRgB9RGqBD2CFMS6n9Xs,4750
32
32
  scmrepo/git/lfs/smudge.py,sha256=1O_fznptWo4CKXqcJgUoWP6cgWWhvGAZ3d87kasG3cQ,1610
33
- scmrepo/git/lfs/storage.py,sha256=2weDldy6MFrA8IDzBczsPy8fBWCp4FKaJTT0f6eIT64,2396
34
- scmrepo-3.3.2.dist-info/LICENSE,sha256=-1jhbPjoIVHR0cEgahL4Zhct75Ff4MzYCR_jOaJDPq8,11340
35
- scmrepo-3.3.2.dist-info/METADATA,sha256=RoEcoxC9ReqV3Eh0lgIQRHVnBLrZeRs5z4px6SpDZb0,4730
36
- scmrepo-3.3.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
37
- scmrepo-3.3.2.dist-info/top_level.txt,sha256=iunjod6w3GogERsAYfLRupnANXnqzX3jbIfbeIQG5cc,8
38
- scmrepo-3.3.2.dist-info/RECORD,,
33
+ scmrepo/git/lfs/storage.py,sha256=LbHGhSRdORu4Iqzb7Ef-2tA_iJbZykXZFotWRJvyr2Y,2380
34
+ scmrepo-3.3.3.dist-info/LICENSE,sha256=-1jhbPjoIVHR0cEgahL4Zhct75Ff4MzYCR_jOaJDPq8,11340
35
+ scmrepo-3.3.3.dist-info/METADATA,sha256=gYNksxYhXTLo19GA70aiIJTrLHUtRfxWtq3xndzEf48,4731
36
+ scmrepo-3.3.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
37
+ scmrepo-3.3.3.dist-info/top_level.txt,sha256=iunjod6w3GogERsAYfLRupnANXnqzX3jbIfbeIQG5cc,8
38
+ scmrepo-3.3.3.dist-info/RECORD,,