Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Features
--------

* Configure multiple working repositories.
* Batch git_ command with subcommands `add`, `checkout`, `commit`, `pull`, `push`, `reset` and `status`.
* Batch git_ command with subcommands `add`, `checkout`, `commit`, `diff`, `pull`, `push`, `reset` and `status`.
* Batch create/close/reopen issues, create pull requests, merge pull requests and delete branches by name on GitHub.
* Batch poetry commands such as `version patch`, `install`, `update` or `add`.

Expand Down
10 changes: 10 additions & 0 deletions src/git_portfolio/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ def commit(args: tuple[str]) -> res.ResponseFailure | res.ResponseSuccess:
)


@main.command("diff", context_settings={"ignore_unknown_options": True})
@click.argument("args", nargs=-1)
@gitp_config_check
def diff(args: tuple[str]) -> res.ResponseFailure | res.ResponseSuccess:
"""Batch `git diff` command."""
return git.GitUseCase().execute(
CONFIG_MANAGER.config.github_selected_repos, "diff", args
)


@main.command("pull", context_settings={"ignore_unknown_options": True})
@click.argument("args", nargs=-1)
@gitp_config_check
Expand Down
11 changes: 11 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,17 @@ def test_commit_success(
)


def test_diff_success(
mock_git_use_case: MockerFixture,
mock_config_manager: MockerFixture,
runner: CliRunner,
) -> None:
"""It calls diff."""
runner.invoke(git_portfolio.__main__.main, ["diff"], prog_name="gitp")

mock_git_use_case.return_value.execute.assert_called_once_with([REPO], "diff", ())


def test_pull_success(
mock_git_use_case: MockerFixture,
mock_config_manager: MockerFixture,
Expand Down