chiark / gitweb /
stgit new: Do not open editor if --save-template was specified
authorGustav Hållberg <gustav@virtutech.com>
Fri, 31 Jul 2009 09:26:22 +0000 (11:26 +0200)
committerGustav Hållberg <gustav@virtutech.com>
Mon, 3 Aug 2009 13:59:09 +0000 (15:59 +0200)
Fixes side-effect of e58f264a "Add support for merge-friendly
branches".

Signed-off-by: Gustav Hållberg <gustav@virtutech.com>
stgit/commands/common.py
stgit/commands/new.py
stgit/commands/publish.py

index bc8266e0ae07dcb1cec9544b6130fdadcb7382a5..d64cce13336dd91ea097cd1e1f3db381ef054d1b 100644 (file)
@@ -462,7 +462,7 @@ def readonly_constant_property(f):
         return getattr(self, n)
     return property(new_f)
 
-def update_commit_data(cd, options, allow_edit = False):
+def update_commit_data(cd, options):
     """Return a new CommitData object updated according to the command line
     options."""
     # Set the commit message from commandline.
@@ -482,8 +482,9 @@ def update_commit_data(cd, options, allow_edit = False):
             add_sign_line(cd.message, sign_str,
                           cd.committer.name, cd.committer.email))
 
-    # Let user edit the commit message manually.
-    if allow_edit and not options.message:
+    # Let user edit the commit message manually, unless
+    # --save-template or --message was specified.
+    if not getattr(options, 'save_template', None) and not options.message:
         cd = cd.set_message(edit_string(cd.message, '.stgit-new.txt'))
 
     return cd
index 9fd51c3e5275b543f193dc007ac030873fe96487..741508a8844387f0e7a48df2e5908aad2796da80 100644 (file)
@@ -67,7 +67,7 @@ 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())
-    cd = common.update_commit_data(cd, options, allow_edit = True)
+    cd = common.update_commit_data(cd, options)
 
     if options.save_template:
         options.save_template(cd.message)
index 56dfd3f64b87fe2def079b1532df37705a94c051..cfd63a0b9eda40752875199bbea1d2ef41870c15 100644 (file)
@@ -73,7 +73,7 @@ def __create_commit(repository, tree, parents, options, message = ''):
     cd = git.CommitData(
         tree = tree, parents = parents, message = message,
         author = git.Person.author(), committer = git.Person.committer())
-    cd = common.update_commit_data(cd, options, allow_edit = True)
+    cd = common.update_commit_data(cd, options)
 
     return repository.commit(cd)