rbtools.api.resource.diff¶
Resource definitions for diffs.
Added in version 6.0: This was moved from rbtools.api.resource.
Classes
|
Item resource for diffs. |
|
List resource for diffs. |
- class rbtools.api.resource.diff.DiffItemResource(transport: Transport, payload: JSONDict, url: str, token: str | None = None, **kwargs)[source]¶
Bases:
GetPatchMixin,ItemResourceItem resource for diffs.
This corresponds to Review Board’s Diff Resource.
Changed in version 6.0: Renamed from DiffResource.
- __firstlineno__ = 42¶
- __static_attributes__ = ()¶
- base_commit_id: str¶
The ID/revision that this change is built upon.
If using a parent diff, then this is the base for that diff. This may not be provided for all diffs or repository types, depending on how the diff was uploaded.
- basedir: str¶
The base directory that will be prepended to all paths in the diff.
This is needed for some types of repositories. The directory must be between the root of the repository and the top directory referenced in the diff paths.
- commit_count: str¶
The number of commits present.
This will only be set for review requests created with commit history.
- extra_data: ResourceExtraDataField¶
Extra data as part of the diff.
- finalize_commit_series(cumulative_diff: bytes, validation_info: str, parent_diff: bytes | None = None) HttpRequest[source]¶
Finalize a commit series.
- Parameters:
cumulative_diff (
bytes) – The cumulative diff of the entire commit series.validation_info (
str) – The validation information returned by validating the last commit in the series with theValidateDiffCommitResource.parent_diff (
bytes, optional) –An optional parent diff.
This will be the same parent diff uploaded with each commit.
- Returns:
The finalized diff resource.
- Return type:
- Raises:
rbtools.api.errors.APIError – The Review Board API returned an error.
rbtools.api.errors.ServerInterfaceError – An error occurred while communicating with the server.
- get_commits(**kwargs: Unpack[BaseGetListParams]) DiffCommitListResource[source]¶
Get the commits for the diff.
- Parameters:
**kwargs (
dict) – Query arguments to include with the request.- Returns:
The diff commit list resource.
- Return type:
rbtools.api.resource.DiffCommitListResource- Raises:
rbtools.api.errors.APIError – The Review Board API returned an error.
rbtools.api.errors.ServerInterfaceError – An error occurred while communicating with the server.
- get_draft_commits(**kwargs: Unpack[BaseGetListParams]) DraftDiffCommitListResource[source]¶
Get the commits for the diff when the diff is a draft.
- Parameters:
**kwargs (
dict) – Query arguments to include with the request.- Returns:
The diff commit list resource.
- Return type:
rbtools.api.resource.DraftDiffCommitListResource- Raises:
rbtools.api.errors.APIError – The Review Board API returned an error.
rbtools.api.errors.ServerInterfaceError – An error occurred while communicating with the server.
- get_draft_files(**kwargs: Unpack[FileDiffGetListParams]) FileDiffListResource[source]¶
Get the files for the diff when the diff is a draft.
- Parameters:
**kwargs (
dict) – Query arguments to include with the request.- Returns:
The diff commit list resource.
- Return type:
rbtools.api.resource.FileDiffListResource- Raises:
rbtools.api.errors.APIError – The Review Board API returned an error.
rbtools.api.errors.ServerInterfaceError – An error occurred while communicating with the server.
- get_files(**kwargs: Unpack[FileDiffGetListParams]) FileDiffListResource[source]¶
Get the files for the diff.
- Parameters:
**kwargs (
dict) – Query arguments to include with the request.- Returns:
The file diff list resource.
- Return type:
rbtools.api.resource.FileDiffListResource- Raises:
rbtools.api.errors.APIError – The Review Board API returned an error.
rbtools.api.errors.ServerInterfaceError – An error occurred while communicating with the server.
- get_repository(**kwargs: Unpack[BaseGetParams]) RepositoryItemResource[source]¶
Get the repository for this diff.
- Parameters:
**kwargs (
dict) – Query arguments to include with the request.- Returns:
The repository item resource.
- Return type:
rbtools.api.resource.RepositoryItemResource- Raises:
rbtools.api.errors.APIError – The Review Board API returned an error.
rbtools.api.errors.ServerInterfaceError – An error occurred while communicating with the server.
- class rbtools.api.resource.diff.DiffListResource(transport: Transport, payload: JSONDict, url: str, token: str | None = None, item_mime_type: str | None = None, **kwargs)[source]¶
Bases:
DiffUploaderMixin,ListResource[DiffItemResource]List resource for diffs.
This corresponds to Review Board’s Diff List Resource.
- __annotations_cache__ = {}¶
- __firstlineno__ = 269¶
- __static_attributes__ = ()¶
- create_empty(base_commit_id: str | None = None, **kwargs: QueryArgs) HttpRequest[source]¶
Create an empty DiffSet that commits can be added to.
- Parameters:
- Returns:
The newly-created diff.
- Return type:
- upload_diff(diff: bytes, parent_diff: bytes | None = None, base_dir: str | None = None, base_commit_id: str | None = None, **kwargs: QueryArgs) HttpRequest[source]¶
Upload a diff to the resource.
The diff and parent_diff arguments should be strings containing the diff output.
- Parameters:
diff (
bytes) – The diff content.parent_diff (
bytes, optional) – The parent diff content, if present.base_dir (
str, optional) – The base directory for the diff, if present.base_commit_id (
str, optional) – The ID of the commit that the diff is against, if present.**kwargs (
dictofrbtools.api.request.QueryArgs) – Query arguments to include with the request.
- Returns:
The newly-created diff.
- Return type: