gitoxide-py 0.87.0__cp39-abi3-win_amd64.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.
- gitoxide_py/__init__.py +5 -0
- gitoxide_py/__init__.pyi +664 -0
- gitoxide_py/gitoxide_py.pyd +0 -0
- gitoxide_py/py.typed +0 -0
- gitoxide_py-0.87.0.dist-info/METADATA +124 -0
- gitoxide_py-0.87.0.dist-info/RECORD +9 -0
- gitoxide_py-0.87.0.dist-info/WHEEL +4 -0
- gitoxide_py-0.87.0.dist-info/licenses/LICENSE +24 -0
- gitoxide_py-0.87.0.dist-info/sboms/gitoxide-py.cyclonedx.json +5483 -0
gitoxide_py/__init__.py
ADDED
gitoxide_py/__init__.pyi
ADDED
|
@@ -0,0 +1,664 @@
|
|
|
1
|
+
"""
|
|
2
|
+
PyO3 bindings to gitoxide (`gix`), aiming for close naming parity with
|
|
3
|
+
`gix`'s own Rust API (`open`/`discover`/`init`, `git_dir`/`workdir`,
|
|
4
|
+
`head_id`/`head_commit`, `rev_parse_single`, `rev_walk`, ...).
|
|
5
|
+
|
|
6
|
+
## GIL handling
|
|
7
|
+
|
|
8
|
+
Every method releases the GIL for the duration of its gix work via
|
|
9
|
+
`Python::detach`. `detach`'s bound requires the closure (and everything
|
|
10
|
+
it captures) to be `Send`. `gix::Repository` (the thread-local handle)
|
|
11
|
+
is *not* `Sync` — it carries a `RefCell`-backed object/pack cache — so a
|
|
12
|
+
`&gix::Repository` capture can never satisfy that bound, `unsendable`
|
|
13
|
+
pyclass or not.
|
|
14
|
+
|
|
15
|
+
`gix::ThreadSafeRepository` is gix's own answer to this: a cheap,
|
|
16
|
+
`Send + Sync` handle with no local cache, meant to be shared across
|
|
17
|
+
threads and turned into a `gix::Repository` per unit of work via
|
|
18
|
+
`to_thread_local()`. `Repository` here stores a `ThreadSafeRepository`
|
|
19
|
+
and calls `to_thread_local()` *inside* each `detach` closure, so the
|
|
20
|
+
closure only ever captures `Send` data and the actual gix work runs
|
|
21
|
+
GIL-free.
|
|
22
|
+
|
|
23
|
+
## Layout
|
|
24
|
+
|
|
25
|
+
The Python-visible surface is assembled here out of items defined in
|
|
26
|
+
sibling Rust modules: `repository` holds the `Repository` handle and the
|
|
27
|
+
functions that open one, `types` the value objects its methods return,
|
|
28
|
+
and `util` the conversions both share.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
from collections.abc import Sequence
|
|
32
|
+
from os import PathLike
|
|
33
|
+
from pathlib import Path
|
|
34
|
+
from typing import final
|
|
35
|
+
|
|
36
|
+
@final
|
|
37
|
+
class Branch:
|
|
38
|
+
def __repr__(self, /) -> str: ...
|
|
39
|
+
@property
|
|
40
|
+
def full_name(self, /) -> str:
|
|
41
|
+
"""
|
|
42
|
+
The full ref name, e.g. `refs/heads/main`.
|
|
43
|
+
"""
|
|
44
|
+
@property
|
|
45
|
+
def is_remote(self, /) -> bool: ...
|
|
46
|
+
@property
|
|
47
|
+
def name(self, /) -> str:
|
|
48
|
+
"""
|
|
49
|
+
The branch name without its category prefix, e.g. `main` or
|
|
50
|
+
`origin/main`.
|
|
51
|
+
"""
|
|
52
|
+
@property
|
|
53
|
+
def target(self, /) -> str |None: ...
|
|
54
|
+
@property
|
|
55
|
+
def upstream(self, /) -> str |None:
|
|
56
|
+
"""
|
|
57
|
+
The shorthand of the remote-tracking branch this one is configured to
|
|
58
|
+
fetch from, e.g. `origin/main`, or `None` when unconfigured.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
@final
|
|
62
|
+
class Commit:
|
|
63
|
+
def __eq__(self, other: object, /) -> bool: ...
|
|
64
|
+
def __hash__(self, /) -> int: ...
|
|
65
|
+
def __repr__(self, /) -> str: ...
|
|
66
|
+
@property
|
|
67
|
+
def author(self, /) -> Signature: ...
|
|
68
|
+
@property
|
|
69
|
+
def committer(self, /) -> Signature: ...
|
|
70
|
+
@property
|
|
71
|
+
def id(self, /) -> str: ...
|
|
72
|
+
@property
|
|
73
|
+
def message(self, /) -> str:
|
|
74
|
+
"""
|
|
75
|
+
The commit message in full, including the summary line.
|
|
76
|
+
"""
|
|
77
|
+
@property
|
|
78
|
+
def parent_ids(self, /) -> list[str]: ...
|
|
79
|
+
@property
|
|
80
|
+
def short_id(self, /) -> str:
|
|
81
|
+
"""
|
|
82
|
+
The first seven characters of `id`.
|
|
83
|
+
|
|
84
|
+
Not checked for uniqueness: that costs an object-database lookup per
|
|
85
|
+
commit, which a walk pays for thousands of commits to display a
|
|
86
|
+
handful. `Repository.abbreviate()` gives the shortest prefix that is
|
|
87
|
+
unambiguous, the one `git log --format=%h` prints.
|
|
88
|
+
"""
|
|
89
|
+
@property
|
|
90
|
+
def summary(self, /) -> str: ...
|
|
91
|
+
@property
|
|
92
|
+
def tree_id(self, /) -> str: ...
|
|
93
|
+
|
|
94
|
+
@final
|
|
95
|
+
class FileChange:
|
|
96
|
+
def __repr__(self, /) -> str: ...
|
|
97
|
+
@property
|
|
98
|
+
def deletions(self, /) -> int |None:
|
|
99
|
+
"""
|
|
100
|
+
Lines removed, under the same conditions as `insertions`.
|
|
101
|
+
"""
|
|
102
|
+
@property
|
|
103
|
+
def id(self, /) -> str |None:
|
|
104
|
+
"""
|
|
105
|
+
The object id after the change, `None` for a deletion.
|
|
106
|
+
"""
|
|
107
|
+
@property
|
|
108
|
+
def insertions(self, /) -> int |None:
|
|
109
|
+
"""
|
|
110
|
+
Lines added, counted only when the diff was asked for statistics.
|
|
111
|
+
`None` for a binary side, where lines are not a meaningful unit.
|
|
112
|
+
"""
|
|
113
|
+
@property
|
|
114
|
+
def path(self, /) -> str: ...
|
|
115
|
+
@property
|
|
116
|
+
def previous_id(self, /) -> str |None:
|
|
117
|
+
"""
|
|
118
|
+
The object id before the change, `None` for an addition.
|
|
119
|
+
"""
|
|
120
|
+
@property
|
|
121
|
+
def previous_path(self, /) -> str |None:
|
|
122
|
+
"""
|
|
123
|
+
Where a renamed or copied entry came from, `None` otherwise.
|
|
124
|
+
"""
|
|
125
|
+
@property
|
|
126
|
+
def status(self, /) -> str:
|
|
127
|
+
"""
|
|
128
|
+
`"added"`, `"deleted"`, `"modified"`, `"renamed"` or `"copied"`.
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
@final
|
|
132
|
+
class IndexConflict:
|
|
133
|
+
def __repr__(self, /) -> str: ...
|
|
134
|
+
@property
|
|
135
|
+
def ancestor(self, /) -> IndexEntry |None:
|
|
136
|
+
"""
|
|
137
|
+
The merge base's side, absent for an add/add conflict.
|
|
138
|
+
"""
|
|
139
|
+
@property
|
|
140
|
+
def ours(self, /) -> IndexEntry |None:
|
|
141
|
+
"""
|
|
142
|
+
Our side, absent when we deleted the path.
|
|
143
|
+
"""
|
|
144
|
+
@property
|
|
145
|
+
def path(self, /) -> str: ...
|
|
146
|
+
@property
|
|
147
|
+
def theirs(self, /) -> IndexEntry |None:
|
|
148
|
+
"""
|
|
149
|
+
Their side, absent when they deleted the path.
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
@final
|
|
153
|
+
class IndexEntry:
|
|
154
|
+
def __repr__(self, /) -> str: ...
|
|
155
|
+
@property
|
|
156
|
+
def id(self, /) -> str: ...
|
|
157
|
+
@property
|
|
158
|
+
def mode(self, /) -> str:
|
|
159
|
+
"""
|
|
160
|
+
The entry mode in octal, e.g. `"100644"`.
|
|
161
|
+
"""
|
|
162
|
+
@property
|
|
163
|
+
def path(self, /) -> str: ...
|
|
164
|
+
@property
|
|
165
|
+
def stage(self, /) -> int:
|
|
166
|
+
"""
|
|
167
|
+
0 for an ordinary entry; 1, 2 or 3 for the ancestor, "ours" and
|
|
168
|
+
"theirs" sides of a conflict.
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
@final
|
|
172
|
+
class Reference:
|
|
173
|
+
def __repr__(self, /) -> str: ...
|
|
174
|
+
@property
|
|
175
|
+
def name(self, /) -> str:
|
|
176
|
+
"""
|
|
177
|
+
The full ref name, e.g. `refs/heads/main`.
|
|
178
|
+
"""
|
|
179
|
+
@property
|
|
180
|
+
def shorthand(self, /) -> str:
|
|
181
|
+
"""
|
|
182
|
+
The ref name without its category prefix, e.g. `main`.
|
|
183
|
+
"""
|
|
184
|
+
@property
|
|
185
|
+
def target(self, /) -> str |None: ...
|
|
186
|
+
|
|
187
|
+
@final
|
|
188
|
+
class ReflogEntry:
|
|
189
|
+
def __repr__(self, /) -> str: ...
|
|
190
|
+
@property
|
|
191
|
+
def committer(self, /) -> Signature:
|
|
192
|
+
"""
|
|
193
|
+
Who moved it, and when.
|
|
194
|
+
"""
|
|
195
|
+
@property
|
|
196
|
+
def message(self, /) -> str:
|
|
197
|
+
"""
|
|
198
|
+
What moved the ref, e.g. `checkout: moving from main to feature` or
|
|
199
|
+
`branch: Created from HEAD` — the `%gs` of `git reflog show`.
|
|
200
|
+
"""
|
|
201
|
+
@property
|
|
202
|
+
def new_id(self, /) -> str:
|
|
203
|
+
"""
|
|
204
|
+
The commit the ref pointed at after this entry.
|
|
205
|
+
"""
|
|
206
|
+
@property
|
|
207
|
+
def old_id(self, /) -> str:
|
|
208
|
+
"""
|
|
209
|
+
The commit the ref pointed at before this entry, all zeroes when the
|
|
210
|
+
entry is the one that created the ref.
|
|
211
|
+
"""
|
|
212
|
+
|
|
213
|
+
@final
|
|
214
|
+
class Remote:
|
|
215
|
+
def __repr__(self, /) -> str: ...
|
|
216
|
+
@property
|
|
217
|
+
def name(self, /) -> str: ...
|
|
218
|
+
@property
|
|
219
|
+
def push_url(self, /) -> str |None:
|
|
220
|
+
"""
|
|
221
|
+
The push URL, which falls back to `url` when `remote.<name>.pushurl` is
|
|
222
|
+
unset — the same value git would push to.
|
|
223
|
+
"""
|
|
224
|
+
@property
|
|
225
|
+
def url(self, /) -> str |None:
|
|
226
|
+
"""
|
|
227
|
+
The fetch URL, absent for a remote configured with a push URL only.
|
|
228
|
+
"""
|
|
229
|
+
|
|
230
|
+
@final
|
|
231
|
+
class Repository:
|
|
232
|
+
"""
|
|
233
|
+
A git repository, opened once and queried many times.
|
|
234
|
+
|
|
235
|
+
Backed by a `gix::ThreadSafeRepository` so that every method can do its
|
|
236
|
+
work inside `Python::detach` — see the module doc comment in `src/lib.rs`.
|
|
237
|
+
|
|
238
|
+
The handle sits behind an `RwLock` because a `gix` repository resolves its
|
|
239
|
+
configuration once, when it is opened. Writing configuration therefore has
|
|
240
|
+
to swap in a freshly opened handle, or a value written through this object
|
|
241
|
+
would stay invisible to every later read through it.
|
|
242
|
+
"""
|
|
243
|
+
def __repr__(self, /) -> str: ...
|
|
244
|
+
def abbreviate(self, /, rev: str) -> str:
|
|
245
|
+
"""
|
|
246
|
+
The shortest unambiguous prefix of the object id `rev` names.
|
|
247
|
+
|
|
248
|
+
Mirrors `gix::Id::shorten`. What `git log --format=%h` prints: long
|
|
249
|
+
enough that no other object in this repository shares it. Finding that
|
|
250
|
+
out costs a lookup in the object database, which is why
|
|
251
|
+
`Commit.short_id` does not do it.
|
|
252
|
+
"""
|
|
253
|
+
def ahead_behind(self, /, local: str, upstream: str) -> tuple[int, int]:
|
|
254
|
+
"""
|
|
255
|
+
How many commits `local` is ahead of and behind `upstream`, the two
|
|
256
|
+
numbers `git rev-list --left-right --count` reports.
|
|
257
|
+
"""
|
|
258
|
+
def branch(self, /, name: str) -> Branch |None:
|
|
259
|
+
"""
|
|
260
|
+
A single branch by name, with its target and configured upstream.
|
|
261
|
+
|
|
262
|
+
`name` is a shorthand: `main` finds a local branch, `origin/main` a
|
|
263
|
+
remote-tracking one. Returns `None` if neither exists.
|
|
264
|
+
"""
|
|
265
|
+
def branches(self, /) -> list[str]:
|
|
266
|
+
"""
|
|
267
|
+
Mirrors `gix::Repository::references().local_branches()`, flattened to
|
|
268
|
+
names.
|
|
269
|
+
"""
|
|
270
|
+
def commit(self, /, rev: str) -> Commit:
|
|
271
|
+
"""
|
|
272
|
+
Convenience: `rev_parse_single(rev)` followed by resolving to a commit.
|
|
273
|
+
|
|
274
|
+
An annotated tag peels to the commit it points at, the way
|
|
275
|
+
`<rev>^{commit}` would, so a tag name resolves like a branch name does.
|
|
276
|
+
"""
|
|
277
|
+
def commits(self, /, rev: str |None = None, max_count: int |None = None, hide: Sequence[str] |None = None, sort: str |None = None, since: int |None = None, first_parent_only: bool = False, reverse: bool = False) -> list[Commit]:
|
|
278
|
+
"""
|
|
279
|
+
Mirrors `gix::Repository::rev_walk` starting from `rev` (default `HEAD`).
|
|
280
|
+
|
|
281
|
+
`hide` excludes the commits reachable from the given revisions, the way
|
|
282
|
+
`git log <rev> --not <hidden>` does.
|
|
283
|
+
|
|
284
|
+
`sort` picks the order in which queued commits are visited, not an
|
|
285
|
+
order imposed on the result: a walk always starts at `rev` and moves
|
|
286
|
+
towards its ancestors, so it only shows where history branches.
|
|
287
|
+
`"breadth-first"` (the default) follows the commit graph,
|
|
288
|
+
`"newest-first"` and `"oldest-first"` prefer the commit date, and
|
|
289
|
+
`"topological"` never shows a commit before one of its descendants,
|
|
290
|
+
the order `git log --topo-order` guarantees. Pass `reverse=True` to
|
|
291
|
+
get the collected commits oldest-first, as `git log --reverse` prints
|
|
292
|
+
them — a topological walk reversed is an order the commits can be
|
|
293
|
+
replayed in.
|
|
294
|
+
|
|
295
|
+
`since` stops the walk at a unix timestamp and requires a date-ordered
|
|
296
|
+
sort, which it selects on its own when `sort` is left unset.
|
|
297
|
+
"""
|
|
298
|
+
def config_get(self, /, key: str) -> str |None:
|
|
299
|
+
"""
|
|
300
|
+
The value of a configuration key as git would resolve it, taking
|
|
301
|
+
system, global and local files into account.
|
|
302
|
+
"""
|
|
303
|
+
def config_set(self, /, key: str, value: str) -> None:
|
|
304
|
+
"""
|
|
305
|
+
Write a configuration key to the repository's own config file, creating
|
|
306
|
+
its section when needed — `git config --local <key> <value>`.
|
|
307
|
+
|
|
308
|
+
The repository is reopened afterwards, so the value is visible to later
|
|
309
|
+
reads through this same object.
|
|
310
|
+
"""
|
|
311
|
+
def create_branch(self, /, name: str, start_point: str, force: bool = False) -> str:
|
|
312
|
+
"""
|
|
313
|
+
Point a branch at a revision, creating it or moving it.
|
|
314
|
+
|
|
315
|
+
Mirrors `git branch <name> <start_point>`, and `git branch -f` when
|
|
316
|
+
`force=True`: without it, an existing branch is an error rather than
|
|
317
|
+
silently moved. The branch is not checked out, and `HEAD` is untouched.
|
|
318
|
+
"""
|
|
319
|
+
def create_tag(self, /, name: str, target: str = "HEAD", message: str |None = None, force: bool = False) -> str:
|
|
320
|
+
"""
|
|
321
|
+
Create a tag at a revision.
|
|
322
|
+
|
|
323
|
+
With `message`, an annotated tag object is written and the tag points
|
|
324
|
+
at it, as `git tag -a -m` does; without one the tag points straight at
|
|
325
|
+
the target, as `git tag` does. `force=True` replaces an existing tag.
|
|
326
|
+
"""
|
|
327
|
+
def delete_branch(self, /, name: str) -> bool:
|
|
328
|
+
"""
|
|
329
|
+
Delete a branch, whether or not it is merged.
|
|
330
|
+
|
|
331
|
+
Mirrors `git branch -D`. Returns `False` when there was no such branch,
|
|
332
|
+
so deleting twice is not an error.
|
|
333
|
+
"""
|
|
334
|
+
def delete_tag(self, /, name: str) -> bool:
|
|
335
|
+
"""
|
|
336
|
+
Delete a tag, reporting whether there was one.
|
|
337
|
+
|
|
338
|
+
Mirrors `git tag -d`. The tag object an annotated tag points at is left
|
|
339
|
+
in the object database, as git leaves it.
|
|
340
|
+
"""
|
|
341
|
+
def diff_tree_to_tree(self, /, old_rev: str, new_rev: str, stats: bool = False) -> list[FileChange]:
|
|
342
|
+
"""
|
|
343
|
+
The changes that turn the tree at `old_rev` into the one at `new_rev`.
|
|
344
|
+
|
|
345
|
+
Rename tracking follows the repository's own `diff.renames`
|
|
346
|
+
configuration, as it does for `git diff`.
|
|
347
|
+
|
|
348
|
+
`stats=True` also counts the lines each change adds and removes, the
|
|
349
|
+
numbers behind `git diff --numstat`. They cost a blob diff per changed
|
|
350
|
+
file, so they are off by default, and stay `None` for a binary file.
|
|
351
|
+
"""
|
|
352
|
+
def find_reference(self, /, name: str) -> Reference |None:
|
|
353
|
+
"""
|
|
354
|
+
The reference `name` names, or `None` if there is no such ref.
|
|
355
|
+
|
|
356
|
+
`name` may be full (`refs/heads/main`) or partial (`main`), the same
|
|
357
|
+
spellings `git rev-parse --symbolic-full-name` accepts.
|
|
358
|
+
"""
|
|
359
|
+
@property
|
|
360
|
+
def git_dir(self, /) -> Path: ...
|
|
361
|
+
def head_commit(self, /) -> Commit: ...
|
|
362
|
+
@property
|
|
363
|
+
def head_id(self, /) -> str |None: ...
|
|
364
|
+
@property
|
|
365
|
+
def head_is_detached(self, /) -> bool: ...
|
|
366
|
+
@property
|
|
367
|
+
def head_is_unborn(self, /) -> bool:
|
|
368
|
+
"""
|
|
369
|
+
`True` when `HEAD` points at a branch that has no commit yet, as in a
|
|
370
|
+
freshly initialized repository.
|
|
371
|
+
"""
|
|
372
|
+
@property
|
|
373
|
+
def head_name(self, /) -> str |None: ...
|
|
374
|
+
def index_conflicts(self, /) -> list[IndexConflict]:
|
|
375
|
+
"""
|
|
376
|
+
The conflicted paths in the index, each with its three stages.
|
|
377
|
+
"""
|
|
378
|
+
def index_entries(self, /) -> list[IndexEntry]:
|
|
379
|
+
"""
|
|
380
|
+
Every entry of the index, conflicted ones included.
|
|
381
|
+
"""
|
|
382
|
+
@property
|
|
383
|
+
def is_bare(self, /) -> bool: ...
|
|
384
|
+
def is_descendant_of(self, /, commit: str, ancestor: str) -> bool:
|
|
385
|
+
"""
|
|
386
|
+
Whether `commit` has `ancestor` in its history.
|
|
387
|
+
|
|
388
|
+
A commit is not considered a descendant of itself, and revisions with
|
|
389
|
+
no common ancestor at all report `False`.
|
|
390
|
+
"""
|
|
391
|
+
def is_dirty(self, /) -> bool:
|
|
392
|
+
"""
|
|
393
|
+
Whether the index or the worktree differ from `HEAD`.
|
|
394
|
+
|
|
395
|
+
Untracked files do not count as dirty, matching `gix`'s own definition;
|
|
396
|
+
use `status()` to see them.
|
|
397
|
+
"""
|
|
398
|
+
@property
|
|
399
|
+
def is_shallow(self, /) -> bool: ...
|
|
400
|
+
def merge_base(self, /, one: str, two: str) -> str:
|
|
401
|
+
"""
|
|
402
|
+
The best common ancestor of two revisions, as `git merge-base` finds it.
|
|
403
|
+
"""
|
|
404
|
+
def object_kind(self, /, rev: str) -> str:
|
|
405
|
+
"""
|
|
406
|
+
The kind of object `rev` names: `"commit"`, `"tree"`, `"blob"` or
|
|
407
|
+
`"tag"`.
|
|
408
|
+
|
|
409
|
+
An annotated tag reports `"tag"`; peel it with a `^{}` suffix in the
|
|
410
|
+
revspec to see what it points at.
|
|
411
|
+
"""
|
|
412
|
+
def read_blob(self, /, rev: str) -> bytes:
|
|
413
|
+
"""
|
|
414
|
+
Read a blob's raw bytes at a revspec, e.g. `"HEAD:README.md"`.
|
|
415
|
+
"""
|
|
416
|
+
def references(self, /) -> list[Reference]:
|
|
417
|
+
"""
|
|
418
|
+
Mirrors `gix::Repository::references().all()`, flattened to a `Vec`.
|
|
419
|
+
"""
|
|
420
|
+
def reflog(self, /, name: str) -> list[ReflogEntry]:
|
|
421
|
+
"""
|
|
422
|
+
The reflog of `name`, oldest entry first.
|
|
423
|
+
|
|
424
|
+
That is the order the reflog file records them, and the reverse of what
|
|
425
|
+
`git reflog show` prints — so the entry that created a ref is the first
|
|
426
|
+
one here, not the last. An empty list means the ref has no reflog, which
|
|
427
|
+
is also what a missing ref reports.
|
|
428
|
+
"""
|
|
429
|
+
def remote(self, /, name: str) -> Remote |None:
|
|
430
|
+
"""
|
|
431
|
+
A single remote by name, or `None` if it isn't configured.
|
|
432
|
+
"""
|
|
433
|
+
def remote_branches(self, /) -> list[str]:
|
|
434
|
+
"""
|
|
435
|
+
Mirrors `gix::Repository::references().remote_branches()`, flattened to
|
|
436
|
+
names like `origin/main`.
|
|
437
|
+
"""
|
|
438
|
+
def remotes(self, /) -> list[Remote]:
|
|
439
|
+
"""
|
|
440
|
+
The configured remotes, in the order git lists them.
|
|
441
|
+
"""
|
|
442
|
+
def rev_parse_single(self, /, spec: str) -> str:
|
|
443
|
+
"""
|
|
444
|
+
Mirrors `gix::Repository::rev_parse_single`.
|
|
445
|
+
"""
|
|
446
|
+
def status(self, /, untracked: str = "normal") -> list[StatusEntry]:
|
|
447
|
+
"""
|
|
448
|
+
The working tree's status, the data behind `git status --porcelain`.
|
|
449
|
+
|
|
450
|
+
`untracked` selects how much of the directory walk is reported:
|
|
451
|
+
`"normal"` (the default) collapses an untracked directory into a single
|
|
452
|
+
entry, `"all"` lists every file inside it, and `"none"` skips the walk
|
|
453
|
+
entirely — much cheaper when only tracked changes matter.
|
|
454
|
+
"""
|
|
455
|
+
def submodule_status(self, /, name: str, ignore: str = "none") -> SubmoduleStatus |None:
|
|
456
|
+
"""
|
|
457
|
+
The status of a single submodule, by name.
|
|
458
|
+
|
|
459
|
+
`ignore` mirrors git's `submodule.<name>.ignore`: `"none"` (the
|
|
460
|
+
default) looks at everything, `"untracked"` skips untracked files,
|
|
461
|
+
`"dirty"` skips worktree changes altogether and `"all"` reports nothing
|
|
462
|
+
but the clone state — which also makes `is_dirty` report `False`, since
|
|
463
|
+
no change can be seen from there.
|
|
464
|
+
"""
|
|
465
|
+
def submodules(self, /) -> list[Submodule]:
|
|
466
|
+
"""
|
|
467
|
+
The submodules declared in `.gitmodules`.
|
|
468
|
+
"""
|
|
469
|
+
def tags(self, /) -> list[str]:
|
|
470
|
+
"""
|
|
471
|
+
Mirrors `gix::Repository::references().tags()`, flattened to names.
|
|
472
|
+
"""
|
|
473
|
+
def tree_entries(self, /, rev: str = "HEAD") -> list[TreeEntry]:
|
|
474
|
+
"""
|
|
475
|
+
The entries of the tree `rev` names, one level deep.
|
|
476
|
+
|
|
477
|
+
`rev` may name a tree directly or anything that peels to one, such as
|
|
478
|
+
`HEAD` or `HEAD:subdir`.
|
|
479
|
+
"""
|
|
480
|
+
@property
|
|
481
|
+
def workdir(self, /) -> Path |None: ...
|
|
482
|
+
def worktrees(self, /) -> list[Worktree]:
|
|
483
|
+
"""
|
|
484
|
+
The linked worktrees registered under `.git/worktrees`.
|
|
485
|
+
|
|
486
|
+
The main worktree is not among them, matching `git worktree list
|
|
487
|
+
--porcelain` minus its first entry.
|
|
488
|
+
"""
|
|
489
|
+
|
|
490
|
+
@final
|
|
491
|
+
class Signature:
|
|
492
|
+
def __repr__(self, /) -> str: ...
|
|
493
|
+
@property
|
|
494
|
+
def email(self, /) -> str: ...
|
|
495
|
+
@property
|
|
496
|
+
def name(self, /) -> str: ...
|
|
497
|
+
@property
|
|
498
|
+
def offset(self, /) -> int:
|
|
499
|
+
"""
|
|
500
|
+
Seconds east of UTC in the timezone the signature was written in.
|
|
501
|
+
`time` alone loses it, and with it the local date the author saw.
|
|
502
|
+
"""
|
|
503
|
+
@property
|
|
504
|
+
def time(self, /) -> int:
|
|
505
|
+
"""
|
|
506
|
+
Unix timestamp (seconds).
|
|
507
|
+
"""
|
|
508
|
+
|
|
509
|
+
@final
|
|
510
|
+
class StatusEntry:
|
|
511
|
+
def __repr__(self, /) -> str: ...
|
|
512
|
+
@property
|
|
513
|
+
def path(self, /) -> str: ...
|
|
514
|
+
@property
|
|
515
|
+
def previous_path(self, /) -> str |None: ...
|
|
516
|
+
@property
|
|
517
|
+
def staged(self, /) -> bool:
|
|
518
|
+
"""
|
|
519
|
+
`True` for a `HEAD`-to-index difference, `False` for an
|
|
520
|
+
index-to-worktree one — the two columns of `git status --porcelain`.
|
|
521
|
+
"""
|
|
522
|
+
@property
|
|
523
|
+
def status(self, /) -> str:
|
|
524
|
+
"""
|
|
525
|
+
`"added"`, `"deleted"`, `"modified"`, `"typechange"`, `"renamed"`,
|
|
526
|
+
`"copied"`, `"conflicted"` or `"untracked"`.
|
|
527
|
+
"""
|
|
528
|
+
|
|
529
|
+
@final
|
|
530
|
+
class Submodule:
|
|
531
|
+
def __repr__(self, /) -> str: ...
|
|
532
|
+
@property
|
|
533
|
+
def head_id(self, /) -> str |None:
|
|
534
|
+
"""
|
|
535
|
+
The commit the submodule's own `HEAD` points at, `None` when it isn't
|
|
536
|
+
cloned yet.
|
|
537
|
+
"""
|
|
538
|
+
@property
|
|
539
|
+
def index_id(self, /) -> str |None:
|
|
540
|
+
"""
|
|
541
|
+
The commit the superproject's index records for the submodule.
|
|
542
|
+
"""
|
|
543
|
+
@property
|
|
544
|
+
def is_active(self, /) -> bool: ...
|
|
545
|
+
@property
|
|
546
|
+
def name(self, /) -> str: ...
|
|
547
|
+
@property
|
|
548
|
+
def path(self, /) -> str:
|
|
549
|
+
"""
|
|
550
|
+
The path within the superproject's worktree.
|
|
551
|
+
"""
|
|
552
|
+
@property
|
|
553
|
+
def url(self, /) -> str: ...
|
|
554
|
+
|
|
555
|
+
@final
|
|
556
|
+
class SubmoduleStatus:
|
|
557
|
+
def __repr__(self, /) -> str: ...
|
|
558
|
+
@property
|
|
559
|
+
def checked_out_head_id(self, /) -> str |None: ...
|
|
560
|
+
@property
|
|
561
|
+
def index_id(self, /) -> str |None: ...
|
|
562
|
+
@property
|
|
563
|
+
def is_dirty(self, /) -> bool |None:
|
|
564
|
+
"""
|
|
565
|
+
`None` when the submodule is not cloned or not checked out, leaving it
|
|
566
|
+
to the caller to decide whether that counts as dirty.
|
|
567
|
+
"""
|
|
568
|
+
@property
|
|
569
|
+
def name(self, /) -> str: ...
|
|
570
|
+
@property
|
|
571
|
+
def path(self, /) -> str:
|
|
572
|
+
"""
|
|
573
|
+
The path within the superproject's worktree.
|
|
574
|
+
"""
|
|
575
|
+
@property
|
|
576
|
+
def repository_exists(self, /) -> bool:
|
|
577
|
+
"""
|
|
578
|
+
Whether the submodule has been cloned into `.git/modules`.
|
|
579
|
+
"""
|
|
580
|
+
@property
|
|
581
|
+
def worktree_checkout(self, /) -> bool:
|
|
582
|
+
"""
|
|
583
|
+
Whether the submodule's worktree is checked out.
|
|
584
|
+
"""
|
|
585
|
+
|
|
586
|
+
@final
|
|
587
|
+
class TreeEntry:
|
|
588
|
+
def __repr__(self, /) -> str: ...
|
|
589
|
+
@property
|
|
590
|
+
def id(self, /) -> str: ...
|
|
591
|
+
@property
|
|
592
|
+
def kind(self, /) -> str:
|
|
593
|
+
"""
|
|
594
|
+
`"blob"`, `"tree"`, `"link"` or `"commit"` (a submodule).
|
|
595
|
+
"""
|
|
596
|
+
@property
|
|
597
|
+
def mode(self, /) -> str:
|
|
598
|
+
"""
|
|
599
|
+
The entry mode in octal, e.g. `"100644"`.
|
|
600
|
+
"""
|
|
601
|
+
@property
|
|
602
|
+
def name(self, /) -> str:
|
|
603
|
+
"""
|
|
604
|
+
The entry's name within its tree, not a full path.
|
|
605
|
+
"""
|
|
606
|
+
|
|
607
|
+
@final
|
|
608
|
+
class Worktree:
|
|
609
|
+
def __repr__(self, /) -> str: ...
|
|
610
|
+
@property
|
|
611
|
+
def git_dir(self, /) -> Path:
|
|
612
|
+
"""
|
|
613
|
+
The private git directory backing this worktree.
|
|
614
|
+
"""
|
|
615
|
+
@property
|
|
616
|
+
def is_locked(self, /) -> bool: ...
|
|
617
|
+
@property
|
|
618
|
+
def name(self, /) -> str:
|
|
619
|
+
"""
|
|
620
|
+
The linked worktree's identifier, its directory name under
|
|
621
|
+
`.git/worktrees`.
|
|
622
|
+
"""
|
|
623
|
+
@property
|
|
624
|
+
def path(self, /) -> Path |None:
|
|
625
|
+
"""
|
|
626
|
+
The worktree's working directory, `None` if it is inaccessible.
|
|
627
|
+
"""
|
|
628
|
+
|
|
629
|
+
def _debug_detached_sleep(seconds: float) -> None:
|
|
630
|
+
"""
|
|
631
|
+
Sleeps for `seconds` inside `Python::detach`.
|
|
632
|
+
|
|
633
|
+
Not part of the `gix`-mirroring API surface: this exists so the test
|
|
634
|
+
suite can assert that `Python::detach` lets other Python threads make
|
|
635
|
+
progress while this call is in flight, independent of any particular
|
|
636
|
+
git repository's size or contents.
|
|
637
|
+
"""
|
|
638
|
+
|
|
639
|
+
def discover(path: str |PathLike[str]) -> Repository:
|
|
640
|
+
"""
|
|
641
|
+
Mirrors `gix::ThreadSafeRepository::discover`.
|
|
642
|
+
"""
|
|
643
|
+
|
|
644
|
+
def gix_version() -> str:
|
|
645
|
+
"""
|
|
646
|
+
The version of `gix` this extension was built against.
|
|
647
|
+
|
|
648
|
+
The package version tracks `gix`'s major and minor, so this is how to
|
|
649
|
+
see the exact patch — worth quoting in a bug report, since most of the
|
|
650
|
+
behaviour here is `gix`'s.
|
|
651
|
+
"""
|
|
652
|
+
|
|
653
|
+
def init(path: str |PathLike[str], bare: bool = False) -> Repository:
|
|
654
|
+
"""
|
|
655
|
+
Mirrors `gix::ThreadSafeRepository::init`, creating the destination first.
|
|
656
|
+
|
|
657
|
+
`gix` expects the destination directory to exist already, where `git init
|
|
658
|
+
a/b/c` creates the whole path. The directory is created here so both agree.
|
|
659
|
+
"""
|
|
660
|
+
|
|
661
|
+
def open(path: str |PathLike[str]) -> Repository:
|
|
662
|
+
"""
|
|
663
|
+
Mirrors `gix::ThreadSafeRepository::open`.
|
|
664
|
+
"""
|
|
Binary file
|
gitoxide_py/py.typed
ADDED
|
File without changes
|