File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -448,6 +448,18 @@ def reset_repo(name):
448448 )
449449
450450
451+ @repo .command ()
452+ def show (
453+ ctx : typer .Context ,
454+ repo_name : str = typer .Argument (..., help = "Repository name" ),
455+ commit_hash : str = typer .Argument (..., help = "Commit hash to show" ),
456+ ):
457+ """Show the git diff for a specific commit hash in the given repository."""
458+ repo = Repo ()
459+ repo .ctx = ctx
460+ repo .show_commit (repo_name , commit_hash )
461+
462+
451463@repo .command ()
452464def set_default (
453465 repo_name : str = typer .Argument (None ),
Original file line number Diff line number Diff line change @@ -466,6 +466,19 @@ def get_repo_diff(self, repo_name: str) -> None:
466466 except GitCommandError as e :
467467 self .err (f"❌ Failed to diff working tree: { e } " )
468468
469+ def show_commit (self , repo_name : str , commit_hash : str ) -> None :
470+ """Show the diff for a specific commit hash in the given repository."""
471+ self .info (f"Showing diff for { repo_name } @{ commit_hash } " )
472+ path , repo = self .ensure_repo (repo_name )
473+ if not repo or not path :
474+ return
475+
476+ try :
477+ output = repo .git .show (commit_hash )
478+ typer .echo (output )
479+ except GitCommandError as e :
480+ self .err (f"❌ Failed to show commit { commit_hash } : { e } " )
481+
469482 def _list_repos (self ) -> tuple [set , set ]:
470483 map_repos = set (self .map .keys ())
471484
You can’t perform that action at this time.
0 commit comments