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
)
| 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 | """ |
nothing calls this directly
no test coverage detected