[PATCH] Really fix import --edit invoking editor twice
[stgit] / stgit / commands / imprt.py
index 9dccaf9..e75536b 100644 (file)
@@ -45,6 +45,9 @@ options = [make_option('-m', '--mail',
            make_option('-e', '--edit',
                        help = 'invoke an editor for the patch description',
                        action = 'store_true'),
+           make_option('-s', '--showpatch',
+                       help = 'show the patch content in the editor buffer',
+                       action = 'store_true'),
            make_option('-a', '--author', metavar = '"NAME <EMAIL>"',
                        help = 'use "NAME <EMAIL>" as the author details'),
            make_option('--authname',
@@ -172,9 +175,10 @@ def func(parser, options, args):
         message, author_name, author_email, author_date = \
                  __parse_patch(filename)
 
-    # new_patch() will invoke the editor in this case
+    # refresh_patch() will invoke the editor in this case, with correct
+    # patch content
     if not message:
-        edit = False
+        can_edit = False
 
     # override the automatically parsed settings
     if options.authname:
@@ -188,7 +192,7 @@ def func(parser, options, args):
     if options.commemail:
         committer_email = options.commemail
 
-    crt_series.new_patch(patch, message = message,
+    crt_series.new_patch(patch, message = message, can_edit = False,
                          author_name = author_name,
                          author_email = author_email,
                          author_date = author_date,
@@ -199,7 +203,8 @@ def func(parser, options, args):
     sys.stdout.flush()
 
     git.apply_patch(filename)
-    crt_series.refresh_patch(edit = options.edit)
+    crt_series.refresh_patch(edit = options.edit,
+                             show_patch = options.showpatch)
 
     print 'done'
     print_crt_patch()