Detail Package¶
detail
¶
detail.Commit
¶
Bases: UserDict
A commit object, parsed from a dictionary of formatted commit data. Allows one to easily see the tag.
Source code in detail/core.py
detail.Note
¶
detail.NoteRange
¶
Bases: Notes
Represents a range of notes. The range can be filtered and grouped
using all of the methods in Notes.
When doing git log, the user can provide a range
(e.g. "origin/develop.."). Any range used in "git log" can be
used as a range to the NoteRange object.
If the special :github/pr value is used as a range, the Github
API is used to figure out the range based on a pull request opened
from the current branch (if found).
Source code in detail/core.py
detail.Notes
¶
Bases: Sequence
A filterable and groupable collection of notes
When a list of Note objects is organized in this sequence, the "group", "filter", and "exclude" chainable methods can be used for various access patterns. These access patterns are typically used when writing log templates.
exclude
¶
exclude(attr, value, match=False) -> Notes
Exclude notes by an attribute
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attr
|
str
|
The name of the attribute on the |
required |
value
|
str | bool
|
The value to exclude by. |
required |
match
|
bool, default=False
|
Treat |
False
|
Returns:
| Type | Description |
|---|---|
Notes
|
The excluded commits. |
Source code in detail/core.py
filter
¶
filter(attr, value, match=False) -> Notes
Filter notes by an attribute
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attr
|
str
|
The name of the attribute on the |
required |
value
|
str | bool
|
The value to filter by. |
required |
match
|
bool, default=False
|
Treat |
False
|
Returns:
| Type | Description |
|---|---|
Notes
|
The filtered notes. |
Source code in detail/core.py
group
¶
group(
attr,
ascending_keys=False,
descending_keys=False,
none_key_first=False,
none_key_last=False,
) -> OrderedDict[str, Notes]
Group notes by an attribute
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attr
|
str
|
The attribute to group by. |
required |
ascending_keys
|
bool, default=False
|
Sort the keys in ascending order. |
False
|
descending_keys
|
bool, default=False
|
Sort the keys in descending order. |
False
|
none_key_first
|
bool, default=False
|
Make the "None" key be first. |
False
|
none_key_last
|
bool, default=False
|
Make the "None" key be last. |
False
|
Returns:
| Type | Description |
|---|---|
OrderedDict[str, Notes]
|
A dictionary of |
Source code in detail/core.py
detail.Tag
¶
Bases: UserString
A git tag.
date
property
¶
from_sha
classmethod
¶
Create a Tag object from a sha or return None if there is no associated tag
Returns:
| Type | Description |
|---|---|
Optional[Tag]
|
A constructed tag or |
Source code in detail/core.py
detail.detail
¶
Creates or updates a note
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str, default=None
|
A path to an existing note. If provided, the note will be updated. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The result from running git commit. Returns the git pre-commit |
FormalDict
|
hook results if failing during hook execution. |
Source code in detail/core.py
detail.lint
¶
Lint notes against a range (branch, sha, etc).
Linting passes when either succeed:
- No commits are in the range.
- Commits are found, and all notes pass linting. At least one note must be in the commit range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
range
|
str, default=''
|
The git revision range against which linting happens. The special value of ":github/pr" can be used to lint against the remote branch of the pull request that is opened from the local branch. No range means linting will happen against all commits. |
''
|
Raises:
| Type | Description |
|---|---|
`NoGithubPullRequestFoundError`
|
When using |
`MultipleGithubPullRequestsFoundError`
|
When using |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
(bool, NoteRange)
|
A tuple of the lint result (True/False) |
Notes
|
and the associated |
Source code in detail/core.py
detail.log
¶
log(
range="",
style="default",
template=None,
tag_match=None,
before=None,
after=None,
reverse=False,
output=None,
) -> str
Renders notes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
range
|
str, default=''
|
The git revision range over which logs are output. Using ":github/pr" as the range will use the base branch of an open github pull request as the range. No range will result in all commits being logged. |
''
|
style
|
str, default="default"
|
The template file nickname to use when rendering.
Defaults to "default", which means |
'default'
|
template
|
str, default=None
|
A template string to use when rendering. Supercedes any style provided. |
None
|
tag_match
|
str, default=None
|
A glob(7) pattern for matching tags
when associating a tag with a commit in the log. Passed through
to |
None
|
before
|
str, default=None
|
Only return commits before a specific
date. Passed directly to |
None
|
after
|
str, default=None
|
Only return commits after a specific
date. Passed directly to |
None
|
reverse
|
bool, default=False
|
Reverse ordering of results. Passed
directly to |
False
|
output
|
str | file
|
Path or file-like object to which the template is written. Using the special ":github/pr" output path will post the log as a comment on the pull request. |
None
|
Raises:
| Type | Description |
|---|---|
`NoGithubPullRequestFoundError`
|
When using |
`MultipleGithubPullRequestsFoundError`
|
When using |
Returns:
| Type | Description |
|---|---|
str
|
The rendered log. |
Source code in detail/core.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 | |
detail.exceptions
¶
detail.exceptions.GithubConfigurationError
¶
Bases: Error
When not correctly set up for Github access
detail.exceptions.GithubPullRequestAPIError
¶
Bases: Error
When an unexpected error happens with the Github pull request API
detail.exceptions.MultipleGithubPullRequestsFoundError
¶
Bases: Error
When multiple Github pull requests have been opened