scmrepo 3.3.12__py3-none-any.whl → 3.4.0__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.

@@ -17,6 +17,7 @@ from typing import (
17
17
  )
18
18
 
19
19
  from dulwich.config import ConfigFile, StackedConfig
20
+ from dulwich.walk import ORDER_DATE
20
21
  from funcy import cached_property, reraise
21
22
 
22
23
  from scmrepo.exceptions import AuthError, CloneError, InvalidRemote, RevError, SCMError
@@ -473,7 +474,25 @@ class DulwichBackend(BaseGitBackend): # pylint:disable=abstract-method
473
474
  return sorted(ref[len(base) :] for ref in self.iter_refs(base))
474
475
 
475
476
  def list_all_commits(self) -> Iterable[str]:
476
- raise NotImplementedError
477
+ from dulwich.objects import Tag
478
+
479
+ repo = self.repo
480
+ starting_points: list[bytes] = []
481
+
482
+ # HEAD
483
+ head_rev = self.get_ref("HEAD")
484
+ if head_rev:
485
+ starting_points.append(head_rev.encode("utf-8"))
486
+
487
+ # Branches and remotes
488
+ for ref in repo.refs:
489
+ if ref.startswith((b"refs/heads/", b"refs/remotes/", b"refs/tags/")):
490
+ if isinstance(repo.refs[ref], Tag):
491
+ ref = self.repo.get_peeled(repo.refs[ref])
492
+ starting_points.append(repo.refs[ref])
493
+
494
+ walker = self.repo.get_walker(include=starting_points, order=ORDER_DATE)
495
+ return [e.commit.id.decode() for e in walker]
477
496
 
478
497
  def get_tree_obj(self, rev: str, **kwargs) -> DulwichObject:
479
498
  from dulwich.objectspec import parse_tree
@@ -452,7 +452,32 @@ class Pygit2Backend(BaseGitBackend): # pylint:disable=abstract-method
452
452
  return sorted(ref[len(base) :] for ref in self.iter_refs(base))
453
453
 
454
454
  def list_all_commits(self) -> Iterable[str]:
455
- raise NotImplementedError
455
+ import pygit2
456
+ from pygit2.enums import SortMode
457
+
458
+ # Add HEAD
459
+ starting_points: list[Union[Oid, str]] = []
460
+ if not self.repo.head_is_unborn:
461
+ starting_points.append(self.repo.head.target)
462
+
463
+ # Add all branches, remotes, and tags
464
+ for ref in self.repo.references:
465
+ if ref.startswith(("refs/heads/", "refs/remotes/")):
466
+ oid = self.repo.revparse_single(ref).id
467
+ starting_points.append(oid)
468
+ elif ref.startswith("refs/tags/"):
469
+ tag_obj = self.repo.revparse_single(ref)
470
+ if isinstance(tag_obj, pygit2.Tag):
471
+ starting_points.append(tag_obj.target)
472
+ else:
473
+ starting_points.append(tag_obj.id)
474
+
475
+ # Walk all commits
476
+ walker = self.repo.walk(None)
477
+ for oid in starting_points:
478
+ walker.push(oid)
479
+ walker.sort(SortMode.TIME)
480
+ return [str(commit.id) for commit in walker]
456
481
 
457
482
  def get_tree_obj(self, rev: str, **kwargs) -> Pygit2Object:
458
483
  tree = self.repo[rev].tree
scmrepo/progress.py CHANGED
@@ -4,7 +4,7 @@ from funcy import compose
4
4
 
5
5
 
6
6
  def code2desc(op_code):
7
- from git import RootUpdateProgress as OP # noqa: N814
7
+ from git import RootUpdateProgress as OP # noqa: N814, TID251
8
8
 
9
9
  ops = {
10
10
  OP.COUNTING: "Counting",
@@ -44,16 +44,20 @@ class GitProgressEvent(NamedTuple):
44
44
 
45
45
  class GitProgressReporter:
46
46
  def __init__(self, fn) -> None:
47
- from git.util import CallableRemoteProgress
48
-
49
- self._reporter = CallableRemoteProgress(self.wrap_fn(fn))
47
+ try:
48
+ from git.util import CallableRemoteProgress # noqa: TID251
49
+ except ImportError:
50
+ self._reporter = None
51
+ else:
52
+ self._reporter = CallableRemoteProgress(self.wrap_fn(fn))
50
53
 
51
54
  def __call__(self, msg: Union[str, bytes]) -> None:
52
- self._reporter._parse_progress_line(
53
- msg.decode("utf-8", errors="replace").strip()
54
- if isinstance(msg, bytes)
55
- else msg
56
- )
55
+ if self._reporter is not None:
56
+ self._reporter._parse_progress_line(
57
+ msg.decode("utf-8", errors="replace").strip()
58
+ if isinstance(msg, bytes)
59
+ else msg
60
+ )
57
61
 
58
62
  @staticmethod
59
63
  def wrap_fn(fn):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scmrepo
3
- Version: 3.3.12
3
+ Version: 3.4.0
4
4
  Summary: scmrepo
5
5
  Author-email: Iterative <support@dvc.org>
6
6
  License: Apache-2.0
@@ -4,7 +4,7 @@ scmrepo/base.py,sha256=pgddGR7UeZoEq2d5lip1vjbxTmpwTnKFH4JwHy-Fmho,3007
4
4
  scmrepo/exceptions.py,sha256=vR8BuCKgKh9lMnCemzNYGHiJctioOmhn_Kv5m8XO69Y,1053
5
5
  scmrepo/fs.py,sha256=8efNf_D5IQb-N42w-apAkG3Uwe8gJA_HVflniY9gX6M,6639
6
6
  scmrepo/noscm.py,sha256=xraqlBek4zhFlHf1LvTMkgBM0hykgcTfMVkTNCpVlcQ,491
7
- scmrepo/progress.py,sha256=fRUMvkcw6GLuVTP_tK7mGpKeJjbJulFP8rPUqyltkYQ,2157
7
+ scmrepo/progress.py,sha256=p4FJwEv1x588oYHk-AcWbq9C382hJ1lq8ThGi9iGPcQ,2336
8
8
  scmrepo/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  scmrepo/urls.py,sha256=vEfW1h1lb7GXvMVBk-TNwqctpl-5xGMA2LbOPVn7t4Q,638
10
10
  scmrepo/utils.py,sha256=_F3rVvPhES-A2JxLGob0RV8BOnHzxbA9aDPClA7_V8M,1512
@@ -16,10 +16,10 @@ 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=myfZY2x27DbDvIBUXzDjswXEViR5MKH0qgowwzcn7aY,25340
19
- scmrepo/git/backend/dulwich/__init__.py,sha256=gYq9WV1Sz4ovd7X12nEcGzm5HQB80xq47YjoQaBl61g,35127
19
+ scmrepo/git/backend/dulwich/__init__.py,sha256=swoZMlBaQOhz2381gneyMheXvZG4WifcWJCEHgsyzmY,35825
20
20
  scmrepo/git/backend/dulwich/asyncssh_vendor.py,sha256=QnaUyHmPWBWtryK1JCXR_S0UZyjfF_NN7z9jIii3Bac,9912
21
21
  scmrepo/git/backend/dulwich/client.py,sha256=VvAheye_QAK6agGsKVj5Jk62zOp-SipgdwuaJLIWDbA,2573
22
- scmrepo/git/backend/pygit2/__init__.py,sha256=7meRePoB_bUx0UY2wPm2nxI4DFabn5nenVP8Cyf7AZc,36366
22
+ scmrepo/git/backend/pygit2/__init__.py,sha256=33bfjDuvSlbe-raK_rpLJR4KZV5jSKpxZX6sBc8Nm_A,37331
23
23
  scmrepo/git/backend/pygit2/callbacks.py,sha256=Mk-2e5dfJPNLsczRiK4rTnjHd5ZyonmegdwiFwM9Anc,2849
24
24
  scmrepo/git/backend/pygit2/filter.py,sha256=UJdTsgBOuxQFn9nw_tnhHi7GOIjEOtFkzn0Xuavx1jI,2206
25
25
  scmrepo/git/lfs/__init__.py,sha256=at5blRIKnKpg_g5dLRDsGWBFi6SbucRlF_DX6aAkGtE,257
@@ -31,8 +31,8 @@ scmrepo/git/lfs/pointer.py,sha256=BcVbtjoOUG9cEzyJSJDeweqehGZvq43P6NNLDYUGYEI,31
31
31
  scmrepo/git/lfs/progress.py,sha256=AcWvygDG0ee__Jec5BlRr58F-lAj3d4Z_j7JbW3OUcI,4733
32
32
  scmrepo/git/lfs/smudge.py,sha256=LMt9I5QodXLh8FiQbAbix3GHbeuyPXGwHuHYJ0f5ORo,1610
33
33
  scmrepo/git/lfs/storage.py,sha256=nx_HvHHC1sf15Qgbsj8jEOkdHXkZ8VUEh8QBtt9sLwI,2348
34
- scmrepo-3.3.12.dist-info/licenses/LICENSE,sha256=-1jhbPjoIVHR0cEgahL4Zhct75Ff4MzYCR_jOaJDPq8,11340
35
- scmrepo-3.3.12.dist-info/METADATA,sha256=43OwoHiicdk7u3KloFEp7MPoQxYE2b76lgzpZLvgDuw,4815
36
- scmrepo-3.3.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
- scmrepo-3.3.12.dist-info/top_level.txt,sha256=iunjod6w3GogERsAYfLRupnANXnqzX3jbIfbeIQG5cc,8
38
- scmrepo-3.3.12.dist-info/RECORD,,
34
+ scmrepo-3.4.0.dist-info/licenses/LICENSE,sha256=-1jhbPjoIVHR0cEgahL4Zhct75Ff4MzYCR_jOaJDPq8,11340
35
+ scmrepo-3.4.0.dist-info/METADATA,sha256=XCMfzvWY_E0INSKoHCiTzEEbgyOFlBEmzBs2cwCuHmo,4814
36
+ scmrepo-3.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
+ scmrepo-3.4.0.dist-info/top_level.txt,sha256=iunjod6w3GogERsAYfLRupnANXnqzX3jbIfbeIQG5cc,8
38
+ scmrepo-3.4.0.dist-info/RECORD,,