From a6b7ae5ab8097833c0d1e09bba2fac2d9ce6f952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= Date: Thu, 3 Sep 2026 14:48:27 +0200 Subject: [PATCH] Show series ID in patch list output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a 'Series' column to 'git pw patch list' with the ID of the series each patch belongs to. Assisted-by: Claude:claude-sonnet-5 Signed-off-by: Raphaël Mélotte --- git_pw/patch.py | 4 ++++ ...atch-list-series-column-80217e480f850026.yaml | 5 +++++ tests/test_patch.py | 16 ++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 releasenotes/notes/patch-list-series-column-80217e480f850026.yaml 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.