From 5b2d53e6f7357fdfdaf4b7c35de02367cc556761 Mon Sep 17 00:00:00 2001 From: Nick Hurt Date: Sun, 17 Nov 2024 06:57:40 +0000 Subject: [PATCH] Add remote commit hash in initialize_git_connection (#282) * Update _git.py Return the remote full SHA commit hash in initialize_git_connection. * Update _git.py Return remote commit hash in initialize_git_connection --- src/sempy_labs/_git.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/sempy_labs/_git.py b/src/sempy_labs/_git.py index 6944220a..b4bd4f02 100644 --- a/src/sempy_labs/_git.py +++ b/src/sempy_labs/_git.py @@ -217,7 +217,7 @@ def get_git_connection(workspace: Optional[str] = None) -> pd.DataFrame: return df -def initialize_git_connection(workspace: Optional[str] = None): +def initialize_git_connection(workspace: Optional[str] = None) -> str: """ Initializes a connection for a workspace that is connected to Git. @@ -229,6 +229,11 @@ def initialize_git_connection(workspace: Optional[str] = None): The Fabric workspace name. Defaults to None which resolves to the workspace of the attached lakehouse or if no lakehouse attached, resolves to the workspace of the notebook. + + Returns + ------- + str + Remote full SHA commit hash. """ workspace, workspace_id = resolve_workspace_name_and_id(workspace) @@ -245,6 +250,8 @@ def initialize_git_connection(workspace: Optional[str] = None): f"{icons.green_dot} The '{workspace}' workspace git connection has been initialized." ) + return response.json()['remoteCommitHash'] + def commit_to_git( comment: str, item_ids: str | List[str] = None, workspace: Optional[str] = None @@ -327,7 +334,7 @@ def update_from_git( workspace_head : str Full SHA hash that the workspace is synced to. This value may be null only after Initialize Connection. In other cases, the system will validate that the given value is aligned with the head known to the system. - remove_commit_hash : str + remote_commit_hash : str Remote full SHA commit hash. confilict_resolution_policy : str The `conflict resolution policy `_.