X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/fcee87cf868f18a3d684c3ba71232574f92c7b11..fa08ec0858ea909d724009ac4dbbac17fbbf2515:/stgit/commands/new.py diff --git a/stgit/commands/new.py b/stgit/commands/new.py index 1779d9c..c968eaf 100644 --- a/stgit/commands/new.py +++ b/stgit/commands/new.py @@ -25,10 +25,25 @@ from stgit import stack, git help = 'create a new patch and make it the topmost one' -usage = '%prog [options] ' +usage = """%prog [options] + +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.""" options = [make_option('-m', '--message', help = 'use MESSAGE as the patch description'), + make_option('--force', + help = 'proceed even if there are local changes', + 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 "', + help = 'use "NAME " as the author details'), make_option('--authname', help = 'use AUTHNAME as the author name'), make_option('--authemail', @@ -47,11 +62,18 @@ def func(parser, options, args): if len(args) != 1: parser.error('incorrect number of arguments') - check_local_changes() - check_conflicts() - check_head_top_equal() + if not options.force: + check_local_changes() + check_conflicts() + check_head_top_equal() + # No local changes -> no patch to show + options.showpatch = False + + 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,