Patchwork [9,of,9] cmdutil: omit redundant "savecommitmessage()" in "tryimportone()"

login
register
mail settings
Submitter Katsunori FUJIWARA
Date May 5, 2014, 12:33 p.m.
Message ID <ad9e8d71ce784496fe98.1399293189@feefifofum>
Download mbox | patch
Permalink /patch/4640/
State Accepted
Commit 244b177a152ec95d01935fb49cfc5e7386898d9c
Headers show

Comments

Katsunori FUJIWARA - May 5, 2014, 12:33 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1399292800 -32400
#      Mon May 05 21:26:40 2014 +0900
# Branch stable
# Node ID ad9e8d71ce784496fe98e5fd33f18af30787db67
# Parent  24416f80f94093cfb1f9699dfa09d794b194db53
cmdutil: omit redundant "savecommitmessage()" in "tryimportone()"

The preceding patch causes that "makememctx()" with "editor" argument
saves (manually edited) commit message into ".hg/last-message.txt":
saving itself is executed indirectly in "memctx.__init__()".

This makes it redundant to invoke "savecommitmessage()" on caller side
of "makememctx()".

This patch omits such redundant "savecommitmessage()" invocation in
"tryimportone()".

"tryimportone()" uses one of "commiteditor" or "commitforceeditor" as
"editor" argument, and this causes saving commit message always.
Sean Farley - May 6, 2014, 8:12 p.m.
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> writes:

> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1399292800 -32400
> #      Mon May 05 21:26:40 2014 +0900
> # Branch stable
> # Node ID ad9e8d71ce784496fe98e5fd33f18af30787db67
> # Parent  24416f80f94093cfb1f9699dfa09d794b194db53
> cmdutil: omit redundant "savecommitmessage()" in "tryimportone()"

I like this series :-) A few comments / questions (that shouldn't affect
accepting these patches):

- is this work paving the way for reusing a previous commit message,
  say, in 'hg ci --amend' without having to launch the editor?

- are you considering moving localrepo.savecommitmessage to
  committablectx? (see below for my motivation)

- (marmoute, mpm) this series conflicts with my work on memctx and
  moving localrepo.commit to committablectx.commit but that's not a big
  deal; I can rebase my work on top of this series and send my patches
  afterwards
Katsunori FUJIWARA - May 7, 2014, 2:15 p.m.
At Tue, 06 May 2014 15:12:28 -0500,
Sean Farley wrote:
> 
> 
> FUJIWARA Katsunori <foozy@lares.dti.ne.jp> writes:
> 
> > # HG changeset patch
> > # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> > # Date 1399292800 -32400
> > #      Mon May 05 21:26:40 2014 +0900
> > # Branch stable
> > # Node ID ad9e8d71ce784496fe98e5fd33f18af30787db67
> > # Parent  24416f80f94093cfb1f9699dfa09d794b194db53
> > cmdutil: omit redundant "savecommitmessage()" in "tryimportone()"
> 
> I like this series :-) A few comments / questions (that shouldn't affect
> accepting these patches):
>
> - is this work paving the way for reusing a previous commit message,
>   say, in 'hg ci --amend' without having to launch the editor?

Do you mean some kind of automation around reusing
".hg/last-message.txt" and invocation of commit message editor ?

If so, this series doesn't focus on paving the way for it.


> - are you considering moving localrepo.savecommitmessage to
>   committablectx? (see below for my motivation)

Oh, I don't notice that refactoring point !

My direction is just to (1) make all (commit log like) message
editing use one of "commiteditor" or "commitforceeditor" (2) in the
simple way.

  (1) now, some commands still use "ui.edit()" directly

  (2) replace explicit "opts['edit']" checks and direct references to
      "commit*editor" by introducing the specific utility function

So, patch #6 in this series is only one for "context.py" around this
working.


> - (marmoute, mpm) this series conflicts with my work on memctx and
>   moving localrepo.commit to committablectx.commit but that's not a big
>   deal; I can rebase my work on top of this series and send my patches
>   afterwards


----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy@lares.dti.ne.jp

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -654,7 +654,6 @@ 
                                             opts.get('date') or date,
                                             branch, files, store,
                                             editor=commiteditor)
-                repo.savecommitmessage(memctx.description())
                 n = memctx.commit()
             finally:
                 store.close()