Add a common function for reading template files
[stgit] / stgit / commands / new.py
index 9efecc1..2c1e94b 100644 (file)
@@ -29,15 +29,16 @@ usage = """%prog [options] <name>
 
 Create a new, empty patch and make it the topmost one. If the
 '--message' option is not passed, an editor is invoked with the
-.git/patchdescr.tmpl file used a as template, together with generated
-lines. By default, if there are local changes in the working tree, the
-command fails and a 'refresh' command is needed. This behaviour can be
-overridden with the '--force' option."""
+.git/patchdescr.tmpl, ~/.stgit/templates/patchdescr.tmpl or
+/usr/share/stgit/templates/patchdescr.tmpl file used a as template,
+together with generated lines. By default, the local changes in the
+working tree are not included in the patch. A 'refresh' command is
+needed for this."""
 
 options = [make_option('-m', '--message',
                        help = 'use MESSAGE as the patch description'),
-           make_option('--force',
-                       help = 'proceed even if there are local changes',
+           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'),
@@ -59,15 +60,14 @@ def func(parser, options, args):
     if len(args) != 1:
         parser.error('incorrect number of arguments')
 
-    if not options.force:
-        check_local_changes()
-        check_conflicts()
-        check_head_top_equal()
+    check_conflicts()
+    check_head_top_equal()
 
     if options.author:
         options.authname, options.authemail = name_email(options.author)
 
     crt_series.new_patch(args[0], message = options.message,
+                         show_patch = options.showpatch,
                          author_name = options.authname,
                          author_email = options.authemail,
                          author_date = options.authdate,