pygit2 1.15.0__tar.gz → 1.16.0__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 (190) hide show
  1. {pygit2-1.15.0 → pygit2-1.16.0}/AUTHORS.md +5 -2
  2. {pygit2-1.15.0 → pygit2-1.16.0}/CHANGELOG.md +50 -0
  3. {pygit2-1.15.0 → pygit2-1.16.0}/PKG-INFO +6 -5
  4. {pygit2-1.15.0 → pygit2-1.16.0}/README.md +1 -1
  5. pygit2-1.16.0/SPONSORS.md +12 -0
  6. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/_build.py +1 -1
  7. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/_pygit2.pyi +4 -4
  8. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/callbacks.py +6 -6
  9. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/callbacks.h +1 -1
  10. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/repository.h +1 -0
  11. pygit2-1.16.0/pygit2/decl/revert.h +21 -0
  12. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/types.h +11 -0
  13. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/enums.py +2 -2
  14. pygit2-1.16.0/pygit2/py.typed +1 -0
  15. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/repository.py +67 -1
  16. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/submodules.py +33 -8
  17. {pygit2-1.15.0 → pygit2-1.16.0}/pyproject.toml +1 -1
  18. {pygit2-1.15.0 → pygit2-1.16.0}/setup.py +6 -5
  19. {pygit2-1.15.0 → pygit2-1.16.0}/src/diff.c +1 -1
  20. {pygit2-1.15.0 → pygit2-1.16.0}/src/options.c +26 -69
  21. {pygit2-1.15.0 → pygit2-1.16.0}/src/options.h +6 -0
  22. {pygit2-1.15.0 → pygit2-1.16.0}/src/pygit2.c +28 -24
  23. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_diff.py +2 -0
  24. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_remote.py +2 -3
  25. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_repository.py +90 -1
  26. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_submodule.py +71 -6
  27. pygit2-1.15.0/SPONSORS.md +0 -11
  28. pygit2-1.15.0/pygit2/decl/revert.h +0 -7
  29. {pygit2-1.15.0 → pygit2-1.16.0}/COPYING +0 -0
  30. {pygit2-1.15.0 → pygit2-1.16.0}/Makefile +0 -0
  31. {pygit2-1.15.0 → pygit2-1.16.0}/build.sh +0 -0
  32. {pygit2-1.15.0 → pygit2-1.16.0}/build_tag.py +0 -0
  33. {pygit2-1.15.0 → pygit2-1.16.0}/mypy-stubtest.ini +0 -0
  34. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/__init__.py +0 -0
  35. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/_run.py +0 -0
  36. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/blame.py +0 -0
  37. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/blob.py +0 -0
  38. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/branches.py +0 -0
  39. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/config.py +0 -0
  40. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/credentials.py +0 -0
  41. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/attr.h +0 -0
  42. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/blame.h +0 -0
  43. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/buffer.h +0 -0
  44. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/checkout.h +0 -0
  45. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/clone.h +0 -0
  46. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/commit.h +0 -0
  47. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/common.h +0 -0
  48. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/config.h +0 -0
  49. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/describe.h +0 -0
  50. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/diff.h +0 -0
  51. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/errors.h +0 -0
  52. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/graph.h +0 -0
  53. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/index.h +0 -0
  54. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/indexer.h +0 -0
  55. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/merge.h +0 -0
  56. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/net.h +0 -0
  57. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/oid.h +0 -0
  58. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/pack.h +0 -0
  59. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/proxy.h +0 -0
  60. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/refspec.h +0 -0
  61. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/remote.h +0 -0
  62. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/stash.h +0 -0
  63. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/strarray.h +0 -0
  64. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/submodule.h +0 -0
  65. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/decl/transport.h +0 -0
  66. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/errors.py +0 -0
  67. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/ffi.py +0 -0
  68. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/filter.py +0 -0
  69. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/index.py +0 -0
  70. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/legacyenums.py +0 -0
  71. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/packbuilder.py +0 -0
  72. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/references.py +0 -0
  73. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/refspec.py +0 -0
  74. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/remotes.py +0 -0
  75. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/settings.py +0 -0
  76. {pygit2-1.15.0 → pygit2-1.16.0}/pygit2/utils.py +0 -0
  77. {pygit2-1.15.0 → pygit2-1.16.0}/pytest.ini +0 -0
  78. {pygit2-1.15.0 → pygit2-1.16.0}/requirements-test.txt +0 -0
  79. {pygit2-1.15.0 → pygit2-1.16.0}/requirements.txt +0 -0
  80. {pygit2-1.15.0 → pygit2-1.16.0}/setup.cfg +0 -0
  81. {pygit2-1.15.0 → pygit2-1.16.0}/src/blob.c +0 -0
  82. {pygit2-1.15.0 → pygit2-1.16.0}/src/branch.c +0 -0
  83. {pygit2-1.15.0 → pygit2-1.16.0}/src/branch.h +0 -0
  84. {pygit2-1.15.0 → pygit2-1.16.0}/src/commit.c +0 -0
  85. {pygit2-1.15.0 → pygit2-1.16.0}/src/diff.h +0 -0
  86. {pygit2-1.15.0 → pygit2-1.16.0}/src/error.c +0 -0
  87. {pygit2-1.15.0 → pygit2-1.16.0}/src/error.h +0 -0
  88. {pygit2-1.15.0 → pygit2-1.16.0}/src/filter.c +0 -0
  89. {pygit2-1.15.0 → pygit2-1.16.0}/src/filter.h +0 -0
  90. {pygit2-1.15.0 → pygit2-1.16.0}/src/mailmap.c +0 -0
  91. {pygit2-1.15.0 → pygit2-1.16.0}/src/mailmap.h +0 -0
  92. {pygit2-1.15.0 → pygit2-1.16.0}/src/note.c +0 -0
  93. {pygit2-1.15.0 → pygit2-1.16.0}/src/note.h +0 -0
  94. {pygit2-1.15.0 → pygit2-1.16.0}/src/object.c +0 -0
  95. {pygit2-1.15.0 → pygit2-1.16.0}/src/object.h +0 -0
  96. {pygit2-1.15.0 → pygit2-1.16.0}/src/odb.c +0 -0
  97. {pygit2-1.15.0 → pygit2-1.16.0}/src/odb.h +0 -0
  98. {pygit2-1.15.0 → pygit2-1.16.0}/src/odb_backend.c +0 -0
  99. {pygit2-1.15.0 → pygit2-1.16.0}/src/odb_backend.h +0 -0
  100. {pygit2-1.15.0 → pygit2-1.16.0}/src/oid.c +0 -0
  101. {pygit2-1.15.0 → pygit2-1.16.0}/src/oid.h +0 -0
  102. {pygit2-1.15.0 → pygit2-1.16.0}/src/patch.c +0 -0
  103. {pygit2-1.15.0 → pygit2-1.16.0}/src/patch.h +0 -0
  104. {pygit2-1.15.0 → pygit2-1.16.0}/src/refdb.c +0 -0
  105. {pygit2-1.15.0 → pygit2-1.16.0}/src/refdb.h +0 -0
  106. {pygit2-1.15.0 → pygit2-1.16.0}/src/refdb_backend.c +0 -0
  107. {pygit2-1.15.0 → pygit2-1.16.0}/src/refdb_backend.h +0 -0
  108. {pygit2-1.15.0 → pygit2-1.16.0}/src/reference.c +0 -0
  109. {pygit2-1.15.0 → pygit2-1.16.0}/src/reference.h +0 -0
  110. {pygit2-1.15.0 → pygit2-1.16.0}/src/repository.c +0 -0
  111. {pygit2-1.15.0 → pygit2-1.16.0}/src/repository.h +0 -0
  112. {pygit2-1.15.0 → pygit2-1.16.0}/src/revspec.c +0 -0
  113. {pygit2-1.15.0 → pygit2-1.16.0}/src/revspec.h +0 -0
  114. {pygit2-1.15.0 → pygit2-1.16.0}/src/signature.c +0 -0
  115. {pygit2-1.15.0 → pygit2-1.16.0}/src/signature.h +0 -0
  116. {pygit2-1.15.0 → pygit2-1.16.0}/src/stash.c +0 -0
  117. {pygit2-1.15.0 → pygit2-1.16.0}/src/tag.c +0 -0
  118. {pygit2-1.15.0 → pygit2-1.16.0}/src/tree.c +0 -0
  119. {pygit2-1.15.0 → pygit2-1.16.0}/src/tree.h +0 -0
  120. {pygit2-1.15.0 → pygit2-1.16.0}/src/treebuilder.c +0 -0
  121. {pygit2-1.15.0 → pygit2-1.16.0}/src/treebuilder.h +0 -0
  122. {pygit2-1.15.0 → pygit2-1.16.0}/src/types.h +0 -0
  123. {pygit2-1.15.0 → pygit2-1.16.0}/src/utils.c +0 -0
  124. {pygit2-1.15.0 → pygit2-1.16.0}/src/utils.h +0 -0
  125. {pygit2-1.15.0 → pygit2-1.16.0}/src/walker.c +0 -0
  126. {pygit2-1.15.0 → pygit2-1.16.0}/src/walker.h +0 -0
  127. {pygit2-1.15.0 → pygit2-1.16.0}/src/wildmatch.c +0 -0
  128. {pygit2-1.15.0 → pygit2-1.16.0}/src/wildmatch.h +0 -0
  129. {pygit2-1.15.0 → pygit2-1.16.0}/src/worktree.c +0 -0
  130. {pygit2-1.15.0 → pygit2-1.16.0}/src/worktree.h +0 -0
  131. {pygit2-1.15.0 → pygit2-1.16.0}/test/__init__.py +0 -0
  132. {pygit2-1.15.0 → pygit2-1.16.0}/test/conftest.py +0 -0
  133. {pygit2-1.15.0 → pygit2-1.16.0}/test/data/barerepo.zip +0 -0
  134. {pygit2-1.15.0 → pygit2-1.16.0}/test/data/binaryfilerepo.zip +0 -0
  135. {pygit2-1.15.0 → pygit2-1.16.0}/test/data/blameflagsrepo.zip +0 -0
  136. {pygit2-1.15.0 → pygit2-1.16.0}/test/data/dirtyrepo.zip +0 -0
  137. {pygit2-1.15.0 → pygit2-1.16.0}/test/data/emptyrepo.zip +0 -0
  138. {pygit2-1.15.0 → pygit2-1.16.0}/test/data/encoding.zip +0 -0
  139. {pygit2-1.15.0 → pygit2-1.16.0}/test/data/gpgsigned.zip +0 -0
  140. {pygit2-1.15.0 → pygit2-1.16.0}/test/data/submodulerepo.zip +0 -0
  141. {pygit2-1.15.0 → pygit2-1.16.0}/test/data/testrepo.zip +0 -0
  142. {pygit2-1.15.0 → pygit2-1.16.0}/test/data/testrepoformerging.zip +0 -0
  143. {pygit2-1.15.0 → pygit2-1.16.0}/test/data/testrepopacked.zip +0 -0
  144. {pygit2-1.15.0 → pygit2-1.16.0}/test/data/trailerrepo.zip +0 -0
  145. {pygit2-1.15.0 → pygit2-1.16.0}/test/data/utf8branchrepo.zip +0 -0
  146. {pygit2-1.15.0 → pygit2-1.16.0}/test/keys/pygit2_empty +0 -0
  147. {pygit2-1.15.0 → pygit2-1.16.0}/test/keys/pygit2_empty.pub +0 -0
  148. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_apply_diff.py +0 -0
  149. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_archive.py +0 -0
  150. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_attributes.py +0 -0
  151. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_blame.py +0 -0
  152. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_blob.py +0 -0
  153. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_branch.py +0 -0
  154. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_branch_empty.py +0 -0
  155. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_cherrypick.py +0 -0
  156. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_commit.py +0 -0
  157. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_commit_gpg.py +0 -0
  158. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_commit_trailer.py +0 -0
  159. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_config.py +0 -0
  160. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_credentials.py +0 -0
  161. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_describe.py +0 -0
  162. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_diff_binary.py +0 -0
  163. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_filter.py +0 -0
  164. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_index.py +0 -0
  165. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_mailmap.py +0 -0
  166. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_merge.py +0 -0
  167. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_note.py +0 -0
  168. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_object.py +0 -0
  169. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_odb.py +0 -0
  170. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_odb_backend.py +0 -0
  171. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_oid.py +0 -0
  172. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_options.py +0 -0
  173. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_packbuilder.py +0 -0
  174. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_patch.py +0 -0
  175. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_patch_encoding.py +0 -0
  176. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_refdb_backend.py +0 -0
  177. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_refs.py +0 -0
  178. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_remote_prune.py +0 -0
  179. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_remote_utf8.py +0 -0
  180. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_repository_bare.py +0 -0
  181. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_repository_custom.py +0 -0
  182. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_repository_empty.py +0 -0
  183. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_revparse.py +0 -0
  184. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_revwalk.py +0 -0
  185. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_signature.py +0 -0
  186. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_status.py +0 -0
  187. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_tag.py +0 -0
  188. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_tree.py +0 -0
  189. {pygit2-1.15.0 → pygit2-1.16.0}/test/test_treebuilder.py +0 -0
  190. {pygit2-1.15.0 → pygit2-1.16.0}/test/utils.py +0 -0
@@ -50,6 +50,7 @@ Authors:
50
50
  Dan Sully
51
51
  David Versmisse
52
52
  Grégory Herrero
53
+ Michał Kępień
53
54
  Mikhail Yushkovskiy
54
55
  Robin Stocker
55
56
  Rohit Sanjay
@@ -72,7 +73,6 @@ Authors:
72
73
  Jason Ziglar
73
74
  Leonardo Rhodes
74
75
  Mark Adams
75
- Michał Kępień
76
76
  Nika Layzell
77
77
  Peter-Yi Zhang
78
78
  Petr Viktorin
@@ -113,6 +113,7 @@ Authors:
113
113
  Kevin KIN-FOO
114
114
  Marcel Waldvogel
115
115
  Masud Rahman
116
+ Mathieu Parent
116
117
  Michael Sondergaard
117
118
  Natanael Arndt
118
119
  Ondřej Nový
@@ -184,16 +185,17 @@ Authors:
184
185
  Lukas Berk
185
186
  Martin von Zweigbergk
186
187
  Mathieu Bridon
187
- Mathieu Parent
188
188
  Mathieu Pillard
189
189
  Matthaus Woolard
190
190
  Maxwell G
191
191
  Michał Górny
192
+ Na'aman Hirschfeld
192
193
  Nicolás Sanguinetti
193
194
  Nikita Kartashov
194
195
  Nikolai Zujev
195
196
  Nils Philippsen
196
197
  Noah Fontes
198
+ Or Hayat
197
199
  Óscar San José
198
200
  Patrick Lühne
199
201
  Paul Wagland
@@ -215,6 +217,7 @@ Authors:
215
217
  Steven Winfield
216
218
  Tad Hardesty
217
219
  Timo Röhling
220
+ Victor Florea
218
221
  Vladimir Rutsky
219
222
  Wim Jeantine-Glenn
220
223
  Yu Jianjian
@@ -1,3 +1,53 @@
1
+ # 1.16.0 (2024-10-11)
2
+
3
+ - Add support for Python 3.13
4
+
5
+ - Drop support for Python 3.9
6
+
7
+ - New `Repository.hashfile(...)`
8
+ [#1298](https://github.com/libgit2/pygit2/pull/1298)
9
+
10
+ - New `Option.GET_MWINDOW_FILE_LIMIT` and `Option.SET_MWINDOW_FILE_LIMIT`
11
+ [#1312](https://github.com/libgit2/pygit2/pull/1312)
12
+
13
+ - Fix overriding `certificate_check(...)` callback via argument to `RemoteCallbacks(...)`
14
+ [#1321](https://github.com/libgit2/pygit2/pull/1321)
15
+
16
+ - Add py.typed
17
+ [#1310](https://github.com/libgit2/pygit2/pull/1310)
18
+
19
+ - Fix `discover_repository(...)` annotation
20
+ [#1313](https://github.com/libgit2/pygit2/pull/1313)
21
+
22
+
23
+ # 1.15.1 (2024-07-07)
24
+
25
+ - New `Repository.revert(...)`
26
+ [#1297](https://github.com/libgit2/pygit2/pull/1297)
27
+
28
+ - New optional `depth` argument in submodules `add()` and `update()` methods
29
+ [#1296](https://github.com/libgit2/pygit2/pull/1296)
30
+
31
+ - Now `Submodule.url` returns `None` when the submodule does not have a url
32
+ [#1294](https://github.com/libgit2/pygit2/pull/1294)
33
+
34
+ - Fix use after free bug in error reporting
35
+ [#1299](https://github.com/libgit2/pygit2/pull/1299)
36
+
37
+ - Fix `Submodule.head_id` when the submodule is not in the current HEAD tree
38
+ [#1300](https://github.com/libgit2/pygit2/pull/1300)
39
+
40
+ - Fix `Submodule.open()` when subclassing `Repository`
41
+ [#1295](https://github.com/libgit2/pygit2/pull/1295)
42
+
43
+ - Fix error in the test suite when running with address sanitizer
44
+ [#1304](https://github.com/libgit2/pygit2/pull/1304)
45
+ [#1301](https://github.com/libgit2/pygit2/issues/1301)
46
+
47
+ - Annotations and documentation fixes
48
+ [#1293](https://github.com/libgit2/pygit2/pull/1293)
49
+
50
+
1
51
  # 1.15.0 (2024-05-18)
2
52
 
3
53
  - Many deprecated features have been removed, see below
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pygit2
3
- Version: 1.15.0
3
+ Version: 1.16.0
4
4
  Summary: Python bindings for libgit2.
5
5
  Home-page: https://github.com/libgit2/pygit2
6
6
  Maintainer: J. David Ibáñez
@@ -14,23 +14,24 @@ Classifier: Development Status :: 5 - Production/Stable
14
14
  Classifier: Intended Audience :: Developers
15
15
  Classifier: Programming Language :: Python
16
16
  Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.9
18
17
  Classifier: Programming Language :: Python :: 3.10
19
18
  Classifier: Programming Language :: Python :: 3.11
20
19
  Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
21
  Classifier: Programming Language :: Python :: Implementation :: PyPy
22
22
  Classifier: Programming Language :: Python :: Implementation :: CPython
23
23
  Classifier: Topic :: Software Development :: Version Control
24
- Requires-Python: >=3.9
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.10
25
26
  Description-Content-Type: text/markdown
26
27
  License-File: COPYING
27
28
  License-File: AUTHORS.md
28
- Requires-Dist: cffi>=1.16.0
29
+ Requires-Dist: cffi>=1.17.0
29
30
 
30
31
  # pygit2 - libgit2 bindings in Python
31
32
 
32
33
  Bindings to the libgit2 shared library, implements Git plumbing.
33
- Supports Python 3.9 to 3.12 and PyPy3 7.3+
34
+ Supports Python 3.10 to 3.13 and PyPy3 7.3+
34
35
 
35
36
  [![image](https://github.com/libgit2/pygit2/actions/workflows/tests.yml/badge.svg)](https://github.com/libgit2/pygit2/actions/workflows/tests.yml)
36
37
 
@@ -1,7 +1,7 @@
1
1
  # pygit2 - libgit2 bindings in Python
2
2
 
3
3
  Bindings to the libgit2 shared library, implements Git plumbing.
4
- Supports Python 3.9 to 3.12 and PyPy3 7.3+
4
+ Supports Python 3.10 to 3.13 and PyPy3 7.3+
5
5
 
6
6
  [![image](https://github.com/libgit2/pygit2/actions/workflows/tests.yml/badge.svg)](https://github.com/libgit2/pygit2/actions/workflows/tests.yml)
7
7
 
@@ -0,0 +1,12 @@
1
+ Friends of pygit2:
2
+
3
+ - Add your name to the list,
4
+ [become a friend of pygit2](https://github.com/sponsors/jdavid).
5
+
6
+ Past sponsors:
7
+
8
+ - [Microsoft](https://github.com/microsoft)
9
+ - [Iterative](https://iterative.ai/)
10
+ - [SourceHut](https://sourcehut.org)
11
+ - [GitHub](https://github.com/github)
12
+ - [omniproc](https://github.com/omniproc)
@@ -34,7 +34,7 @@ from pathlib import Path
34
34
  #
35
35
  # The version number of pygit2
36
36
  #
37
- __version__ = '1.15.0'
37
+ __version__ = '1.16.0'
38
38
 
39
39
 
40
40
  #
@@ -1,15 +1,15 @@
1
1
  from typing import Iterator, Literal, Optional, overload
2
2
  from io import IOBase
3
- from . import Index, Submodule
3
+ from . import Index
4
4
  from .enums import (
5
5
  ApplyLocation,
6
6
  BranchType,
7
+ DeltaStatus,
7
8
  DiffFind,
8
9
  DiffFlag,
9
10
  DiffOption,
10
11
  DiffStatsFormat,
11
12
  FileMode,
12
- FileStatus,
13
13
  MergeAnalysis,
14
14
  MergePreference,
15
15
  ObjectType,
@@ -171,7 +171,7 @@ class DiffDelta:
171
171
  new_file: DiffFile
172
172
  old_file: DiffFile
173
173
  similarity: int
174
- status: FileStatus
174
+ status: DeltaStatus
175
175
  def status_char(self) -> str: ...
176
176
 
177
177
  class DiffFile:
@@ -558,7 +558,7 @@ class Worktree:
558
558
 
559
559
  def discover_repository(
560
560
  path: str, across_fs: bool = False, ceiling_dirs: str = ...
561
- ) -> str: ...
561
+ ) -> str | None: ...
562
562
  def hash(data: bytes) -> Oid: ...
563
563
  def hashfile(path: str) -> Oid: ...
564
564
  def init_file_backend(path: str, flags: int = 0) -> object: ...
@@ -113,12 +113,12 @@ class RemoteCallbacks(Payload):
113
113
  RemoteCallbacks(certificate=certificate).
114
114
  """
115
115
 
116
- def __init__(self, credentials=None, certificate=None):
116
+ def __init__(self, credentials=None, certificate_check=None):
117
117
  super().__init__()
118
118
  if credentials is not None:
119
119
  self.credentials = credentials
120
- if certificate is not None:
121
- self.certificate = certificate
120
+ if certificate_check is not None:
121
+ self.certificate_check = certificate_check
122
122
 
123
123
  def sideband_progress(self, string):
124
124
  """
@@ -344,7 +344,7 @@ def git_fetch_options(payload, opts=None):
344
344
  opts.callbacks.transfer_progress = C._transfer_progress_cb
345
345
  opts.callbacks.update_tips = C._update_tips_cb
346
346
  opts.callbacks.credentials = C._credentials_cb
347
- opts.callbacks.certificate_check = C._certificate_cb
347
+ opts.callbacks.certificate_check = C._certificate_check_cb
348
348
  # Payload
349
349
  handle = ffi.new_handle(payload)
350
350
  opts.callbacks.payload = handle
@@ -368,7 +368,7 @@ def git_push_options(payload, opts=None):
368
368
  opts.callbacks.transfer_progress = C._transfer_progress_cb
369
369
  opts.callbacks.update_tips = C._update_tips_cb
370
370
  opts.callbacks.credentials = C._credentials_cb
371
- opts.callbacks.certificate_check = C._certificate_cb
371
+ opts.callbacks.certificate_check = C._certificate_check_cb
372
372
  opts.callbacks.push_update_reference = C._push_update_reference_cb
373
373
  # Payload
374
374
  handle = ffi.new_handle(payload)
@@ -457,7 +457,7 @@ def libgit2_callback_void(f):
457
457
 
458
458
 
459
459
  @libgit2_callback
460
- def _certificate_cb(cert_i, valid, host, data):
460
+ def _certificate_check_cb(cert_i, valid, host, data):
461
461
  # We want to simulate what should happen if libgit2 supported pass-through
462
462
  # for this callback. For SSH, 'valid' is always False, because it doesn't
463
463
  # look at known_hosts, but we do want to let it through in order to do what
@@ -1,4 +1,4 @@
1
- extern "Python" int _certificate_cb(
1
+ extern "Python" int _certificate_check_cb(
2
2
  git_cert *cert,
3
3
  int valid,
4
4
  const char *host,
@@ -83,6 +83,7 @@ int git_repository_set_head_detached(
83
83
  git_repository* repo,
84
84
  const git_oid* commitish);
85
85
 
86
+ int git_repository_hashfile(git_oid *out, git_repository *repo, const char *path, git_object_t type, const char *as_path);
86
87
  int git_repository_ident(const char **name, const char **email, const git_repository *repo);
87
88
  int git_repository_set_ident(git_repository *repo, const char *name, const char *email);
88
89
  int git_repository_index(git_index **out, git_repository *repo);
@@ -0,0 +1,21 @@
1
+ #define GIT_REVERT_OPTIONS_VERSION ...
2
+
3
+ typedef struct {
4
+ unsigned int version;
5
+ unsigned int mainline;
6
+ git_merge_options merge_opts;
7
+ git_checkout_options checkout_opts;
8
+ } git_revert_options;
9
+
10
+ int git_revert(
11
+ git_repository *repo,
12
+ git_commit *commit,
13
+ const git_revert_options *given_opts);
14
+
15
+ int git_revert_commit(
16
+ git_index **out,
17
+ git_repository *repo,
18
+ git_commit *revert_commit,
19
+ git_commit *our_commit,
20
+ unsigned int mainline,
21
+ const git_merge_options *merge_options);
@@ -57,3 +57,14 @@ typedef enum {
57
57
  GIT_SUBMODULE_IGNORE_DIRTY = 3,
58
58
  GIT_SUBMODULE_IGNORE_ALL = 4,
59
59
  } git_submodule_ignore_t;
60
+
61
+ typedef enum {
62
+ GIT_OBJECT_ANY = ...,
63
+ GIT_OBJECT_INVALID = ...,
64
+ GIT_OBJECT_COMMIT = ...,
65
+ GIT_OBJECT_TREE = ...,
66
+ GIT_OBJECT_BLOB = ...,
67
+ GIT_OBJECT_TAG = ...,
68
+ GIT_OBJECT_OFS_DELTA = ...,
69
+ GIT_OBJECT_REF_DELTA = ...,
70
+ } git_object_t;
@@ -979,8 +979,8 @@ class Option(IntEnum):
979
979
  SET_PACK_MAX_OBJECTS = _pygit2.GIT_OPT_SET_PACK_MAX_OBJECTS
980
980
  DISABLE_PACK_KEEP_FILE_CHECKS = _pygit2.GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS
981
981
  # ENABLE_HTTP_EXPECT_CONTINUE = _pygit2.GIT_OPT_ENABLE_HTTP_EXPECT_CONTINUE
982
- # GET_MWINDOW_FILE_LIMIT = _pygit2.GIT_OPT_GET_MWINDOW_FILE_LIMIT
983
- # SET_MWINDOW_FILE_LIMIT = _pygit2.GIT_OPT_SET_MWINDOW_FILE_LIMIT
982
+ GET_MWINDOW_FILE_LIMIT = _pygit2.GIT_OPT_GET_MWINDOW_FILE_LIMIT
983
+ SET_MWINDOW_FILE_LIMIT = _pygit2.GIT_OPT_SET_MWINDOW_FILE_LIMIT
984
984
  # SET_ODB_PACKED_PRIORITY = _pygit2.GIT_OPT_SET_ODB_PACKED_PRIORITY
985
985
  # SET_ODB_LOOSE_PRIORITY = _pygit2.GIT_OPT_SET_ODB_LOOSE_PRIORITY
986
986
  # GET_EXTENSIONS = _pygit2.GIT_OPT_GET_EXTENSIONS
@@ -0,0 +1 @@
1
+ # python type marker, see: https://peps.python.org/pep-0561/
@@ -51,6 +51,7 @@ from .enums import (
51
51
  MergeFavor,
52
52
  MergeFileFlag,
53
53
  MergeFlag,
54
+ ObjectType,
54
55
  RepositoryOpenFlag,
55
56
  RepositoryState,
56
57
  )
@@ -129,6 +130,58 @@ class BaseRepository(_Repository):
129
130
 
130
131
  return builder.written_objects_count
131
132
 
133
+ def hashfile(
134
+ self,
135
+ path: str,
136
+ object_type: ObjectType = ObjectType.BLOB,
137
+ as_path: typing.Optional[str] = None,
138
+ ):
139
+ """Calculate the hash of a file using repository filtering rules.
140
+
141
+ If you simply want to calculate the hash of a file on disk with no filters,
142
+ you can just use `pygit2.hashfile()`. However, if you want to hash a file
143
+ in the repository and you want to apply filtering rules (e.g. crlf filters)
144
+ before generating the SHA, then use this function.
145
+
146
+ Note: if the repository has `core.safecrlf` set to fail and the filtering
147
+ triggers that failure, then this function will raise an error and not
148
+ calculate the hash of the file.
149
+
150
+ Returns: Output value of calculated SHA (Oid)
151
+
152
+ Parameters:
153
+
154
+ path
155
+ Path to file on disk whose contents should be hashed. This may be
156
+ an absolute path or a relative path, in which case it will be treated
157
+ as a path within the working directory.
158
+
159
+ object_type
160
+ The object type to hash (e.g. enums.ObjectType.BLOB)
161
+
162
+ as_path
163
+ The path to use to look up filtering rules. If this is an empty string
164
+ then no filters will be applied when calculating the hash.
165
+ If this is `None` and the `path` parameter is a file within the
166
+ repository's working directory, then the `path` will be used.
167
+ """
168
+ c_path = to_bytes(path)
169
+
170
+ if as_path is None:
171
+ c_as_path = ffi.NULL
172
+ else:
173
+ c_as_path = to_bytes(as_path)
174
+
175
+ c_oid = ffi.new('git_oid *')
176
+
177
+ err = C.git_repository_hashfile(
178
+ c_oid, self._repo, c_path, int(object_type), c_as_path
179
+ )
180
+ check_error(err)
181
+
182
+ oid = Oid(raw=bytes(ffi.buffer(c_oid.id)[:]))
183
+ return oid
184
+
132
185
  def __iter__(self):
133
186
  return iter(self.odb)
134
187
 
@@ -1343,6 +1396,19 @@ class BaseRepository(_Repository):
1343
1396
  err = C.git_repository_set_ident(self._repo, to_bytes(name), to_bytes(email))
1344
1397
  check_error(err)
1345
1398
 
1399
+ def revert(self, commit: Commit):
1400
+ """
1401
+ Revert the given commit, producing changes in the index and working
1402
+ directory.
1403
+
1404
+ This operation updates the repository's state and prepared message
1405
+ (MERGE_MSG).
1406
+ """
1407
+ commit_ptr = ffi.new('git_commit **')
1408
+ ffi.buffer(commit_ptr)[:] = commit._pointer[:]
1409
+ err = C.git_revert(self._repo, commit_ptr[0], ffi.NULL)
1410
+ check_error(err)
1411
+
1346
1412
  def revert_commit(self, revert_commit, our_commit, mainline=0):
1347
1413
  """
1348
1414
  Revert the given Commit against the given "our" Commit, producing an
@@ -1548,6 +1614,6 @@ class Repository(BaseRepository):
1548
1614
  cptr = ffi.new('git_repository **')
1549
1615
  cptr[0] = ptr
1550
1616
  repo = cls.__new__(cls)
1551
- super(cls, repo)._from_c(bytes(ffi.buffer(cptr)[:]), owned)
1617
+ BaseRepository._from_c(repo, bytes(ffi.buffer(cptr)[:]), owned)
1552
1618
  repo._common_init()
1553
1619
  return repo
@@ -31,7 +31,7 @@ from .callbacks import git_fetch_options, RemoteCallbacks
31
31
  from .enums import SubmoduleIgnore, SubmoduleStatus
32
32
  from .errors import check_error
33
33
  from .ffi import ffi, C
34
- from .utils import to_bytes
34
+ from .utils import to_bytes, maybe_string
35
35
 
36
36
  # Need BaseRepository for type hints, but don't let it cause a circular dependency
37
37
  if TYPE_CHECKING:
@@ -73,7 +73,9 @@ class Submodule:
73
73
  err = C.git_submodule_init(self._subm, int(overwrite))
74
74
  check_error(err)
75
75
 
76
- def update(self, init: bool = False, callbacks: RemoteCallbacks = None):
76
+ def update(
77
+ self, init: bool = False, callbacks: RemoteCallbacks = None, depth: int = 0
78
+ ):
77
79
  """
78
80
  Update a submodule. This will clone a missing submodule and checkout
79
81
  the subrepository to the commit specified in the index of the
@@ -90,12 +92,17 @@ class Submodule:
90
92
 
91
93
  callbacks
92
94
  Optional RemoteCallbacks to clone or fetch the submodule.
95
+
96
+ depth
97
+ Number of commits to fetch.
98
+ The default is 0 (full commit history).
93
99
  """
94
100
 
95
101
  opts = ffi.new('git_submodule_update_options *')
96
102
  C.git_submodule_update_options_init(
97
103
  opts, C.GIT_SUBMODULE_UPDATE_OPTIONS_VERSION
98
104
  )
105
+ opts.fetch_opts.depth = depth
99
106
 
100
107
  with git_fetch_options(callbacks, opts=opts.fetch_opts) as payload:
101
108
  err = C.git_submodule_update(self._subm, int(init), opts)
@@ -129,10 +136,10 @@ class Submodule:
129
136
  return ffi.string(path).decode('utf-8')
130
137
 
131
138
  @property
132
- def url(self):
139
+ def url(self) -> Union[str, None]:
133
140
  """URL of the submodule."""
134
141
  url = C.git_submodule_url(self._subm)
135
- return ffi.string(url).decode('utf-8')
142
+ return maybe_string(url)
136
143
 
137
144
  @property
138
145
  def branch(self):
@@ -141,10 +148,17 @@ class Submodule:
141
148
  return ffi.string(branch).decode('utf-8')
142
149
 
143
150
  @property
144
- def head_id(self):
145
- """Head of the submodule."""
151
+ def head_id(self) -> Union[Oid, None]:
152
+ """
153
+ The submodule's HEAD commit id (as recorded in the superproject's
154
+ current HEAD tree).
155
+ Returns None if the superproject's HEAD doesn't contain the submodule.
156
+ """
157
+
146
158
  head = C.git_submodule_head_id(self._subm)
147
- return Oid(raw=bytes(ffi.buffer(head)[:]))
159
+ if head == ffi.NULL:
160
+ return None
161
+ return Oid(raw=bytes(ffi.buffer(head.id)[:]))
148
162
 
149
163
 
150
164
  class SubmoduleCollection:
@@ -188,6 +202,7 @@ class SubmoduleCollection:
188
202
  path: str,
189
203
  link: bool = True,
190
204
  callbacks: Optional[RemoteCallbacks] = None,
205
+ depth: int = 0,
191
206
  ) -> Submodule:
192
207
  """
193
208
  Add a submodule to the index.
@@ -208,6 +223,10 @@ class SubmoduleCollection:
208
223
 
209
224
  callbacks
210
225
  Optional RemoteCallbacks to clone the submodule.
226
+
227
+ depth
228
+ Number of commits to fetch.
229
+ The default is 0 (full commit history).
211
230
  """
212
231
  csub = ffi.new('git_submodule **')
213
232
  curl = ffi.new('char[]', to_bytes(url))
@@ -226,6 +245,7 @@ class SubmoduleCollection:
226
245
  C.git_submodule_update_options_init(
227
246
  opts, C.GIT_SUBMODULE_UPDATE_OPTIONS_VERSION
228
247
  )
248
+ opts.fetch_opts.depth = depth
229
249
 
230
250
  with git_fetch_options(callbacks, opts=opts.fetch_opts) as payload:
231
251
  crepo = ffi.new('git_repository **')
@@ -268,6 +288,7 @@ class SubmoduleCollection:
268
288
  submodules: Optional[Iterable[str]] = None,
269
289
  init: bool = False,
270
290
  callbacks: Optional[RemoteCallbacks] = None,
291
+ depth: int = 0,
271
292
  ):
272
293
  """
273
294
  Update submodules. This will clone a missing submodule and checkout
@@ -289,6 +310,10 @@ class SubmoduleCollection:
289
310
 
290
311
  callbacks
291
312
  Optional RemoteCallbacks to clone or fetch the submodule.
313
+
314
+ depth
315
+ Number of commits to fetch.
316
+ The default is 0 (full commit history).
292
317
  """
293
318
  if submodules is None:
294
319
  submodules = self._repository.listall_submodules()
@@ -296,7 +321,7 @@ class SubmoduleCollection:
296
321
  instances = [self[s] for s in submodules]
297
322
 
298
323
  for submodule in instances:
299
- submodule.update(init, callbacks)
324
+ submodule.update(init, callbacks, depth)
300
325
 
301
326
  def status(
302
327
  self, name: str, ignore: SubmoduleIgnore = SubmoduleIgnore.UNSPECIFIED
@@ -25,7 +25,7 @@ environment = {LIBGIT2_VERSION="1.8.1", LIBSSH2_VERSION="1.11.0", OPENSSL_VERSIO
25
25
  repair-wheel-command = "DYLD_LIBRARY_PATH=/Users/runner/work/pygit2/pygit2/ci/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}"
26
26
 
27
27
  [tool.ruff]
28
- target-version = "py39" # oldest supported Python version
28
+ target-version = "py310" # oldest supported Python version
29
29
  fix = true
30
30
  extend-exclude = [
31
31
  ".cache",
@@ -75,13 +75,14 @@ classifiers = [
75
75
  'Intended Audience :: Developers',
76
76
  'Programming Language :: Python',
77
77
  'Programming Language :: Python :: 3',
78
- 'Programming Language :: Python :: 3.9',
79
78
  'Programming Language :: Python :: 3.10',
80
79
  'Programming Language :: Python :: 3.11',
81
80
  'Programming Language :: Python :: 3.12',
81
+ 'Programming Language :: Python :: 3.13',
82
82
  'Programming Language :: Python :: Implementation :: PyPy',
83
83
  'Programming Language :: Python :: Implementation :: CPython',
84
84
  'Topic :: Software Development :: Version Control',
85
+ 'Typing :: Typed',
85
86
  ]
86
87
 
87
88
  __dir__ = Path(__file__).parent
@@ -144,15 +145,15 @@ setup(
144
145
  long_description=long_description,
145
146
  long_description_content_type='text/markdown',
146
147
  packages=['pygit2'],
147
- package_data={'pygit2': ['decl/*.h', '*.pyi']},
148
+ package_data={'pygit2': ['decl/*.h', '*.pyi', 'py.typed']},
148
149
  zip_safe=False,
149
150
  cmdclass=cmdclass,
150
151
  cffi_modules=['pygit2/_run.py:ffi'],
151
152
  ext_modules=ext_modules,
152
153
  # Requirements
153
- python_requires='>=3.9',
154
- setup_requires=['cffi>=1.16.0'],
155
- install_requires=['cffi>=1.16.0'],
154
+ python_requires='>=3.10',
155
+ setup_requires=['cffi>=1.17.0'],
156
+ install_requires=['cffi>=1.17.0'],
156
157
  # URLs
157
158
  url='https://github.com/libgit2/pygit2',
158
159
  project_urls={
@@ -323,7 +323,7 @@ DiffDelta_is_binary__get__(DiffDelta *self)
323
323
  }
324
324
 
325
325
  PyDoc_STRVAR(DiffDelta_status__doc__,
326
- "An enums.FileStatus constant."
326
+ "An enums.DeltaStatus constant."
327
327
  );
328
328
 
329
329
  PyObject *