scmrepo 3.3.7__tar.gz → 3.3.8__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.

Files changed (73) hide show
  1. {scmrepo-3.3.7 → scmrepo-3.3.8}/.gitignore +1 -0
  2. {scmrepo-3.3.7 → scmrepo-3.3.8}/.pre-commit-config.yaml +1 -1
  3. {scmrepo-3.3.7/src/scmrepo.egg-info → scmrepo-3.3.8}/PKG-INFO +3 -2
  4. {scmrepo-3.3.7 → scmrepo-3.3.8}/pyproject.toml +3 -1
  5. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/backend/dulwich/__init__.py +9 -4
  6. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/backend/pygit2/__init__.py +2 -4
  7. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/lfs/progress.py +1 -1
  8. {scmrepo-3.3.7 → scmrepo-3.3.8/src/scmrepo.egg-info}/PKG-INFO +3 -2
  9. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo.egg-info/requires.txt +2 -1
  10. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/test_git.py +94 -2
  11. {scmrepo-3.3.7 → scmrepo-3.3.8}/.coveragerc +0 -0
  12. {scmrepo-3.3.7 → scmrepo-3.3.8}/.cruft.json +0 -0
  13. {scmrepo-3.3.7 → scmrepo-3.3.8}/.gitattributes +0 -0
  14. {scmrepo-3.3.7 → scmrepo-3.3.8}/.github/dependabot.yml +0 -0
  15. {scmrepo-3.3.7 → scmrepo-3.3.8}/.github/workflows/release.yaml +0 -0
  16. {scmrepo-3.3.7 → scmrepo-3.3.8}/.github/workflows/tests.yaml +0 -0
  17. {scmrepo-3.3.7 → scmrepo-3.3.8}/.github/workflows/update-template.yaml +0 -0
  18. {scmrepo-3.3.7 → scmrepo-3.3.8}/CODE_OF_CONDUCT.rst +0 -0
  19. {scmrepo-3.3.7 → scmrepo-3.3.8}/CONTRIBUTING.rst +0 -0
  20. {scmrepo-3.3.7 → scmrepo-3.3.8}/LICENSE +0 -0
  21. {scmrepo-3.3.7 → scmrepo-3.3.8}/README.rst +0 -0
  22. {scmrepo-3.3.7 → scmrepo-3.3.8}/noxfile.py +0 -0
  23. {scmrepo-3.3.7 → scmrepo-3.3.8}/setup.cfg +0 -0
  24. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/__init__.py +0 -0
  25. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/asyn.py +0 -0
  26. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/base.py +0 -0
  27. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/exceptions.py +0 -0
  28. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/fs.py +0 -0
  29. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/__init__.py +0 -0
  30. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/backend/__init__.py +0 -0
  31. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/backend/base.py +0 -0
  32. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/backend/dulwich/asyncssh_vendor.py +0 -0
  33. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/backend/dulwich/client.py +0 -0
  34. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/backend/gitpython.py +0 -0
  35. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/backend/pygit2/callbacks.py +0 -0
  36. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/backend/pygit2/filter.py +0 -0
  37. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/config.py +0 -0
  38. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/credentials.py +0 -0
  39. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/lfs/__init__.py +0 -0
  40. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/lfs/client.py +0 -0
  41. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/lfs/exceptions.py +0 -0
  42. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/lfs/fetch.py +0 -0
  43. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/lfs/object.py +0 -0
  44. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/lfs/pointer.py +0 -0
  45. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/lfs/smudge.py +0 -0
  46. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/lfs/storage.py +0 -0
  47. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/objects.py +0 -0
  48. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/git/stash.py +0 -0
  49. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/noscm.py +0 -0
  50. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/progress.py +0 -0
  51. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/py.typed +0 -0
  52. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/urls.py +0 -0
  53. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo/utils.py +0 -0
  54. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo.egg-info/SOURCES.txt +0 -0
  55. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo.egg-info/dependency_links.txt +0 -0
  56. {scmrepo-3.3.7 → scmrepo-3.3.8}/src/scmrepo.egg-info/top_level.txt +0 -0
  57. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/__init__.py +0 -0
  58. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/conftest.py +0 -0
  59. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/docker-compose.yml +0 -0
  60. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/git-init/git.sh +0 -0
  61. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/test_credentials.py +0 -0
  62. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/test_dulwich.py +0 -0
  63. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/test_fs.py +0 -0
  64. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/test_lfs.py +0 -0
  65. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/test_noscm.py +0 -0
  66. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/test_pygit2.py +0 -0
  67. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/test_scmrepo.py +0 -0
  68. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/test_stash.py +0 -0
  69. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/test_urls.py +0 -0
  70. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/user.key +0 -0
  71. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/user.key.pub +0 -0
  72. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/vendor/__init__.py +0 -0
  73. {scmrepo-3.3.7 → scmrepo-3.3.8}/tests/vendor/test_paramiko_vendor.py +0 -0
@@ -138,3 +138,4 @@ dmypy.json
138
138
  cython_debug/
139
139
 
140
140
  .DS_Store
141
+ .vscode/
@@ -20,7 +20,7 @@ repos:
20
20
  - id: sort-simple-yaml
21
21
  - id: trailing-whitespace
22
22
  - repo: https://github.com/astral-sh/ruff-pre-commit
23
- rev: 'v0.5.2'
23
+ rev: 'v0.6.7'
24
24
  hooks:
25
25
  - id: ruff
26
26
  args: [--fix, --exit-non-zero-on-fix]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scmrepo
3
- Version: 3.3.7
3
+ Version: 3.3.8
4
4
  Summary: scmrepo
5
5
  Author-email: Iterative <support@dvc.org>
6
6
  License: Apache-2.0
@@ -35,8 +35,9 @@ Requires-Dist: pytest-docker<4,>=1; extra == "tests"
35
35
  Requires-Dist: pytest-mock; extra == "tests"
36
36
  Requires-Dist: pytest-sugar; extra == "tests"
37
37
  Requires-Dist: pytest-test-utils<0.2,>=0.1.0; extra == "tests"
38
+ Requires-Dist: proxy.py; extra == "tests"
38
39
  Provides-Extra: dev
39
- Requires-Dist: mypy==1.10.1; extra == "dev"
40
+ Requires-Dist: mypy==1.11.2; extra == "dev"
40
41
  Requires-Dist: scmrepo[tests]; extra == "dev"
41
42
  Requires-Dist: types-certifi; extra == "dev"
42
43
  Requires-Dist: types-mock; extra == "dev"
@@ -48,9 +48,10 @@ tests = [
48
48
  "pytest-mock",
49
49
  "pytest-sugar",
50
50
  "pytest-test-utils>=0.1.0,<0.2",
51
+ "proxy.py",
51
52
  ]
52
53
  dev = [
53
- "mypy==1.10.1",
54
+ "mypy==1.11.2",
54
55
  "scmrepo[tests]",
55
56
  "types-certifi",
56
57
  "types-mock",
@@ -73,6 +74,7 @@ markers = [
73
74
  ]
74
75
  asyncio_mode = "auto"
75
76
 
77
+
76
78
  [tool.coverage.run]
77
79
  branch = true
78
80
  source = ["scmrepo", "tests"]
@@ -16,6 +16,7 @@ from typing import (
16
16
  Union,
17
17
  )
18
18
 
19
+ from dulwich.config import ConfigFile, StackedConfig
19
20
  from funcy import cached_property, reraise
20
21
 
21
22
  from scmrepo.exceptions import AuthError, CloneError, InvalidRemote, RevError, SCMError
@@ -27,7 +28,7 @@ from scmrepo.utils import relpath
27
28
 
28
29
  if TYPE_CHECKING:
29
30
  from dulwich.client import SSHVendor
30
- from dulwich.config import ConfigFile, StackedConfig
31
+ from dulwich.config import ConfigFile
31
32
  from dulwich.repo import Repo
32
33
 
33
34
  from scmrepo.git.objects import GitCommit
@@ -579,7 +580,8 @@ class DulwichBackend(BaseGitBackend): # pylint:disable=abstract-method
579
580
 
580
581
  try:
581
582
  _remote, location = get_remote_repo(self.repo, url)
582
- client, path = get_transport_and_path(location, **kwargs)
583
+ _config = kwargs.pop("config", StackedConfig.default())
584
+ client, path = get_transport_and_path(location, config=_config, **kwargs)
583
585
  except Exception as exc:
584
586
  raise InvalidRemote(url) from exc
585
587
 
@@ -616,7 +618,8 @@ class DulwichBackend(BaseGitBackend): # pylint:disable=abstract-method
616
618
 
617
619
  try:
618
620
  _remote, location = get_remote_repo(self.repo, url)
619
- client, path = get_transport_and_path(location, **kwargs)
621
+ _config = kwargs.pop("config", StackedConfig.default())
622
+ client, path = get_transport_and_path(location, config=_config, **kwargs)
620
623
  except Exception as exc:
621
624
  raise SCMError(f"'{url}' is not a valid Git remote or URL") from exc
622
625
 
@@ -723,7 +726,8 @@ class DulwichBackend(BaseGitBackend): # pylint:disable=abstract-method
723
726
 
724
727
  with reraise(Exception, SCMError(f"'{url}' is not a valid Git remote or URL")):
725
728
  _remote, location = get_remote_repo(self.repo, url)
726
- client, path = get_transport_and_path(location, **kwargs)
729
+ _config = kwargs.pop("config", StackedConfig.default())
730
+ client, path = get_transport_and_path(location, config=_config, **kwargs)
727
731
 
728
732
  with reraise(
729
733
  (NotGitRepository, KeyError),
@@ -909,6 +913,7 @@ class DulwichBackend(BaseGitBackend): # pylint:disable=abstract-method
909
913
 
910
914
  try:
911
915
  _, location = get_remote_repo(self.repo, url)
916
+ _config = kwargs.pop("config", StackedConfig.default())
912
917
  client, path = get_transport_and_path(location, **kwargs)
913
918
  except Exception as exc:
914
919
  raise InvalidRemote(url) from exc
@@ -701,15 +701,13 @@ class Pygit2Backend(BaseGitBackend): # pylint:disable=abstract-method
701
701
  remote_refs: dict[str, Oid] = (
702
702
  {
703
703
  head["name"]: head["oid"]
704
- for head in remote.ls_remotes(callbacks=cb)
704
+ for head in remote.ls_remotes(callbacks=cb, proxy=True)
705
705
  }
706
706
  if not force
707
707
  else {}
708
708
  )
709
709
  remote.fetch(
710
- refspecs=refspecs,
711
- callbacks=cb,
712
- message="fetch",
710
+ refspecs=refspecs, callbacks=cb, message="fetch", proxy=True
713
711
  )
714
712
 
715
713
  result: dict[str, SyncStatus] = {}
@@ -32,7 +32,7 @@ class _Tqdm(tqdm):
32
32
  "miniters": 1,
33
33
  }
34
34
 
35
- def __init__( # noqa: PLR0913
35
+ def __init__(
36
36
  self,
37
37
  iterable=None,
38
38
  disable=None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scmrepo
3
- Version: 3.3.7
3
+ Version: 3.3.8
4
4
  Summary: scmrepo
5
5
  Author-email: Iterative <support@dvc.org>
6
6
  License: Apache-2.0
@@ -35,8 +35,9 @@ Requires-Dist: pytest-docker<4,>=1; extra == "tests"
35
35
  Requires-Dist: pytest-mock; extra == "tests"
36
36
  Requires-Dist: pytest-sugar; extra == "tests"
37
37
  Requires-Dist: pytest-test-utils<0.2,>=0.1.0; extra == "tests"
38
+ Requires-Dist: proxy.py; extra == "tests"
38
39
  Provides-Extra: dev
39
- Requires-Dist: mypy==1.10.1; extra == "dev"
40
+ Requires-Dist: mypy==1.11.2; extra == "dev"
40
41
  Requires-Dist: scmrepo[tests]; extra == "dev"
41
42
  Requires-Dist: types-certifi; extra == "dev"
42
43
  Requires-Dist: types-mock; extra == "dev"
@@ -10,7 +10,7 @@ aiohttp-retry>=2.5.0
10
10
  tqdm
11
11
 
12
12
  [dev]
13
- mypy==1.10.1
13
+ mypy==1.11.2
14
14
  scmrepo[tests]
15
15
  types-certifi
16
16
  types-mock
@@ -27,3 +27,4 @@ pytest-docker<4,>=1
27
27
  pytest-mock
28
28
  pytest-sugar
29
29
  pytest-test-utils<0.2,>=0.1.0
30
+ proxy.py
@@ -1,5 +1,6 @@
1
1
  import os
2
2
  import shutil
3
+ from pathlib import Path
3
4
  from typing import Any, Optional
4
5
 
5
6
  import pytest
@@ -7,14 +8,20 @@ from asyncssh import SFTPClient
7
8
  from asyncssh.connection import SSHClientConnection
8
9
  from dulwich.client import LocalGitClient
9
10
  from git import Repo as GitPythonRepo
11
+ from proxy import TestCase as ProxyTestCase
10
12
  from pygit2 import GitError
11
13
  from pygit2.remotes import Remote
12
14
  from pytest_mock import MockerFixture
13
15
  from pytest_test_utils import TempDirFactory, TmpDir
14
16
  from pytest_test_utils.matchers import Matcher
15
17
 
16
- from scmrepo.exceptions import InvalidRemote, MergeConflictError, RevError, SCMError
17
- from scmrepo.git import Git
18
+ from scmrepo.exceptions import (
19
+ InvalidRemote,
20
+ MergeConflictError,
21
+ RevError,
22
+ SCMError,
23
+ )
24
+ from scmrepo.git import Git, GitBackends
18
25
  from scmrepo.git.objects import GitTag
19
26
 
20
27
  from .conftest import backends
@@ -22,6 +29,13 @@ from .conftest import backends
22
29
  # pylint: disable=redefined-outer-name,unused-argument,protected-access
23
30
 
24
31
 
32
+ BAD_PROXY_CONFIG = """[http]
33
+ proxy = "http://bad-proxy.dvc.org"
34
+ [https]
35
+ proxy = "http://bad-proxy.dvc.org"
36
+ """
37
+
38
+
25
39
  @pytest.fixture
26
40
  def submodule_dir(tmp_dir: TmpDir, scm: Git):
27
41
  scm.commit("init")
@@ -941,6 +955,84 @@ def test_clone(
941
955
  assert fobj.read().strip() == "foo"
942
956
 
943
957
 
958
+ @pytest.fixture
959
+ def proxy_server():
960
+ class _ProxyServer(ProxyTestCase):
961
+ pass
962
+
963
+ _ProxyServer.setUpClass()
964
+ yield f"http://{_ProxyServer.PROXY.flags.hostname}:{_ProxyServer.PROXY.flags.port}"
965
+ _ProxyServer.tearDownClass()
966
+
967
+
968
+ def test_clone_proxy_server(proxy_server: str, scm: Git, git: Git, tmp_dir: TmpDir):
969
+ url = "https://github.com/iterative/dvcyaml-schema"
970
+
971
+ p = (
972
+ Path(os.environ["HOME"] if "HOME" in os.environ else os.environ["USERPROFILE"])
973
+ / ".gitconfig"
974
+ )
975
+ p.write_text(BAD_PROXY_CONFIG)
976
+ with pytest.raises(Exception): # noqa: PT011, B017
977
+ git.clone(url, "dir")
978
+
979
+ mock_config_content = f"""[http]\n
980
+ proxy = {proxy_server}
981
+ [https]
982
+ proxy = {proxy_server}
983
+ """
984
+
985
+ p.write_text(mock_config_content)
986
+ git.clone(url, "dir")
987
+
988
+
989
+ def test_iter_remote_refs_proxy_server(proxy_server: str, scm: Git, tmp_dir: TmpDir):
990
+ url = "https://github.com/iterative/dvcyaml-schema"
991
+ git = GitBackends.DEFAULT["dulwich"](".")
992
+
993
+ p = (
994
+ Path(os.environ["HOME"] if "HOME" in os.environ else os.environ["USERPROFILE"])
995
+ / ".gitconfig"
996
+ )
997
+ p.write_text(BAD_PROXY_CONFIG)
998
+ with pytest.raises(Exception): # noqa: PT011, B017
999
+ list(git.iter_remote_refs(url))
1000
+
1001
+ mock_config_content = f"""[http]
1002
+ proxy = {proxy_server}
1003
+ [https]
1004
+ proxy = {proxy_server}
1005
+ """
1006
+
1007
+ p.write_text(mock_config_content)
1008
+ res = list(git.iter_remote_refs(url))
1009
+ assert res
1010
+
1011
+
1012
+ @pytest.mark.skip_git_backend("gitpython")
1013
+ def test_fetch_refspecs_proxy_server(
1014
+ proxy_server: str, scm: Git, git: Git, tmp_dir: TmpDir
1015
+ ):
1016
+ url = "https://github.com/iterative/dvcyaml-schema"
1017
+
1018
+ p = (
1019
+ Path(os.environ["HOME"] if "HOME" in os.environ else os.environ["USERPROFILE"])
1020
+ / ".gitconfig"
1021
+ )
1022
+ p.write_text(BAD_PROXY_CONFIG)
1023
+ with pytest.raises(Exception): # noqa: PT011, B017
1024
+ git.fetch_refspecs(url, ["refs/heads/master:refs/heads/master"])
1025
+
1026
+ mock_config_content = f"""[http]
1027
+ proxy = {proxy_server}
1028
+ [https]
1029
+ proxy = {proxy_server}
1030
+ """
1031
+
1032
+ p.write_text(mock_config_content)
1033
+ git.fetch_refspecs(url, "refs/heads/master:refs/heads/master")
1034
+
1035
+
944
1036
  @pytest.mark.skip_git_backend("pygit2")
945
1037
  def test_fetch(tmp_dir: TmpDir, scm: Git, git: Git, tmp_dir_factory: TempDirFactory):
946
1038
  tmp_dir.gen("foo", "foo")
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