From c391c4c17fb67567bad4a28f0010e59378426956 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Wed, 10 Feb 2010 15:14:27 +0000 Subject: [PATCH] Fix _command_list() function for empty command sets The alias commands are not real StGit commands and the corresponding set (kind) defined in stgit/commands/__init__.py is empty. This leads to a KeyError in the _command_list() function. The patch ignores empty sets. Signed-off-by: Catalin Marinas --- stgit/commands/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stgit/commands/__init__.py b/stgit/commands/__init__.py index f9de42b..bf07c82 100644 --- a/stgit/commands/__init__.py +++ b/stgit/commands/__init__.py @@ -69,7 +69,10 @@ def _command_list(commands): kinds.setdefault(kind, {})[cmd] = help for kind in _kind_order: kind = _kinds[kind] - yield kind, sorted(kinds[kind].iteritems()) + try: + yield kind, sorted(kinds[kind].iteritems()) + except KeyError: + pass def pretty_command_list(commands, f): cmd_len = max(len(cmd) for cmd in commands.iterkeys()) -- 2.11.0