Skip to content

Git

Git(url, deployment, force, deployed_commit, remote, config=None)

Abstraction of Git object

Initialize GIT object

Parameters:

Name Type Description Default
url str

file or http(s) path to GIT repository

required
deployment str

name of selected deployment group

required
force bool

whether or not Git context was forced

required
deployed_commit GitCommit

GitCommit object of the currently deployed commit

required
remote GitRemote

GitRemote object of the current remote

required
config dict

Dictionary containing git configuration parameters

None
Source code in TM1py/Objects/Git.py
def __init__(
    self, url: str, deployment: str, force: bool, deployed_commit: GitCommit, remote: GitRemote, config: dict = None
):
    """Initialize GIT object
    :param url: file or http(s) path to GIT repository
    :param deployment: name of selected deployment group
    :param force: whether or not Git context was forced
    :param deployed_commit: GitCommit object of the currently deployed commit
    :param remote: GitRemote object of the current remote
    :param config: Dictionary containing git configuration parameters

    """
    self._url = url
    self._deployment = deployment
    self._force = force
    self._deployed_commit = deployed_commit
    self._remote = remote
    self._config = config

config property

deployed_commit property

deployment property

force property

remote property

url property

from_dict(json_response) classmethod

Source code in TM1py/Objects/Git.py
@classmethod
def from_dict(cls, json_response: Dict) -> "Git":
    deployed_commit = GitCommit(
        commit_id=json_response["DeployedCommit"].get("ID"),
        summary=json_response["DeployedCommit"].get("Summary"),
        author=json_response["DeployedCommit"].get("Author"),
    )

    remote = GitRemote(
        connected=json_response["Remote"].get("Connected"),
        branches=json_response["Remote"].get("Branches"),
        tags=json_response["Remote"].get("Tags"),
    )

    git = Git(
        url=json_response["URL"],
        deployment=json_response["Deployment"],
        force=json_response["Deployment"],
        deployed_commit=deployed_commit,
        remote=remote,
    )

    return git