pygit2 1.13.2__tar.gz → 1.13.3__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.
Files changed (185) hide show
  1. {pygit2-1.13.2 → pygit2-1.13.3}/AUTHORS.rst +8 -7
  2. {pygit2-1.13.2 → pygit2-1.13.3}/CHANGELOG.rst +22 -0
  3. {pygit2-1.13.2 → pygit2-1.13.3}/PKG-INFO +1 -1
  4. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/__init__.py +13 -1
  5. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/_build.py +1 -1
  6. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/_pygit2.pyi +0 -1
  7. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/_run.py +7 -6
  8. pygit2-1.13.3/pygit2/blob.py +154 -0
  9. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/attr.h +14 -3
  10. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/repository.h +3 -0
  11. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/submodule.h +5 -3
  12. pygit2-1.13.3/pygit2/enums.py +64 -0
  13. pygit2-1.13.3/pygit2/filter.py +115 -0
  14. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/remote.py +9 -1
  15. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/repository.py +128 -19
  16. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/submodule.py +56 -0
  17. {pygit2-1.13.2 → pygit2-1.13.3}/src/blob.c +226 -0
  18. pygit2-1.13.3/src/filter.c +555 -0
  19. pygit2-1.13.3/src/filter.h +49 -0
  20. {pygit2-1.13.2 → pygit2-1.13.3}/src/mailmap.c +1 -1
  21. {pygit2-1.13.2 → pygit2-1.13.3}/src/pygit2.c +140 -0
  22. {pygit2-1.13.2 → pygit2-1.13.3}/src/refdb_backend.c +2 -4
  23. {pygit2-1.13.2 → pygit2-1.13.3}/src/repository.c +0 -76
  24. {pygit2-1.13.2 → pygit2-1.13.3}/src/types.h +6 -0
  25. {pygit2-1.13.2 → pygit2-1.13.3}/src/utils.h +1 -1
  26. {pygit2-1.13.2 → pygit2-1.13.3}/src/walker.c +3 -0
  27. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_blob.py +43 -0
  28. pygit2-1.13.3/test/test_filter.py +130 -0
  29. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_remote.py +17 -0
  30. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_repository.py +9 -0
  31. pygit2-1.13.3/test/test_submodule.py +225 -0
  32. pygit2-1.13.2/test/test_submodule.py +0 -117
  33. {pygit2-1.13.2 → pygit2-1.13.3}/COPYING +0 -0
  34. {pygit2-1.13.2 → pygit2-1.13.3}/Makefile +0 -0
  35. {pygit2-1.13.2 → pygit2-1.13.3}/README.rst +0 -0
  36. {pygit2-1.13.2 → pygit2-1.13.3}/SPONSORS.rst +0 -0
  37. {pygit2-1.13.2 → pygit2-1.13.3}/build.sh +0 -0
  38. {pygit2-1.13.2 → pygit2-1.13.3}/build_tag.py +0 -0
  39. {pygit2-1.13.2 → pygit2-1.13.3}/mypy-stubtest.ini +0 -0
  40. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/blame.py +0 -0
  41. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/callbacks.py +0 -0
  42. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/config.py +0 -0
  43. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/credentials.py +0 -0
  44. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/blame.h +0 -0
  45. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/buffer.h +0 -0
  46. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/callbacks.h +0 -0
  47. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/checkout.h +0 -0
  48. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/clone.h +0 -0
  49. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/commit.h +0 -0
  50. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/common.h +0 -0
  51. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/config.h +0 -0
  52. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/describe.h +0 -0
  53. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/diff.h +0 -0
  54. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/errors.h +0 -0
  55. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/graph.h +0 -0
  56. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/index.h +0 -0
  57. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/indexer.h +0 -0
  58. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/merge.h +0 -0
  59. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/net.h +0 -0
  60. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/oid.h +0 -0
  61. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/pack.h +0 -0
  62. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/proxy.h +0 -0
  63. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/refspec.h +0 -0
  64. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/remote.h +0 -0
  65. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/revert.h +0 -0
  66. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/stash.h +0 -0
  67. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/strarray.h +0 -0
  68. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/transport.h +0 -0
  69. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/decl/types.h +0 -0
  70. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/errors.py +0 -0
  71. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/ffi.py +0 -0
  72. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/index.py +0 -0
  73. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/packbuilder.py +0 -0
  74. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/refspec.py +0 -0
  75. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/settings.py +0 -0
  76. {pygit2-1.13.2 → pygit2-1.13.3}/pygit2/utils.py +0 -0
  77. {pygit2-1.13.2 → pygit2-1.13.3}/pyproject.toml +0 -0
  78. {pygit2-1.13.2 → pygit2-1.13.3}/pytest.ini +0 -0
  79. {pygit2-1.13.2 → pygit2-1.13.3}/requirements-test.txt +0 -0
  80. {pygit2-1.13.2 → pygit2-1.13.3}/requirements.txt +0 -0
  81. {pygit2-1.13.2 → pygit2-1.13.3}/setup.cfg +0 -0
  82. {pygit2-1.13.2 → pygit2-1.13.3}/setup.py +0 -0
  83. {pygit2-1.13.2 → pygit2-1.13.3}/src/branch.c +0 -0
  84. {pygit2-1.13.2 → pygit2-1.13.3}/src/branch.h +0 -0
  85. {pygit2-1.13.2 → pygit2-1.13.3}/src/commit.c +0 -0
  86. {pygit2-1.13.2 → pygit2-1.13.3}/src/diff.c +0 -0
  87. {pygit2-1.13.2 → pygit2-1.13.3}/src/diff.h +0 -0
  88. {pygit2-1.13.2 → pygit2-1.13.3}/src/error.c +0 -0
  89. {pygit2-1.13.2 → pygit2-1.13.3}/src/error.h +0 -0
  90. {pygit2-1.13.2 → pygit2-1.13.3}/src/mailmap.h +0 -0
  91. {pygit2-1.13.2 → pygit2-1.13.3}/src/note.c +0 -0
  92. {pygit2-1.13.2 → pygit2-1.13.3}/src/note.h +0 -0
  93. {pygit2-1.13.2 → pygit2-1.13.3}/src/object.c +0 -0
  94. {pygit2-1.13.2 → pygit2-1.13.3}/src/object.h +0 -0
  95. {pygit2-1.13.2 → pygit2-1.13.3}/src/odb.c +0 -0
  96. {pygit2-1.13.2 → pygit2-1.13.3}/src/odb.h +0 -0
  97. {pygit2-1.13.2 → pygit2-1.13.3}/src/odb_backend.c +0 -0
  98. {pygit2-1.13.2 → pygit2-1.13.3}/src/odb_backend.h +0 -0
  99. {pygit2-1.13.2 → pygit2-1.13.3}/src/oid.c +0 -0
  100. {pygit2-1.13.2 → pygit2-1.13.3}/src/oid.h +0 -0
  101. {pygit2-1.13.2 → pygit2-1.13.3}/src/options.c +0 -0
  102. {pygit2-1.13.2 → pygit2-1.13.3}/src/options.h +0 -0
  103. {pygit2-1.13.2 → pygit2-1.13.3}/src/patch.c +0 -0
  104. {pygit2-1.13.2 → pygit2-1.13.3}/src/patch.h +0 -0
  105. {pygit2-1.13.2 → pygit2-1.13.3}/src/refdb.c +0 -0
  106. {pygit2-1.13.2 → pygit2-1.13.3}/src/refdb.h +0 -0
  107. {pygit2-1.13.2 → pygit2-1.13.3}/src/refdb_backend.h +0 -0
  108. {pygit2-1.13.2 → pygit2-1.13.3}/src/reference.c +0 -0
  109. {pygit2-1.13.2 → pygit2-1.13.3}/src/reference.h +0 -0
  110. {pygit2-1.13.2 → pygit2-1.13.3}/src/repository.h +0 -0
  111. {pygit2-1.13.2 → pygit2-1.13.3}/src/revspec.c +0 -0
  112. {pygit2-1.13.2 → pygit2-1.13.3}/src/revspec.h +0 -0
  113. {pygit2-1.13.2 → pygit2-1.13.3}/src/signature.c +0 -0
  114. {pygit2-1.13.2 → pygit2-1.13.3}/src/signature.h +0 -0
  115. {pygit2-1.13.2 → pygit2-1.13.3}/src/stash.c +0 -0
  116. {pygit2-1.13.2 → pygit2-1.13.3}/src/tag.c +0 -0
  117. {pygit2-1.13.2 → pygit2-1.13.3}/src/tree.c +0 -0
  118. {pygit2-1.13.2 → pygit2-1.13.3}/src/tree.h +0 -0
  119. {pygit2-1.13.2 → pygit2-1.13.3}/src/treebuilder.c +0 -0
  120. {pygit2-1.13.2 → pygit2-1.13.3}/src/treebuilder.h +0 -0
  121. {pygit2-1.13.2 → pygit2-1.13.3}/src/utils.c +0 -0
  122. {pygit2-1.13.2 → pygit2-1.13.3}/src/walker.h +0 -0
  123. {pygit2-1.13.2 → pygit2-1.13.3}/src/wildmatch.c +0 -0
  124. {pygit2-1.13.2 → pygit2-1.13.3}/src/wildmatch.h +0 -0
  125. {pygit2-1.13.2 → pygit2-1.13.3}/src/worktree.c +0 -0
  126. {pygit2-1.13.2 → pygit2-1.13.3}/src/worktree.h +0 -0
  127. {pygit2-1.13.2 → pygit2-1.13.3}/test/__init__.py +0 -0
  128. {pygit2-1.13.2 → pygit2-1.13.3}/test/conftest.py +0 -0
  129. {pygit2-1.13.2 → pygit2-1.13.3}/test/data/barerepo.zip +0 -0
  130. {pygit2-1.13.2 → pygit2-1.13.3}/test/data/binaryfilerepo.zip +0 -0
  131. {pygit2-1.13.2 → pygit2-1.13.3}/test/data/blameflagsrepo.zip +0 -0
  132. {pygit2-1.13.2 → pygit2-1.13.3}/test/data/dirtyrepo.zip +0 -0
  133. {pygit2-1.13.2 → pygit2-1.13.3}/test/data/emptyrepo.zip +0 -0
  134. {pygit2-1.13.2 → pygit2-1.13.3}/test/data/encoding.zip +0 -0
  135. {pygit2-1.13.2 → pygit2-1.13.3}/test/data/gpgsigned.zip +0 -0
  136. {pygit2-1.13.2 → pygit2-1.13.3}/test/data/submodulerepo.zip +0 -0
  137. {pygit2-1.13.2 → pygit2-1.13.3}/test/data/testrepo.zip +0 -0
  138. {pygit2-1.13.2 → pygit2-1.13.3}/test/data/testrepoformerging.zip +0 -0
  139. {pygit2-1.13.2 → pygit2-1.13.3}/test/data/testrepopacked.zip +0 -0
  140. {pygit2-1.13.2 → pygit2-1.13.3}/test/data/trailerrepo.zip +0 -0
  141. {pygit2-1.13.2 → pygit2-1.13.3}/test/data/utf8branchrepo.zip +0 -0
  142. {pygit2-1.13.2 → pygit2-1.13.3}/test/keys/pygit2_empty +0 -0
  143. {pygit2-1.13.2 → pygit2-1.13.3}/test/keys/pygit2_empty.pub +0 -0
  144. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_apply_diff.py +0 -0
  145. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_archive.py +0 -0
  146. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_attributes.py +0 -0
  147. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_blame.py +0 -0
  148. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_branch.py +0 -0
  149. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_branch_empty.py +0 -0
  150. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_cherrypick.py +0 -0
  151. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_commit.py +0 -0
  152. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_commit_gpg.py +0 -0
  153. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_commit_trailer.py +0 -0
  154. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_config.py +0 -0
  155. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_credentials.py +0 -0
  156. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_describe.py +0 -0
  157. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_diff.py +0 -0
  158. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_diff_binary.py +0 -0
  159. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_index.py +0 -0
  160. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_mailmap.py +0 -0
  161. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_merge.py +0 -0
  162. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_note.py +0 -0
  163. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_object.py +0 -0
  164. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_odb.py +0 -0
  165. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_odb_backend.py +0 -0
  166. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_oid.py +0 -0
  167. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_options.py +0 -0
  168. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_packbuilder.py +0 -0
  169. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_patch.py +0 -0
  170. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_patch_encoding.py +0 -0
  171. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_refdb_backend.py +0 -0
  172. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_refs.py +0 -0
  173. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_remote_prune.py +0 -0
  174. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_remote_utf8.py +0 -0
  175. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_repository_bare.py +0 -0
  176. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_repository_custom.py +0 -0
  177. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_repository_empty.py +0 -0
  178. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_revparse.py +0 -0
  179. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_revwalk.py +0 -0
  180. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_signature.py +0 -0
  181. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_status.py +0 -0
  182. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_tag.py +0 -0
  183. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_tree.py +0 -0
  184. {pygit2-1.13.2 → pygit2-1.13.3}/test/test_treebuilder.py +0 -0
  185. {pygit2-1.13.2 → pygit2-1.13.3}/test/utils.py +0 -0
@@ -4,41 +4,42 @@ Authors::
4
4
  Carlos Martín Nieto
5
5
  Nico von Geyso
6
6
  Sviatoslav Sydorenko
7
- Robert Coup
7
+ Iliyas Jorio
8
8
  Matthias Bartelmeß
9
+ Robert Coup
9
10
  W. Trevor King
10
- Iliyas Jorio
11
11
  Drew DeVault
12
12
  Dave Borowitz
13
13
  Brandon Milton
14
14
  Daniel Rodríguez Troitiño
15
+ Peter Rowlands
15
16
  Richo Healey
16
17
  Christian Boos
17
18
  Julien Miotte
18
19
  Nick Hynes
19
20
  Richard Möhn
20
21
  Xu Tao
21
- Jose Plana
22
22
  Matthew Duggan
23
23
  Matthew Gamble
24
24
  Jeremy Westwood
25
+ Jose Plana
25
26
  Martin Lenders
26
- Petr Hosek
27
27
  Sriram Raghu
28
28
  Victor Garcia
29
- Xavier Delannoy
30
29
  Yonggang Luo
31
30
  Patrick Steinhardt
31
+ Petr Hosek
32
32
  Tamir Bahar
33
33
  Valentin Haenel
34
+ Xavier Delannoy
34
35
  Michael Jones
35
36
  Saugat Pachhai
36
37
  Bernardo Heynemann
37
- Brodie Rao
38
38
  John Szakmeister
39
39
  Nabijacz Leweli
40
40
  Simon Cozens
41
41
  Vlad Temian
42
+ Brodie Rao
42
43
  Chad Dombrova
43
44
  Lukas Fleischer
44
45
  Mathias Leppich
@@ -49,7 +50,6 @@ Authors::
49
50
  Dan Sully
50
51
  David Versmisse
51
52
  Mikhail Yushkovskiy
52
- Peter Rowlands
53
53
  Robin Stocker
54
54
  Rohit Sanjay
55
55
  Rémi Duraffort
@@ -119,6 +119,7 @@ Authors::
119
119
  Vicent Marti
120
120
  Zbigniew Jędrzejewski-Szmek
121
121
  Zoran Zaric
122
+ nikitalita
122
123
  Adam Gausmann
123
124
  Adam Spiers
124
125
  Albin Söderström
@@ -1,3 +1,25 @@
1
+ 1.13.3 (2023-11-21)
2
+ -------------------------
3
+
4
+ - New API for filters in Python
5
+ `#1237 <https://github.com/libgit2/pygit2/pull/1237>`_
6
+ `#1244 <https://github.com/libgit2/pygit2/pull/1244>`_
7
+
8
+ - Shallow repositories: New ``depth`` optional argument for
9
+ ``clone_repository(...)`` and ``Remote.fetch(...)``
10
+ `#1245 <https://github.com/libgit2/pygit2/pull/1245>`_
11
+ `#1246 <https://github.com/libgit2/pygit2/pull/1246>`_
12
+
13
+ - New submodule ``init(...)``, ``update(...)`` and ``reload(...)`` functions
14
+ `#1248 <https://github.com/libgit2/pygit2/pull/1248>`_
15
+
16
+ - Release GIL in ``Walker.__next__``
17
+ `#1249 <https://github.com/libgit2/pygit2/pull/1249>`_
18
+
19
+ - Type hints for submodule functions in ``Repository``
20
+ `#1247 <https://github.com/libgit2/pygit2/pull/1247>`_
21
+
22
+
1
23
  1.13.2 (2023-10-30)
2
24
  -------------------------
3
25
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pygit2
3
- Version: 1.13.2
3
+ Version: 1.13.3
4
4
  Summary: Python bindings for libgit2.
5
5
  Home-page: https://github.com/libgit2/pygit2
6
6
  Maintainer: J. David Ibáñez
@@ -31,12 +31,15 @@ from ._pygit2 import *
31
31
 
32
32
  # High level API
33
33
  from .blame import Blame, BlameHunk
34
+ from .blob import BlobIO
34
35
  from .callbacks import git_clone_options, git_fetch_options, get_credentials
35
36
  from .callbacks import Payload, RemoteCallbacks, CheckoutCallbacks, StashApplyCallbacks
36
37
  from .config import Config
37
38
  from .credentials import *
38
39
  from .errors import check_error, Passthrough
40
+ from .enums import SubmoduleIgnore, SubmoduleStatus
39
41
  from .ffi import ffi, C
42
+ from .filter import Filter
40
43
  from .index import Index, IndexEntry
41
44
  from .remote import Remote
42
45
  from .repository import Repository
@@ -92,6 +95,8 @@ GIT_ATTR_CHECK_FILE_THEN_INDEX = C.GIT_ATTR_CHECK_FILE_THEN_INDEX
92
95
  GIT_ATTR_CHECK_INDEX_THEN_FILE = C.GIT_ATTR_CHECK_INDEX_THEN_FILE
93
96
  GIT_ATTR_CHECK_INDEX_ONLY = C.GIT_ATTR_CHECK_INDEX_ONLY
94
97
  GIT_ATTR_CHECK_NO_SYSTEM = C.GIT_ATTR_CHECK_NO_SYSTEM
98
+ GIT_ATTR_CHECK_INCLUDE_HEAD = C.GIT_ATTR_CHECK_INCLUDE_HEAD
99
+ GIT_ATTR_CHECK_INCLUDE_COMMIT = C.GIT_ATTR_CHECK_INCLUDE_COMMIT
95
100
 
96
101
  # GIT_FETCH_PRUNE
97
102
  GIT_FETCH_PRUNE_UNSPECIFIED = C.GIT_FETCH_PRUNE_UNSPECIFIED
@@ -197,7 +202,7 @@ def init_repository(path, bare=False,
197
202
 
198
203
  def clone_repository(
199
204
  url, path, bare=False, repository=None, remote=None,
200
- checkout_branch=None, callbacks=None):
205
+ checkout_branch=None, callbacks=None, depth=0):
201
206
  """
202
207
  Clones a new Git repository from *url* in the given *path*.
203
208
 
@@ -231,6 +236,12 @@ def clone_repository(
231
236
 
232
237
  The callbacks should be an object which inherits from
233
238
  `pyclass:RemoteCallbacks`.
239
+ depth : int
240
+ Number of commits to clone.
241
+
242
+ If greater than 0, creates a shallow clone with a history truncated to
243
+ the specified number of commits.
244
+ The default is 0 (full commit history).
234
245
  """
235
246
 
236
247
  if callbacks is None:
@@ -244,6 +255,7 @@ def clone_repository(
244
255
  with git_clone_options(payload):
245
256
  opts = payload.clone_options
246
257
  opts.bare = bare
258
+ opts.fetch_opts.depth = depth
247
259
 
248
260
  if checkout_branch:
249
261
  checkout_branch_ref = ffi.new('char []', to_bytes(checkout_branch))
@@ -34,7 +34,7 @@ from pathlib import Path
34
34
  #
35
35
  # The version number of pygit2
36
36
  #
37
- __version__ = '1.13.2'
37
+ __version__ = '1.13.3'
38
38
 
39
39
 
40
40
  #
@@ -495,7 +495,6 @@ class Repository:
495
495
  def expand_id(self, hex: str) -> Oid: ...
496
496
  def free(self) -> None: ...
497
497
  def git_object_lookup_prefix(self, oid: _OidArg) -> Object: ...
498
- def init_submodules(self, submodules: Optional[list[Submodule]] = None, overwrite = False) -> None: ...
499
498
  def list_worktrees(self) -> list[str]: ...
500
499
  def listall_branches(self, flag: int = GIT_BRANCH_LOCAL) -> list[str]: ...
501
500
  def listall_stashes(self) -> list[Stash]: ...
@@ -54,8 +54,8 @@ else:
54
54
  # Order matters
55
55
  h_files = [
56
56
  'types.h',
57
- 'attr.h',
58
57
  'oid.h',
58
+ 'attr.h',
59
59
  'blame.h',
60
60
  'buffer.h',
61
61
  'strarray.h',
@@ -91,14 +91,15 @@ for h_file in h_files:
91
91
 
92
92
  C_HEADER_SRC = '\n'.join(h_source)
93
93
 
94
+ C_PREAMBLE = """\
95
+ #include <git2.h>
96
+ #include <git2/sys/repository.h>
97
+ """
98
+
94
99
  # ffi
95
100
  _, libgit2_kw = get_libgit2_paths()
96
101
  ffi = FFI()
97
- ffi.set_source(
98
- "pygit2._libgit2",
99
- "#include <git2.h>", # preamble
100
- **libgit2_kw
101
- )
102
+ ffi.set_source("pygit2._libgit2", C_PREAMBLE, **libgit2_kw)
102
103
  ffi.cdef(C_HEADER_SRC)
103
104
 
104
105
 
@@ -0,0 +1,154 @@
1
+ import io
2
+ import threading
3
+ import time
4
+ from contextlib import AbstractContextManager
5
+ from typing import Optional
6
+ from queue import Queue
7
+
8
+ from ._pygit2 import GIT_BLOB_FILTER_CHECK_FOR_BINARY, Blob, Oid
9
+
10
+
11
+ class _BlobIO(io.RawIOBase):
12
+ """Low-level wrapper for streaming blob content.
13
+
14
+ The underlying libgit2 git_writestream filter chain will be run
15
+ in a separate thread. The GIL will be released while running
16
+ libgit2 filtering.
17
+ """
18
+
19
+ def __init__(
20
+ self,
21
+ blob: Blob,
22
+ as_path: Optional[str] = None,
23
+ flags: int = GIT_BLOB_FILTER_CHECK_FOR_BINARY,
24
+ commit_id: Optional[Oid] = None,
25
+ ):
26
+ super().__init__()
27
+ self._blob = blob
28
+ self._queue = Queue(maxsize=1)
29
+ self._ready = threading.Event()
30
+ self._writer_closed = threading.Event()
31
+ self._chunk: Optional[bytes] = None
32
+ self._thread = threading.Thread(
33
+ target=self._blob._write_to_queue,
34
+ args=(self._queue, self._ready, self._writer_closed),
35
+ kwargs={
36
+ "as_path": as_path,
37
+ "flags": flags,
38
+ "commit_id": commit_id,
39
+ },
40
+ daemon=True,
41
+ )
42
+ self._thread.start()
43
+
44
+ def __exit__(self, exc_type, exc_value, traceback):
45
+ self.close()
46
+
47
+ def isatty():
48
+ return False
49
+
50
+ def readable(self):
51
+ return True
52
+
53
+ def writable(self):
54
+ return False
55
+
56
+ def seekable(self):
57
+ return False
58
+
59
+ def readinto(self, b, /):
60
+ try:
61
+ while self._chunk is None:
62
+ self._ready.wait()
63
+ if self._queue.empty():
64
+ if self._writer_closed.is_set():
65
+ # EOF
66
+ return 0
67
+ self._ready.clear()
68
+ time.sleep(0)
69
+ continue
70
+ chunk = self._queue.get()
71
+ if chunk:
72
+ self._chunk = chunk
73
+
74
+ if len(self._chunk) <= len(b):
75
+ bytes_written = len(self._chunk)
76
+ b[:bytes_written] = self._chunk
77
+ self._chunk = None
78
+ return bytes_written
79
+ bytes_written = len(b)
80
+ b[:] = self._chunk[:bytes_written]
81
+ self._chunk = self._chunk[bytes_written:]
82
+ return bytes_written
83
+ except KeyboardInterrupt:
84
+ return 0
85
+
86
+ def close(self):
87
+ try:
88
+ self._ready.wait()
89
+ self._writer_closed.wait()
90
+ while self._queue is not None and not self._queue.empty():
91
+ self._queue.get()
92
+ self._thread.join()
93
+ except KeyboardInterrupt:
94
+ pass
95
+ self._queue = None
96
+
97
+
98
+ class BlobIO(io.BufferedReader, AbstractContextManager):
99
+ """Read-only wrapper for streaming blob content.
100
+
101
+ Supports reading both raw and filtered blob content.
102
+ Implements io.BufferedReader.
103
+
104
+ Example:
105
+
106
+ >>> with BlobIO(blob) as f:
107
+ ... while True:
108
+ ... # Read blob data in 1KB chunks until EOF is reached
109
+ ... chunk = f.read(1024)
110
+ ... if not chunk:
111
+ ... break
112
+
113
+ By default, `BlobIO` will stream the raw contents of the blob, but it
114
+ can also be used to stream filtered content (i.e. to read the content
115
+ after applying filters which would be used when checking out the blob
116
+ to the working directory).
117
+
118
+ Example:
119
+
120
+ >>> with BlobIO(blob, as_path='my_file.ext') as f:
121
+ ... # Read the filtered content which would be returned upon
122
+ ... # running 'git checkout -- my_file.txt'
123
+ ... filtered_data = f.read()
124
+ """
125
+
126
+ def __init__(
127
+ self,
128
+ blob: Blob,
129
+ as_path: Optional[str] = None,
130
+ flags: int = GIT_BLOB_FILTER_CHECK_FOR_BINARY,
131
+ commit_id: Optional[Oid] = None,
132
+ ):
133
+ """Wrap the specified blob.
134
+
135
+ Parameters:
136
+ blob: The blob to wrap.
137
+ as_path: Filter the contents of the blob as if it had the specified
138
+ path. If `as_path` is None, the raw contents of the blob will
139
+ be read.
140
+ flags: GIT_BLOB_FILTER_* bitflags (only applicable when `as_path`
141
+ is set).
142
+ commit_oid: Commit to load attributes from when
143
+ GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMIT is specified in `flags`
144
+ (only applicable when `as_path` is set).
145
+ """
146
+ raw = _BlobIO(blob, as_path=as_path, flags=flags, commit_id=commit_id)
147
+ super().__init__(raw)
148
+
149
+ def __exit__(self, exc_type, exc_value, traceback):
150
+ self.close()
151
+
152
+
153
+ io.RawIOBase.register(_BlobIO)
154
+ io.BufferedIOBase.register(BlobIO)
@@ -1,7 +1,11 @@
1
1
  #define GIT_ATTR_CHECK_FILE_THEN_INDEX 0
2
2
  #define GIT_ATTR_CHECK_INDEX_THEN_FILE 1
3
3
  #define GIT_ATTR_CHECK_INDEX_ONLY 2
4
- #define GIT_ATTR_CHECK_NO_SYSTEM 4
4
+ #define GIT_ATTR_CHECK_NO_SYSTEM 4
5
+ #define GIT_ATTR_CHECK_INCLUDE_HEAD 8
6
+ #define GIT_ATTR_CHECK_INCLUDE_COMMIT 16
7
+
8
+ #define GIT_ATTR_OPTIONS_VERSION ...
5
9
 
6
10
  typedef enum {
7
11
  GIT_ATTR_VALUE_UNSPECIFIED = 0, /**< The attribute has been left unspecified */
@@ -10,10 +14,17 @@ typedef enum {
10
14
  GIT_ATTR_VALUE_STRING /**< This attribute has a value */
11
15
  } git_attr_value_t;
12
16
 
13
- int git_attr_get(
17
+ typedef struct {
18
+ unsigned int version;
19
+ unsigned int flags;
20
+ git_oid *commit_id;
21
+ git_oid attr_commit_id;
22
+ } git_attr_options;
23
+
24
+ int git_attr_get_ext(
14
25
  const char **value_out,
15
26
  git_repository *repo,
16
- uint32_t flags,
27
+ git_attr_options *opts,
17
28
  const char *path,
18
29
  const char *name);
19
30
 
@@ -87,3 +87,6 @@ int git_repository_ident(const char **name, const char **email, const git_reposi
87
87
  int git_repository_set_ident(git_repository *repo, const char *name, const char *email);
88
88
  int git_repository_index(git_index **out, git_repository *repo);
89
89
  git_repository_state_t git_repository_state(git_repository *repo);
90
+
91
+ int git_repository_submodule_cache_all(git_repository *repo);
92
+ int git_repository_submodule_cache_clear(git_repository *repo);
@@ -30,12 +30,14 @@ int git_submodule_lookup(
30
30
  const char *name);
31
31
 
32
32
  void git_submodule_free(git_submodule *submodule);
33
- int git_submodule_open(
34
- git_repository **repo,
35
- git_submodule *submodule);
33
+ int git_submodule_open(git_repository **repo, git_submodule *submodule);
34
+ int git_submodule_init(git_submodule *submodule, int overwrite);
35
+ int git_submodule_reload(git_submodule *submodule, int force);
36
36
 
37
37
  const char * git_submodule_name(git_submodule *submodule);
38
38
  const char * git_submodule_path(git_submodule *submodule);
39
39
  const char * git_submodule_url(git_submodule *submodule);
40
40
  const char * git_submodule_branch(git_submodule *submodule);
41
41
  const git_oid * git_submodule_head_id(git_submodule *submodule);
42
+
43
+ int git_submodule_status(unsigned int *status, git_repository *repo, const char *name, git_submodule_ignore_t ignore);
@@ -0,0 +1,64 @@
1
+ from enum import IntEnum, IntFlag
2
+
3
+ from . import _pygit2
4
+
5
+
6
+ class SubmoduleIgnore(IntEnum):
7
+ UNSPECIFIED = _pygit2.GIT_SUBMODULE_IGNORE_UNSPECIFIED
8
+ "use the submodule's configuration"
9
+
10
+ NONE = _pygit2.GIT_SUBMODULE_IGNORE_NONE
11
+ "any change or untracked == dirty"
12
+
13
+ UNTRACKED = _pygit2.GIT_SUBMODULE_IGNORE_UNTRACKED
14
+ "dirty if tracked files change"
15
+
16
+ DIRTY = _pygit2.GIT_SUBMODULE_IGNORE_DIRTY
17
+ "only dirty if HEAD moved"
18
+
19
+ ALL = _pygit2.GIT_SUBMODULE_IGNORE_ALL
20
+ "never dirty"
21
+
22
+
23
+ class SubmoduleStatus(IntFlag):
24
+ IN_HEAD = _pygit2.GIT_SUBMODULE_STATUS_IN_HEAD
25
+ "superproject head contains submodule"
26
+
27
+ IN_INDEX = _pygit2.GIT_SUBMODULE_STATUS_IN_INDEX
28
+ "superproject index contains submodule"
29
+
30
+ IN_CONFIG = _pygit2.GIT_SUBMODULE_STATUS_IN_CONFIG
31
+ "superproject gitmodules has submodule"
32
+
33
+ IN_WD = _pygit2.GIT_SUBMODULE_STATUS_IN_WD
34
+ "superproject workdir has submodule"
35
+
36
+ INDEX_ADDED = _pygit2.GIT_SUBMODULE_STATUS_INDEX_ADDED
37
+ "in index, not in head (flag available if ignore is not ALL)"
38
+
39
+ INDEX_DELETED = _pygit2.GIT_SUBMODULE_STATUS_INDEX_DELETED
40
+ "in head, not in index (flag available if ignore is not ALL)"
41
+
42
+ INDEX_MODIFIED = _pygit2.GIT_SUBMODULE_STATUS_INDEX_MODIFIED
43
+ "index and head don't match (flag available if ignore is not ALL)"
44
+
45
+ WD_UNINITIALIZED = _pygit2.GIT_SUBMODULE_STATUS_WD_UNINITIALIZED
46
+ "workdir contains empty repository (flag available if ignore is not ALL)"
47
+
48
+ WD_ADDED = _pygit2.GIT_SUBMODULE_STATUS_WD_ADDED
49
+ "in workdir, not index (flag available if ignore is not ALL)"
50
+
51
+ WD_DELETED = _pygit2.GIT_SUBMODULE_STATUS_WD_DELETED
52
+ "in index, not workdir (flag available if ignore is not ALL)"
53
+
54
+ WD_MODIFIED = _pygit2.GIT_SUBMODULE_STATUS_WD_MODIFIED
55
+ "index and workdir head don't match (flag available if ignore is not ALL)"
56
+
57
+ WD_INDEX_MODIFIED = _pygit2.GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED
58
+ "submodule workdir index is dirty (flag available if ignore is NONE or UNTRACKED)"
59
+
60
+ WD_WD_MODIFIED = _pygit2.GIT_SUBMODULE_STATUS_WD_WD_MODIFIED
61
+ "submodule workdir has modified files (flag available if ignore is NONE or UNTRACKED)"
62
+
63
+ WD_UNTRACKED = _pygit2.GIT_SUBMODULE_STATUS_WD_UNTRACKED
64
+ "submodule workdir contains untracked files (flag available if ignore is NONE)"
@@ -0,0 +1,115 @@
1
+ # Copyright 2010-2023 The pygit2 contributors
2
+ #
3
+ # This file is free software; you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License, version 2,
5
+ # as published by the Free Software Foundation.
6
+ #
7
+ # In addition to the permissions in the GNU General Public License,
8
+ # the authors give you unlimited permission to link the compiled
9
+ # version of this file into combinations with other programs,
10
+ # and to distribute those combinations without any restriction
11
+ # coming from the use of this file. (The General Public License
12
+ # restrictions do apply in other respects; for example, they cover
13
+ # modification of the file, and distribution when not linked into
14
+ # a combined executable.)
15
+ #
16
+ # This file is distributed in the hope that it will be useful, but
17
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
+ # General Public License for more details.
20
+ #
21
+ # You should have received a copy of the GNU General Public License
22
+ # along with this program; see the file COPYING. If not, write to
23
+ # the Free Software Foundation, 51 Franklin Street, Fifth Floor,
24
+ # Boston, MA 02110-1301, USA.
25
+
26
+ from typing import Callable, List, Optional
27
+
28
+ from ._pygit2 import FilterSource
29
+
30
+
31
+ class Filter:
32
+ """
33
+ Base filter class to be used with libgit2 filters.
34
+
35
+ Inherit from this class and override the `check()`, `write()` and `close()`
36
+ methods to define a filter which can then be registered via
37
+ `pygit2.filter_register()`.
38
+
39
+ A new Filter instance will be instantiated for each stream which needs to
40
+ be filtered. For each stream, filter methods will be called in this order:
41
+
42
+ - `check()`
43
+ - `write()` (may be called multiple times)
44
+ - `close()`
45
+
46
+ Filtered output data should be written to the next filter in the chain
47
+ during `write()` and `close()` via the `write_next` method. All output data
48
+ must be written to the next filter before returning from `close()`.
49
+
50
+ If a filter is dependent on reading the complete input data stream, the
51
+ filter should only write output data in `close()`.
52
+ """
53
+
54
+ #: Space-separated string list of attributes to be used in `check()`
55
+ attributes: str = ""
56
+
57
+ @classmethod
58
+ def nattrs(cls) -> int:
59
+ return len(cls.attributes.split())
60
+
61
+ def check(self, src: FilterSource, attr_values: List[Optional[str]]):
62
+ """
63
+ Check whether this filter should be applied to the given source.
64
+
65
+ `check` will be called once per stream.
66
+
67
+ If `Passthrough` is raised, the filter will not be applied.
68
+
69
+ Parameters:
70
+
71
+ src: The source of the filtered blob.
72
+
73
+ attr_values: The values of each attribute for the blob being filtered.
74
+ `attr_values` will be a sorted list containing attributes in the
75
+ order they were defined in ``cls.attributes``.
76
+ """
77
+
78
+ def write(
79
+ self,
80
+ data: bytes,
81
+ src: FilterSource,
82
+ write_next: Callable[[bytes], None]
83
+ ):
84
+ """
85
+ Write input `data` to this filter.
86
+
87
+ `write()` may be called multiple times per stream.
88
+
89
+ Parameters:
90
+
91
+ data: Input data.
92
+
93
+ src: The source of the filtered blob.
94
+
95
+ write_next: The ``write()`` method of the next filter in the chain.
96
+ Filtered output data should be written to `write_next` whenever it is
97
+ available.
98
+ """
99
+ write_next(data)
100
+
101
+ def close(
102
+ self,
103
+ write_next: Callable[[bytes], None]
104
+ ):
105
+ """
106
+ Close this filter.
107
+
108
+ `close()` will be called once per stream whenever all writes() to this
109
+ stream have been completed.
110
+
111
+ Parameters:
112
+ write_next: The ``write()`` method of the next filter in the chain.
113
+ Any remaining filtered output data must be written to
114
+ `write_next` before returning.
115
+ """
@@ -111,7 +111,7 @@ class Remote:
111
111
  ffi.NULL)
112
112
  payload.check_error(err)
113
113
 
114
- def fetch(self, refspecs=None, message=None, callbacks=None, prune=C.GIT_FETCH_PRUNE_UNSPECIFIED, proxy=None):
114
+ def fetch(self, refspecs=None, message=None, callbacks=None, prune=C.GIT_FETCH_PRUNE_UNSPECIFIED, proxy=None, depth=0):
115
115
  """Perform a fetch against this remote. Returns a <TransferProgress>
116
116
  object.
117
117
 
@@ -130,10 +130,18 @@ class Remote:
130
130
  * `None` (the default) to disable proxy usage
131
131
  * `True` to enable automatic proxy detection
132
132
  * an url to a proxy (`http://proxy.example.org:3128/`)
133
+
134
+ depth : int
135
+ Number of commits from the tip of each remote branch history to fetch.
136
+
137
+ If non-zero, the number of commits from the tip of each remote
138
+ branch history to fetch. If zero, all history is fetched.
139
+ The default is 0 (all history is fetched).
133
140
  """
134
141
  with git_fetch_options(callbacks) as payload:
135
142
  opts = payload.fetch_options
136
143
  opts.prune = prune
144
+ opts.depth = depth
137
145
  self.__set_proxy(opts.proxy_opts, proxy)
138
146
  with StrArray(refspecs) as arr:
139
147
  err = C.git_remote_fetch(self._remote, arr, opts, to_bytes(message))