Skip to content

Commit

Permalink
Add remote commit hash in initialize_git_connection (#282)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
hurtn authored Nov 17, 2024
1 parent 24f0e42 commit 5b2d53e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/sempy_labs/_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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 <https://learn.microsoft.com/rest/api/fabric/core/git/update-from-git?tabs=HTTP#conflictresolutionpolicy>`_.
Expand Down

0 comments on commit 5b2d53e

Please sign in to comment.