scmrepo 2.1.0__tar.gz → 2.1.1__tar.gz
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.
- {scmrepo-2.1.0/src/scmrepo.egg-info → scmrepo-2.1.1}/PKG-INFO +1 -1
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/backend/pygit2/__init__.py +5 -5
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/backend/pygit2/callbacks.py +8 -3
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/lfs/client.py +26 -35
- {scmrepo-2.1.0 → scmrepo-2.1.1/src/scmrepo.egg-info}/PKG-INFO +1 -1
- {scmrepo-2.1.0 → scmrepo-2.1.1}/.coveragerc +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/.cruft.json +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/.gitattributes +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/.github/dependabot.yml +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/.github/workflows/release.yaml +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/.github/workflows/tests.yaml +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/.github/workflows/update-template.yaml +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/.gitignore +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/.pre-commit-config.yaml +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/CODE_OF_CONDUCT.rst +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/CONTRIBUTING.rst +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/LICENSE +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/README.rst +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/noxfile.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/pyproject.toml +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/setup.cfg +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/__init__.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/asyn.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/base.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/exceptions.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/fs.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/__init__.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/backend/__init__.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/backend/base.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/backend/dulwich/__init__.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/backend/dulwich/asyncssh_vendor.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/backend/dulwich/client.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/backend/gitpython.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/backend/pygit2/filter.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/config.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/credentials.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/lfs/__init__.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/lfs/exceptions.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/lfs/fetch.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/lfs/object.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/lfs/pointer.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/lfs/progress.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/lfs/smudge.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/lfs/storage.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/objects.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/git/stash.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/noscm.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/progress.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/py.typed +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo/utils.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo.egg-info/SOURCES.txt +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo.egg-info/dependency_links.txt +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo.egg-info/requires.txt +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/src/scmrepo.egg-info/top_level.txt +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/__init__.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/conftest.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/docker-compose.yml +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/git-init/git.sh +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/test_credentials.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/test_dulwich.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/test_fs.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/test_git.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/test_lfs.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/test_noscm.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/test_pygit2.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/test_scmrepo.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/test_stash.py +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/user.key +0 -0
- {scmrepo-2.1.0 → scmrepo-2.1.1}/tests/user.key.pub +0 -0
|
@@ -646,13 +646,13 @@ class Pygit2Backend(BaseGitBackend): # pylint:disable=abstract-method
|
|
|
646
646
|
except KeyError as exc:
|
|
647
647
|
raise SCMError(f"'{url}' is not a valid Git remote or URL") from exc
|
|
648
648
|
|
|
649
|
-
parsed = urlparse(url)
|
|
650
|
-
if parsed.scheme in ("git", "git+ssh", "ssh") or url.startswith("git@"):
|
|
651
|
-
raise NotImplementedError
|
|
652
649
|
if os.name == "nt" and url.startswith("file://"):
|
|
653
650
|
url = url[len("file://") :]
|
|
654
|
-
|
|
655
|
-
|
|
651
|
+
remote = self.repo.remotes.create_anonymous(url)
|
|
652
|
+
parsed = urlparse(remote.url)
|
|
653
|
+
if parsed.scheme in ("git", "git+ssh", "ssh") or remote.url.startswith("git@"):
|
|
654
|
+
raise NotImplementedError
|
|
655
|
+
yield remote
|
|
656
656
|
|
|
657
657
|
def fetch_refspecs(
|
|
658
658
|
self,
|
|
@@ -11,6 +11,7 @@ from scmrepo.progress import GitProgressReporter
|
|
|
11
11
|
if TYPE_CHECKING:
|
|
12
12
|
from pygit2 import Oid
|
|
13
13
|
from pygit2.credentials import Keypair, Username, UserPass
|
|
14
|
+
from pygit2.enums import CredentialType
|
|
14
15
|
|
|
15
16
|
from scmrepo.progress import GitProgressEvent
|
|
16
17
|
|
|
@@ -45,16 +46,20 @@ class RemoteCallbacks(_RemoteCallbacks, AbstractContextManager):
|
|
|
45
46
|
self.progress(string)
|
|
46
47
|
|
|
47
48
|
def credentials(
|
|
48
|
-
self,
|
|
49
|
+
self,
|
|
50
|
+
url: str,
|
|
51
|
+
username_from_url: Optional[str],
|
|
52
|
+
allowed_types: "CredentialType",
|
|
49
53
|
) -> "_Pygit2Credential":
|
|
50
54
|
from pygit2 import GitError, Passthrough
|
|
51
|
-
from pygit2.credentials import
|
|
55
|
+
from pygit2.credentials import UserPass
|
|
56
|
+
from pygit2.enums import CredentialType
|
|
52
57
|
|
|
53
58
|
if self._tried_credentials:
|
|
54
59
|
raise GitError(f"authentication failed for '{url}'")
|
|
55
60
|
self._tried_credentials = True
|
|
56
61
|
|
|
57
|
-
if allowed_types &
|
|
62
|
+
if allowed_types & CredentialType.USERPASS_PLAINTEXT:
|
|
58
63
|
try:
|
|
59
64
|
if self._store_credentials:
|
|
60
65
|
creds = self._store_credentials
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from collections.abc import
|
|
2
|
+
from collections.abc import Iterable
|
|
3
3
|
from contextlib import AbstractContextManager
|
|
4
|
-
from
|
|
5
|
-
from typing import TYPE_CHECKING, Any, Callable, Optional
|
|
4
|
+
from typing import TYPE_CHECKING, Any, Optional
|
|
6
5
|
|
|
7
6
|
import aiohttp
|
|
8
7
|
from dvc_http import HTTPFileSystem
|
|
@@ -32,29 +31,6 @@ class _LFSFileSystem(HTTPFileSystem):
|
|
|
32
31
|
return {}
|
|
33
32
|
|
|
34
33
|
|
|
35
|
-
def _authed(f: Callable[..., Awaitable]):
|
|
36
|
-
"""Set credentials and retry the given coroutine if needed."""
|
|
37
|
-
|
|
38
|
-
# pylint: disable=protected-access
|
|
39
|
-
@wraps(f) # type: ignore[arg-type]
|
|
40
|
-
async def wrapper(self, *args, **kwargs):
|
|
41
|
-
try:
|
|
42
|
-
return await f(self, *args, **kwargs)
|
|
43
|
-
except aiohttp.ClientResponseError as exc:
|
|
44
|
-
if exc.status != 401:
|
|
45
|
-
raise
|
|
46
|
-
session = await self._set_session()
|
|
47
|
-
if session.auth:
|
|
48
|
-
raise
|
|
49
|
-
auth = self._get_auth()
|
|
50
|
-
if auth is None:
|
|
51
|
-
raise
|
|
52
|
-
self._session._auth = auth
|
|
53
|
-
return await f(self, *args, **kwargs)
|
|
54
|
-
|
|
55
|
-
return wrapper
|
|
56
|
-
|
|
57
|
-
|
|
58
34
|
class LFSClient(AbstractContextManager):
|
|
59
35
|
"""Naive read-only LFS HTTP client."""
|
|
60
36
|
|
|
@@ -112,7 +88,6 @@ class LFSClient(AbstractContextManager):
|
|
|
112
88
|
async def _set_session(self) -> aiohttp.ClientSession:
|
|
113
89
|
return await self.fs.fs.set_session()
|
|
114
90
|
|
|
115
|
-
@_authed
|
|
116
91
|
async def _batch_request(
|
|
117
92
|
self,
|
|
118
93
|
objects: Iterable[Pointer],
|
|
@@ -134,14 +109,30 @@ class LFSClient(AbstractContextManager):
|
|
|
134
109
|
headers = dict(self.headers)
|
|
135
110
|
headers["Accept"] = self.JSON_CONTENT_TYPE
|
|
136
111
|
headers["Content-Type"] = self.JSON_CONTENT_TYPE
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
112
|
+
try:
|
|
113
|
+
async with session.post(
|
|
114
|
+
url,
|
|
115
|
+
headers=headers,
|
|
116
|
+
json=body,
|
|
117
|
+
raise_for_status=True,
|
|
118
|
+
) as resp:
|
|
119
|
+
data = await resp.json()
|
|
120
|
+
except aiohttp.ClientResponseError as exc:
|
|
121
|
+
if exc.status != 401:
|
|
122
|
+
raise
|
|
123
|
+
auth = self._get_auth()
|
|
124
|
+
if auth is None:
|
|
125
|
+
raise
|
|
126
|
+
async with session.post(
|
|
127
|
+
url,
|
|
128
|
+
auth=auth,
|
|
129
|
+
headers=headers,
|
|
130
|
+
json=body,
|
|
131
|
+
raise_for_status=True,
|
|
132
|
+
) as resp:
|
|
133
|
+
data = await resp.json()
|
|
134
|
+
return data
|
|
135
|
+
|
|
145
136
|
async def _download(
|
|
146
137
|
self,
|
|
147
138
|
storage: "LFSStorage",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|