diff --git a/git_pw/patch.py b/git_pw/patch.py index 0ae9111..23d36ea 100644 --- a/git_pw/patch.py +++ b/git_pw/patch.py @@ -26,6 +26,7 @@ 'State', 'Archived', 'Delegate', + 'Series', ) _sort_fields = ('id', '-id', 'name', '-name', 'date', '-date') _default_states = ( @@ -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([]) diff --git a/releasenotes/notes/patch-list-series-column-80217e480f850026.yaml b/releasenotes/notes/patch-list-series-column-80217e480f850026.yaml new file mode 100644 index 0000000..18f2092 --- /dev/null +++ b/releasenotes/notes/patch-list-series-column-80217e480f850026.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + ``git pw patch list`` now shows a ``Series`` column with the ID of the + series each patch belongs to. diff --git a/tests/test_patch.py b/tests/test_patch.py index 198e11b..78b6272 100644 --- a/tests/test_patch.py +++ b/tests/test_patch.py @@ -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.