From 1e7d4bc2544b875547f21f8442fa87dd3705376d Mon Sep 17 00:00:00 2001 From: Really Him Date: Mon, 12 May 2025 23:26:09 -0400 Subject: [PATCH 1/6] fix: replace deprecated pydantic function --- src/git/src/mcp_server_git/server.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/git/src/mcp_server_git/server.py b/src/git/src/mcp_server_git/server.py index c6a346cfef..9869728029 100644 --- a/src/git/src/mcp_server_git/server.py +++ b/src/git/src/mcp_server_git/server.py @@ -166,62 +166,62 @@ async def list_tools() -> list[Tool]: Tool( name=GitTools.STATUS, description="Shows the working tree status", - inputSchema=GitStatus.schema(), + inputSchema=GitStatus.model_json_schema(), ), Tool( name=GitTools.DIFF_UNSTAGED, description="Shows changes in the working directory that are not yet staged", - inputSchema=GitDiffUnstaged.schema(), + inputSchema=GitDiffUnstaged.model_json_schema(), ), Tool( name=GitTools.DIFF_STAGED, description="Shows changes that are staged for commit", - inputSchema=GitDiffStaged.schema(), + inputSchema=GitDiffStaged.model_json_schema(), ), Tool( name=GitTools.DIFF, description="Shows differences between branches or commits", - inputSchema=GitDiff.schema(), + inputSchema=GitDiff.model_json_schema(), ), Tool( name=GitTools.COMMIT, description="Records changes to the repository", - inputSchema=GitCommit.schema(), + inputSchema=GitCommit.model_json_schema(), ), Tool( name=GitTools.ADD, description="Adds file contents to the staging area", - inputSchema=GitAdd.schema(), + inputSchema=GitAdd.model_json_schema(), ), Tool( name=GitTools.RESET, description="Unstages all staged changes", - inputSchema=GitReset.schema(), + inputSchema=GitReset.model_json_schema(), ), Tool( name=GitTools.LOG, description="Shows the commit logs", - inputSchema=GitLog.schema(), + inputSchema=GitLog.model_json_schema(), ), Tool( name=GitTools.CREATE_BRANCH, description="Creates a new branch from an optional base branch", - inputSchema=GitCreateBranch.schema(), + inputSchema=GitCreateBranch.model_json_schema(), ), Tool( name=GitTools.CHECKOUT, description="Switches branches", - inputSchema=GitCheckout.schema(), + inputSchema=GitCheckout.model_json_schema(), ), Tool( name=GitTools.SHOW, description="Shows the contents of a commit", - inputSchema=GitShow.schema(), + inputSchema=GitShow.model_json_schema(), ), Tool( name=GitTools.INIT, description="Initialize a new Git repository", - inputSchema=GitInit.schema(), + inputSchema=GitInit.model_json_schema(), ) ] From c53b53030d3e9f5bcf0afcb6d944bf4f7eba3b5a Mon Sep 17 00:00:00 2001 From: Really Him Date: Mon, 12 May 2025 23:28:26 -0400 Subject: [PATCH 2/6] fix: fix mypy warning about representation of bytes --- src/git/src/mcp_server_git/server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/git/src/mcp_server_git/server.py b/src/git/src/mcp_server_git/server.py index 9869728029..7ca8c520fd 100644 --- a/src/git/src/mcp_server_git/server.py +++ b/src/git/src/mcp_server_git/server.py @@ -102,10 +102,10 @@ def git_log(repo: git.Repo, max_count: int = 10) -> list[str]: log = [] for commit in commits: log.append( - f"Commit: {commit.hexsha}\n" - f"Author: {commit.author}\n" + f"Commit: {commit.hexsha!r}\n" + f"Author: {commit.author!r}\n" f"Date: {commit.authored_datetime}\n" - f"Message: {commit.message}\n" + f"Message: {commit.message!r}\n" ) return log From abd24f63f8db83a93a746a8e29eaf6f3d01828a8 Mon Sep 17 00:00:00 2001 From: Really Him Date: Mon, 12 May 2025 23:32:58 -0400 Subject: [PATCH 3/6] fix: use 'references' instead of 'refs' for pylance even though it's an alias --- src/git/src/mcp_server_git/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/git/src/mcp_server_git/server.py b/src/git/src/mcp_server_git/server.py index 7ca8c520fd..9d397c9605 100644 --- a/src/git/src/mcp_server_git/server.py +++ b/src/git/src/mcp_server_git/server.py @@ -111,7 +111,7 @@ def git_log(repo: git.Repo, max_count: int = 10) -> list[str]: def git_create_branch(repo: git.Repo, branch_name: str, base_branch: str | None = None) -> str: if base_branch: - base = repo.refs[base_branch] + base = repo.references[base_branch] else: base = repo.active_branch From 0ffd7013db3b19518007a4d25c48dc6add847275 Mon Sep 17 00:00:00 2001 From: Really Him Date: Mon, 12 May 2025 23:35:19 -0400 Subject: [PATCH 4/6] fix: fix f-strings --- src/git/src/mcp_server_git/server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/git/src/mcp_server_git/server.py b/src/git/src/mcp_server_git/server.py index 9d397c9605..3b13e28367 100644 --- a/src/git/src/mcp_server_git/server.py +++ b/src/git/src/mcp_server_git/server.py @@ -132,10 +132,10 @@ def git_init(repo_path: str) -> str: def git_show(repo: git.Repo, revision: str) -> str: commit = repo.commit(revision) output = [ - f"Commit: {commit.hexsha}\n" - f"Author: {commit.author}\n" - f"Date: {commit.authored_datetime}\n" - f"Message: {commit.message}\n" + f"Commit: {commit.hexsha!r}\n" + f"Author: {commit.author!r}\n" + f"Date: {commit.authored_datetime!r}\n" + f"Message: {commit.message!r}\n" ] if commit.parents: parent = commit.parents[0] From 7c5dcaf4617dc4a58b0dc627c1d6a9fb46d12d83 Mon Sep 17 00:00:00 2001 From: Really Him Date: Tue, 13 May 2025 00:14:22 -0400 Subject: [PATCH 5/6] chore: add py.typed --- src/git/pyproject.toml | 3 ++- src/git/src/mcp_server_git/py.typed | 0 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 src/git/src/mcp_server_git/py.typed diff --git a/src/git/pyproject.toml b/src/git/pyproject.toml index f25b33d064..96a6d5b51c 100644 --- a/src/git/pyproject.toml +++ b/src/git/pyproject.toml @@ -31,9 +31,10 @@ build-backend = "hatchling.build" [tool.uv] dev-dependencies = ["pyright>=1.1.389", "ruff>=0.7.3", "pytest>=8.0.0"] +typed=true [tool.pytest.ini_options] testpaths = ["tests"] python_files = "test_*.py" python_classes = "Test*" -python_functions = "test_*" \ No newline at end of file +python_functions = "test_*" diff --git a/src/git/src/mcp_server_git/py.typed b/src/git/src/mcp_server_git/py.typed new file mode 100644 index 0000000000..e69de29bb2 From 8e86d493469612d7a5d96eab53cd8c136d8d6715 Mon Sep 17 00:00:00 2001 From: Really Him Date: Tue, 13 May 2025 11:07:36 -0400 Subject: [PATCH 6/6] fix: pyproject --- src/git/pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/git/pyproject.toml b/src/git/pyproject.toml index 96a6d5b51c..1869135c60 100644 --- a/src/git/pyproject.toml +++ b/src/git/pyproject.toml @@ -31,7 +31,6 @@ build-backend = "hatchling.build" [tool.uv] dev-dependencies = ["pyright>=1.1.389", "ruff>=0.7.3", "pytest>=8.0.0"] -typed=true [tool.pytest.ini_options] testpaths = ["tests"]