Add support for merge-friendly branches
[stgit] / stgit / commands / new.py
index 067882a..9fd51c3 100644 (file)
@@ -28,7 +28,7 @@ description = """
 Create a new, empty patch on the current stack. The new patch is
 created on top of the currently applied patches, and is made the new
 top of the stack. Uncommitted changes in the work tree are not
-included in the patch -- that is handled by stglink:refresh[].
+included in the patch -- that is handled by linkstg:refresh[].
 
 The given name must be unique in the stack, and may only contain
 alphanumeric characters, dashes and underscores. If no name is given,
@@ -40,7 +40,7 @@ the patch, unless the '--message' flag already specified one. The
 editor."""
 
 args = []
-options = (argparse.author_committer_options()
+options = (argparse.author_options()
            + argparse.message_options(save_template = True)
            + argparse.sign_options())
 
@@ -67,33 +67,12 @@ def func(parser, options, args):
     cd = gitlib.CommitData(
         tree = stack.head.data.tree, parents = [stack.head], message = '',
         author = gitlib.Person.author(), committer = gitlib.Person.committer())
-
-    # Set patch commit message from commandline.
-    if options.message != None:
-        cd = cd.set_message(options.message)
-
-    # Modify author and committer data.
-    cd = (cd.set_author(options.author(cd.author))
-            .set_committer(options.committer(cd.committer)))
-
-    # Add Signed-off-by: or similar.
-    if options.sign_str != None:
-        sign_str = options.sign_str
-    else:
-        sign_str = config.get("stgit.autosign")
-
-    if sign_str != None:
-        cd = cd.set_message(
-            utils.add_sign_line(cd.message, sign_str,
-                                cd.committer.name, cd.committer.email))
+    cd = common.update_commit_data(cd, options, allow_edit = True)
 
     if options.save_template:
         options.save_template(cd.message)
         return utils.STGIT_SUCCESS
 
-    # Let user edit the commit message manually.
-    if not options.message:
-        cd = cd.set_message(utils.edit_string(cd.message, '.stgit-new.txt'))
     if name == None:
         name = utils.make_patch_name(cd.message,
                                      lambda name: stack.patches.exists(name))