From: Gustav HÃ¥llberg Date: Fri, 31 Jul 2009 09:26:22 +0000 (+0200) Subject: stgit new: Do not open editor if --save-template was specified X-Git-Tag: v0.15-rc2~11^2~51 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/af734f49ec94f8a98e56f173bfa3640d0bdeffa0 stgit new: Do not open editor if --save-template was specified Fixes side-effect of e58f264a "Add support for merge-friendly branches". Signed-off-by: Gustav HÃ¥llberg --- diff --git a/stgit/commands/common.py b/stgit/commands/common.py index bc8266e..d64cce1 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -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 diff --git a/stgit/commands/new.py b/stgit/commands/new.py index 9fd51c3..741508a 100644 --- a/stgit/commands/new.py +++ b/stgit/commands/new.py @@ -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) diff --git a/stgit/commands/publish.py b/stgit/commands/publish.py index 56dfd3f..cfd63a0 100644 --- a/stgit/commands/publish.py +++ b/stgit/commands/publish.py @@ -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)