MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / commit_documentation

Method commit_documentation

codewiki/cli/git_manager.py:123–153  ·  view source on GitHub ↗

Commit generated documentation. Args: docs_path: Path to documentation directory message: Commit message (optional) Returns: Commit hash Raises: RepositoryError: If commit fails

(
        self,
        docs_path: Path,
        message: Optional[str] = None
    )

Source from the content-addressed store, hash-verified

121 raise RepositoryError(f"Failed to create branch: {e}")
122
123 def commit_documentation(
124 self,
125 docs_path: Path,
126 message: Optional[str] = None
127 ) -> str:
128 """
129 Commit generated documentation.
130
131 Args:
132 docs_path: Path to documentation directory
133 message: Commit message (optional)
134
135 Returns:
136 Commit hash
137
138 Raises:
139 RepositoryError: If commit fails
140 """
141 if message is None:
142 message = "Add generated documentation\n\nGenerated by CodeWiki CLI"
143
144 try:
145 # Add documentation files
146 self.repo.index.add([str(docs_path)])
147
148 # Commit
149 commit = self.repo.index.commit(message)
150
151 return commit.hexsha
152 except GitCommandError as e:
153 raise RepositoryError(f"Failed to commit documentation: {e}")
154
155 def get_remote_url(self, remote_name: str = "origin") -> Optional[str]:
156 """

Callers

nothing calls this directly

Calls 2

RepositoryErrorClass · 0.90
addMethod · 0.80

Tested by

no test coverage detected