From d2a327a89c3eec6688a1b5b65ef3ab86552bc972 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Tue, 5 Dec 2006 22:07:24 +0000 Subject: [PATCH] Fix "series -d" when the patch description is empty Signed-off-by: Catalin Marinas --- TODO | 24 ------------------------ stgit/commands/series.py | 2 +- 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/TODO b/TODO index 3b07ff6..549bc9d 100644 --- a/TODO +++ b/TODO @@ -28,27 +28,3 @@ The future, when time allows or if someone else does them: they have scripts for moving the changes in one to the others) - numeric shortcuts for naming patches near top (eg. +1, -2) - (config?) parameter for number of patches included by "series -s" - -Bugs: - -- patch created with empty description ("stg new" and quit editor -without saving) confuse "series -d": -|$ stg series -ds -|+ p5 | p5 -|Traceback (most recent call last): -| File "/usr/bin/stg", line 43, in ? -| main() -| File "/var/lib/python-support/python2.4/stgit/main.py", line 261, in main -| command.func(parser, options, args) -| File "/var/lib/python-support/python2.4/stgit/commands/series.py", line 107, in func -| __print_patch(applied[-1], '> ', '0>', max_len, options) -| File "/var/lib/python-support/python2.4/stgit/commands/series.py", line 63, in __print_patch -| print prefix + patch.ljust(length) + ' | ' + __get_description(patch) -| File "/var/lib/python-support/python2.4/stgit/commands/series.py", line 55, in __get_description -| descr = p.get_description().strip() -|AttributeError: 'NoneType' object has no attribute 'strip' -|dwitch@gandelf:/export/work/yann/git/foo/a$ stg series -|+ p5 -|> y -|$ cat .git/patches/master/patches/y/description -|cat: .git/patches/master/patches/y/description: No such file or directory diff --git a/stgit/commands/series.py b/stgit/commands/series.py index 105eeb9..58c706c 100644 --- a/stgit/commands/series.py +++ b/stgit/commands/series.py @@ -55,7 +55,7 @@ def __get_description(patch): """Extract and return a patch's short description """ p = crt_series.get_patch(patch) - descr = p.get_description().strip() + descr = (p.get_description() or '').strip() descr_lines = descr.split('\n') return descr_lines[0].rstrip() -- 2.11.0