Skip to content
Open
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
4 changes: 4 additions & 0 deletions git_pw/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
'State',
'Archived',
'Delegate',
'Series',
)
_sort_fields = ('id', '-id', 'name', '-name', 'date', '-date')
_default_states = (
Expand Down Expand Up @@ -451,6 +452,9 @@ def list_cmd(
patch.get('state'),
'yes' if patch.get('archived') else 'no',
(patch.get('delegate') or {}).get('username', ''),
','.join(
str(series.get('id')) for series in patch.get('series') or []
),
]

output.append([])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
features:
- |
``git pw patch list`` now shows a ``Series`` column with the ID of the
series each patch belongs to.
16 changes: 16 additions & 0 deletions tests/test_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,22 @@ def test_list_with_formatting(self, mock_echo, mock_index, mock_version):
mock.ANY, ('ID', 'Name'), fmt='simple'
)

def test_list_with_series_column(
self, mock_echo, mock_index, mock_version
):
"""Validate that the series ID is included in the output."""

rsp = [self._get_patch()]
mock_index.return_value = rsp

runner = CLIRunner()
result = runner.invoke(patch.list_cmd, [])

assert result.exit_code == 0, result

output = mock_echo.call_args[0][0]
assert output[0][-1] == '321'

def test_list_with_filters(self, mock_echo, mock_index, mock_version):
"""Validate behavior with filters applied.

Expand Down