Skip to contentSkip to conversation

stg export: check if there are any patches to export

PATCH New Pavel Roskin 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stg export: check if there are any patches to export

Otherwise, stg export fails with "list index out of range"

---

 stgit/commands/export.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
stgit/commands/export.py +3 -0
index 096fb68..b8ca133 100644
@@ -124,6 +124,9 @@ def func(parser, options, args):
     patches = applied[start_idx:stop_idx]
 
     num = len(patches)
+    if num == 0:
+        raise CmdException, 'No patches applied'
+
     zpadding = len(str(num))
     if zpadding < 2:
         zpadding = 2
Signature · 2 lines
Regards,
Pavel Roskin