rbtools.clients.sos¶
A client for Cliosoft SOS.
Cliosoft SOS is an Enterprise SCM focused on hardware design and configuration management.
New in version 3.1.
Classes
|
A representation of a SOS changelist. |
|
A client for Cliosoft SOS. |
Constants for SOS object change statuses. |
|
Constants for SOS revisions. |
|
Constants for SOS object states. |
|
Constants for SOS object types. |
|
Extra revision information for a SOS revision specification. |
- class rbtools.clients.sos.SOSRevisionSpecExtra[source]¶
Bases:
TypedDict
Extra revision information for a SOS revision specification.
This contains information on the SOS changelist or selection, computed based on the revision information provided to SOS.
This goes into the
extra
key inSCMClientRevisionSpec
.New in version 4.0: In prior versions, these keys lived directly in the base of the revision spec.
- has_explicit_selection: bool¶
Whether an explicit selection was provided.
If
False
, a default selection will be used instead.This is only present if
sos_selection
is present.- Type:
- __optional_keys__ = frozenset({'has_explicit_selection', 'sos_changelist', 'sos_selection'})¶
- __orig_bases__ = (<function TypedDict>,)¶
- __required_keys__ = frozenset({})¶
- __total__ = True¶
- class rbtools.clients.sos.SOSObjectType[source]¶
Bases:
object
Constants for SOS object types.
New in version 3.1.
- class rbtools.clients.sos.SOSObjectState[source]¶
Bases:
object
Constants for SOS object states.
New in version 3.1.
- class rbtools.clients.sos.SOSObjectChangeStatus[source]¶
Bases:
object
Constants for SOS object change statuses.
New in version 3.1.
- class rbtools.clients.sos.SOSObjectRevision[source]¶
Bases:
object
Constants for SOS revisions.
New in version 3.1.
- class rbtools.clients.sos.SOSChangeList(adds=None, deletes=None, modifications=None)[source]¶
Bases:
object
A representation of a SOS changelist.
A changelist records the added, modified, and deleted files scheduled to be posted for review or checked into a project. These are managed via the soscmd add, soscmd commit, and soscmd describe commands in SOS 7.20+.
New in version 3.1.
- deletes¶
File paths scheduled to be added. Each is relative to the workarea root.
- Type:
set
, optional
- modifications¶
File paths scheduled to be modified. Each is relative to the workarea root.
- Type:
set
, optional
- __init__(adds=None, deletes=None, modifications=None)[source]¶
Initialize the changelist.
- Parameters:
adds (
set
, optional) – File paths scheduled to be added. Each is relative to the workarea root.deletes (
set
, optional) – File paths scheduled to be added. Each is relative to the workarea root.modifications (
set
, optional) – File paths scheduled to be modified. Each is relative to the workarea root.
- class rbtools.clients.sos.SOSClient(*args, **kwargs)[source]¶
Bases:
BaseSCMClient
A client for Cliosoft SOS.
Cliosoft SOS is an Enterprise SCM focused on hardware design and configuration management.
This implementation makes use of soscmd to fetch information on repositories and generate suitable diffs.
Diff generation makes use of the proposed DiffX standard (SOS itself doesn’t have a native diff format with metadata).
This implementation is expected to be used with SOS 7.20 or higher.
New in version 3.1.
- scmclient_id: str = 'sos'[source]¶
The unique ID of the client.
New in version 4.0: This will be required in RBTools 5.0.
- Type:
- requires_diff_tool: Union[bool, List[str]] = True[source]¶
Whether this tool requires a command line diff tool.
This may be a boolean or a list.
If a boolean, then this must be
False
if no command line tool is required, orTrue
if any command line tool supported by RBTools is available (in which case the SCMClient is responsible for ensuring compatibility).If a list, then this must be a list of registered diff tool IDs that are compatible.
New in version 4.0.
- supports_diff_exclude_patterns: bool = True[source]¶
Whether the SCM client supports excluding files from the diff.
- Type:
- check_dependencies() None [source]¶
Check whether all base dependencies are available.
This checks for the presence of soscmd in the system path.
New in version 4.0.
- Raises:
rbtools.clients.errors.SCMClientDependencyError – A soscmd tool could not be found.
- get_local_path() Optional[str] [source]¶
Return the local path to the working tree.
- Returns:
The filesystem path of the repository on the client system, or
None
if not inside of a workarea.- Return type:
- get_repository_info() Optional[RepositoryInfo] [source]¶
Return repository information for the current SOS workarea.
- Returns:
The workarea repository information, or
None
if not in a SOS workarea.- Return type:
- parse_revision_spec(revisions: List[str] = []) SCMClientRevisionSpec [source]¶
Parse the given revision spec.
If a single revision is passed in, and it begins with
select:
, then anything after is expected to be SOS selection flags to match files to post.If a single revision is passed in, and it does not begin with
select:
, then it’s assumed to be a changelist ID.If zero revisions are passed in, a default selection of
-scm
will be used.Anything else is unsupported.
- Parameters:
revisions (
list
ofstr
, optional) – A list of SOS selection patterns or changelist IDs, as specified by the user.- Returns:
The parsed revision spec.
See
SCMClientRevisionSpec
for the format of this dictionary.This only makes use of the
extra
field, which is documented inSOSRevisionSpecExtra
.- Return type:
- Raises:
rbtools.clients.errors.InvalidRevisionSpecError – The given revisions could not be parsed.
rbtools.clients.errors.TooManyRevisionsError – The specified revisions list contained too many revisions.
- get_tree_matches_review_request(review_request: ReviewRequestResource, revisions: SCMClientRevisionSpec, **kwargs) bool [source]¶
Return whether a tree matches metadata in a review request.
This will compare the stored state in a review request (set when posting a change for review) to the project, server, workarea ID, and changelist ID of the current tree.
This is used for enhanced guessing of review requests, available in RBTools 3.1+.
- Parameters:
review_request (
rbtools.api.resources.ReviewRequestResource
) – The review request being matched.revisions (
dict
) – The posted revision information. This is expected to be the result ofparse_revision_spec()
.**kwargs (
dict
, unused) – Additional keyword arguments for future expansion.
- Returns:
True
if the review request matches the tree.False
if it does not.- Return type:
- diff(revisions: SCMClientRevisionSpec, *, include_files: List[str] = [], exclude_patterns: List[str] = [], with_parent_diff: bool = True, **kwargs) SCMClientDiffResult [source]¶
Perform a diff using the given revisions.
This goes through the work of generating a diff for SOS, generating a DiffX-compatible diff.
It will start by grabbing the changelist details or the files matched by a selection, exporting the old revision of each, and diffing that to the current version in the tree.
The DiffX metadata contains the SOS project, server, RSO, and the changelist ID if posting a change for review. This is needed server-side for looking up each file.
The current selection will be stashed before this operation and then restored afterward, in order to avoid impacting any current selections from the user.
The results will also contain additional metadata used to store in the review request’s
extra_data
field, for smart review request matching. This includes the SOS project, server, workarea ID, and the changelist ID if posting a changelist for review.- Parameters:
revisions (
dict
) – A dictionary of revisions, as returned byparse_revision_spec()
.include_files (
list
ofunicode
, optional) – A list of files to whitelist during the diff generation.exclude_patterns (
list
ofunicode
, optional) – A list of shell-style glob patterns to blacklist during diff generation.**kwargs (
dict
, unused) – Unused keyword arguments.
- Returns:
A dictionary containing keys documented in
SCMClientDiffResult
.- Return type: