Patchwork [stable] histedit: add "amnd" command to fold commit data and drop message (issue4256)

login
register
mail settings
Submitter adgar@google.com
Date Aug. 7, 2014, 6:43 p.m.
Message ID <8723c4a5b7256ce436bd.1407437002@adgar.nyc.corp.google.com>
Download mbox | patch
Permalink /patch/5315/
State Changes Requested
Headers show

Comments

adgar@google.com - Aug. 7, 2014, 6:43 p.m.
# HG changeset patch
# User Mike Edgar <adgar@google.com>
# Date 1407358301 14400
#      Wed Aug 06 16:51:41 2014 -0400
# Node ID 8723c4a5b7256ce436bdaf8476c18b0f2c875fff
# Parent  4354b1e35f533f72d5b6ccc76e8bc742f8cb5257
histedit: add "amnd" command to fold commit data and drop message (issue4256)

This new histedit command (short for "amend") acts like "hg amend" does for
working copy: it accumulates changes without interrupting the user and asking
for an updated commit message.
Augie Fackler - Aug. 7, 2014, 8:05 p.m.
On Aug 7, 2014, at 2:43 PM, adgar@google.com wrote:

> # HG changeset patch
> # User Mike Edgar <adgar@google.com>
> # Date 1407358301 14400
> #      Wed Aug 06 16:51:41 2014 -0400
> # Node ID 8723c4a5b7256ce436bdaf8476c18b0f2c875fff
> # Parent  4354b1e35f533f72d5b6ccc76e8bc742f8cb5257
> histedit: add "amnd" command to fold commit data and drop message (issue4256)

Probably didn't mean to --flag stable this?

> This new histedit command (short for "amend") acts like "hg amend" does for
> working copy: it accumulates changes without interrupting the user and asking
> for an updated commit message.

Note for folks on the list: I'm not crazy about 'amnd' here, but 'fixup' seems like a bummer because it wouldn't have an obvious short character (f already being taken by fold). Anyone have a brilliant idea?

> 
> diff -r 4354b1e35f53 -r 8723c4a5b725 hgext/histedit.py
> --- a/hgext/histedit.py	Wed Aug 06 12:16:58 2014 -0500
> +++ b/hgext/histedit.py	Wed Aug 06 16:51:41 2014 -0400
> @@ -36,6 +36,7 @@
>  #  p, pick = use commit
>  #  e, edit = use commit, but stop for amending
>  #  f, fold = use commit, but combine it with the one above
> + #  a, amnd = add commit content to one above, dropping message (hg amend)
>  #  d, drop = remove commit from history
>  #  m, mess = edit message without changing commit content
>  #
> @@ -57,6 +58,7 @@
>  #  p, pick = use commit
>  #  e, edit = use commit, but stop for amending
>  #  f, fold = use commit, but combine it with the one above
> + #  a, amnd = add commit content to one above, dropping message (hg amend)
>  #  d, drop = remove commit from history
>  #  m, mess = edit message without changing commit content
>  #
> @@ -179,6 +181,7 @@
> #  p, pick = use commit
> #  e, edit = use commit, but stop for amending
> #  f, fold = use commit, but combine it with the one above
> +#  a, amnd = add commit content to one above, dropping message (hg amend)
> #  d, drop = remove commit from history
> #  m, mess = edit message without changing commit content
> #
> @@ -293,7 +296,9 @@
>     extra = commitopts.get('extra')
> 
>     parents = (first.p1().node(), first.p2().node())
> -    editor = cmdutil.getcommiteditor(edit=True, editform='histedit.fold')
> +    editor = None
> +    if not commitopts.get('amend'):
> +        editor = cmdutil.getcommiteditor(edit=True, editform='histedit.fold')
>     new = context.memctx(repo,
>                          parents=parents,
>                          text=message,
> @@ -335,6 +340,11 @@
>         _('Make changes as needed, you may commit or record as needed now.\n'
>           'When you are finished, run hg histedit --continue to resume.'))
> 
> +def amend(ui, repo, ctx, ha, opts):
> +    amendopts = opts.copy()
> +    amendopts['amend'] = True
> +    return fold(ui, repo, ctx, ha, amendopts)
> +
> def fold(ui, repo, ctx, ha, opts):
>     oldctx = repo[ha]
>     hg.update(repo, ctx.node())
> @@ -362,10 +372,13 @@
>         username = ui.username()
>     commitopts['user'] = username
>     # commit message
> -    newmessage = '\n***\n'.join(
> -        [ctx.description()] +
> -        [repo[r].description() for r in internalchanges] +
> -        [oldctx.description()]) + '\n'
> +    if opts.get('amend'):
> +        newmessage = ctx.description()
> +    else:
> +        newmessage = '\n***\n'.join(
> +            [ctx.description()] +
> +            [repo[r].description() for r in internalchanges] +
> +            [oldctx.description()]) + '\n'
>     commitopts['message'] = newmessage
>     # date
>     commitopts['date'] = max(ctx.date(), oldctx.date())
> @@ -446,6 +459,8 @@
>                'edit': edit,
>                'f': fold,
>                'fold': fold,
> +               'a': amend,
> +               'amnd': amend,
>                'd': drop,
>                'drop': drop,
>                'm': message,
> @@ -681,7 +696,7 @@
>     m, a, r, d = repo.status()[:4]
>     if m or a or r or d:
>         # prepare the message for the commit to comes
> -        if action in ('f', 'fold'):
> +        if action in ('f', 'fold', 'a', 'amnd'):
>             message = 'fold-temp-revision %s' % currentnode
>         else:
>             message = ctx.description()
> @@ -704,15 +719,19 @@
>         # to parent.
>         replacements.append((ctx.node(), tuple(newchildren)))
> 
> -    if action in ('f', 'fold'):
> +    if action in ('f', 'fold', 'a', 'amnd'):
>         if newchildren:
>             # finalize fold operation if applicable
>             if new is None:
>                 new = newchildren[-1]
>             else:
>                 newchildren.pop()  # remove new from internal changes
> -            parentctx, repl = finishfold(ui, repo, parentctx, ctx, new, opts,
> -                                         newchildren)
> +            foldopts = opts
> +            if action in ('a', 'amnd'):
> +                foldopts = foldopts.copy()
> +                foldopts['amend'] = True
> +            parentctx, repl = finishfold(ui, repo, parentctx, ctx, new,
> +                                         foldopts, newchildren)
>             replacements.extend(repl)
>         else:
>             # newchildren is empty if the fold did not result in any commit
> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-arguments.t
> --- a/tests/test-histedit-arguments.t	Wed Aug 06 12:16:58 2014 -0500
> +++ b/tests/test-histedit-arguments.t	Wed Aug 06 16:51:41 2014 -0400
> @@ -57,6 +57,7 @@
>   #  p, pick = use commit
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>   #  d, drop = remove commit from history
>   #  m, mess = edit message without changing commit content
>   #
> @@ -255,6 +256,7 @@
>   #  p, pick = use commit
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>   #  d, drop = remove commit from history
>   #  m, mess = edit message without changing commit content
>   #
> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-bookmark-motion.t
> --- a/tests/test-histedit-bookmark-motion.t	Wed Aug 06 12:16:58 2014 -0500
> +++ b/tests/test-histedit-bookmark-motion.t	Wed Aug 06 16:51:41 2014 -0400
> @@ -73,6 +73,7 @@
>   #  p, pick = use commit
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>   #  d, drop = remove commit from history
>   #  m, mess = edit message without changing commit content
>   #
> @@ -133,6 +134,7 @@
>   #  p, pick = use commit
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>   #  d, drop = remove commit from history
>   #  m, mess = edit message without changing commit content
>   #
> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-commute.t
> --- a/tests/test-histedit-commute.t	Wed Aug 06 12:16:58 2014 -0500
> +++ b/tests/test-histedit-commute.t	Wed Aug 06 16:51:41 2014 -0400
> @@ -67,6 +67,7 @@
>   #  p, pick = use commit
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>   #  d, drop = remove commit from history
>   #  m, mess = edit message without changing commit content
>   #
> @@ -344,6 +345,7 @@
>   #  p, pick = use commit
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>   #  d, drop = remove commit from history
>   #  m, mess = edit message without changing commit content
>   #
> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-fold.t
> --- a/tests/test-histedit-fold.t	Wed Aug 06 12:16:58 2014 -0500
> +++ b/tests/test-histedit-fold.t	Wed Aug 06 16:51:41 2014 -0400
> @@ -105,6 +105,50 @@
> 
> 
> 
> +amend will fold without preserving the folded commit's message
> +
> +  $ hg histedit d2ae7f538514 --commands - 2>&1 <<EOF | fixbundle
> +  > pick d2ae7f538514 b
> +  > amnd ee283cb5f2d5 e
> +  > pick 6de59d13424a f
> +  > pick 9c277da72c9b d
> +  > EOF
> +  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
> +  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +
> +log after edit
> +  $ hg logt --graph
> +  @  3:c4a9eb7989fc d
> +  |
> +  o  2:8e03a72b6f83 f
> +  |
> +  o  1:391ee782c689 b
> +  |
> +  o  0:cb9a9f314b8b a
> +  
> +
> +description is taken from amended commit
> +
> +  $ hg log --debug --rev 1
> +  changeset:   1:391ee782c68930be438ccf4c6a403daedbfbffa5
> +  phase:       draft
> +  parent:      0:cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
> +  parent:      -1:0000000000000000000000000000000000000000
> +  manifest:    1:b5e112a3a8354e269b1524729f0918662d847c38
> +  user:        test
> +  date:        Thu Jan 01 00:00:00 1970 +0000
> +  files+:      b e
> +  extra:       branch=default
> +  extra:       histedit_source=d2ae7f538514cd87c17547b0de4cea71fe1af9fb,ee283cb5f2d5955443f23a27b697a04339e9a39a
> +  description:
> +  b
> +  
> +  
> +
> check saving last-message.txt
> 
>   $ cat > $TESTTMP/abortfolding.py <<EOF
> @@ -128,9 +172,9 @@
>> EOF
> 
>   $ rm -f .hg/last-message.txt
> -  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 6de59d13424a --commands - 2>&1 <<EOF | fixbundle
> -  > pick 6de59d13424a f
> -  > fold 9c277da72c9b d
> +  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 8e03a72b6f83 --commands - 2>&1 <<EOF | fixbundle
> +  > pick 8e03a72b6f83 f
> +  > fold c4a9eb7989fc d
>> EOF
>   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
>   allow non-folding commit
> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-obsolete.t
> --- a/tests/test-histedit-obsolete.t	Wed Aug 06 12:16:58 2014 -0500
> +++ b/tests/test-histedit-obsolete.t	Wed Aug 06 16:51:41 2014 -0400
> @@ -57,6 +57,7 @@
>   #  p, pick = use commit
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>   #  d, drop = remove commit from history
>   #  m, mess = edit message without changing commit content
>   #
> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-outgoing.t
> --- a/tests/test-histedit-outgoing.t	Wed Aug 06 12:16:58 2014 -0500
> +++ b/tests/test-histedit-outgoing.t	Wed Aug 06 16:51:41 2014 -0400
> @@ -49,6 +49,7 @@
>   #  p, pick = use commit
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>   #  d, drop = remove commit from history
>   #  m, mess = edit message without changing commit content
>   #
> @@ -80,6 +81,7 @@
>   #  p, pick = use commit
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>   #  d, drop = remove commit from history
>   #  m, mess = edit message without changing commit content
>   #
> @@ -103,6 +105,7 @@
>   #  p, pick = use commit
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>   #  d, drop = remove commit from history
>   #  m, mess = edit message without changing commit content
>   #
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Pierre-Yves David - Aug. 7, 2014, 8:40 p.m.
On 08/07/2014 11:43 AM, adgar@google.com wrote:
> # HG changeset patch
> # User Mike Edgar <adgar@google.com>
> # Date 1407358301 14400
> #      Wed Aug 06 16:51:41 2014 -0400
> # Node ID 8723c4a5b7256ce436bdaf8476c18b0f2c875fff
> # Parent  4354b1e35f533f72d5b6ccc76e8bc742f8cb5257
> histedit: add "amnd" command to fold commit data and drop message (issue4256)

"amnd" is a fairly cryptic. How about shortening it the same was as 
message? That would give use "amen".

On longer terms we could allow any subset of the command to be used (As 
we do for mercurial command line). a, amen and amend would be used. 
(Same would apply for others (eg: m, mess, messa, message)


>
> This new histedit command (short for "amend") acts like "hg amend" does for
> working copy: it accumulates changes without interrupting the user and asking
> for an updated commit message.
>
> diff -r 4354b1e35f53 -r 8723c4a5b725 hgext/histedit.py
> --- a/hgext/histedit.py	Wed Aug 06 12:16:58 2014 -0500
> +++ b/hgext/histedit.py	Wed Aug 06 16:51:41 2014 -0400
> @@ -36,6 +36,7 @@
>    #  p, pick = use commit
>    #  e, edit = use commit, but stop for amending
>    #  f, fold = use commit, but combine it with the one above
> + #  a, amnd = add commit content to one above, dropping message (hg amend)
>    #  d, drop = remove commit from history
>    #  m, mess = edit message without changing commit content
>    #
> @@ -57,6 +58,7 @@
>    #  p, pick = use commit
>    #  e, edit = use commit, but stop for amending
>    #  f, fold = use commit, but combine it with the one above
> + #  a, amnd = add commit content to one above, dropping message (hg amend)
>    #  d, drop = remove commit from history
>    #  m, mess = edit message without changing commit content
>    #
> @@ -179,6 +181,7 @@
>   #  p, pick = use commit
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> +#  a, amnd = add commit content to one above, dropping message (hg amend)
>   #  d, drop = remove commit from history
>   #  m, mess = edit message without changing commit content
>   #
> @@ -293,7 +296,9 @@
>       extra = commitopts.get('extra')
>
>       parents = (first.p1().node(), first.p2().node())
> -    editor = cmdutil.getcommiteditor(edit=True, editform='histedit.fold')
> +    editor = None
> +    if not commitopts.get('amend'):
> +        editor = cmdutil.getcommiteditor(edit=True, editform='histedit.fold')
>       new = context.memctx(repo,
>                            parents=parents,
>                            text=message,
> @@ -335,6 +340,11 @@
>           _('Make changes as needed, you may commit or record as needed now.\n'
>             'When you are finished, run hg histedit --continue to resume.'))
>
> +def amend(ui, repo, ctx, ha, opts):
> +    amendopts = opts.copy()
> +    amendopts['amend'] = True
> +    return fold(ui, repo, ctx, ha, amendopts)
> +
>   def fold(ui, repo, ctx, ha, opts):
>       oldctx = repo[ha]
>       hg.update(repo, ctx.node())
> @@ -362,10 +372,13 @@
>           username = ui.username()
>       commitopts['user'] = username
>       # commit message
> -    newmessage = '\n***\n'.join(
> -        [ctx.description()] +
> -        [repo[r].description() for r in internalchanges] +
> -        [oldctx.description()]) + '\n'
> +    if opts.get('amend'):
> +        newmessage = ctx.description()
> +    else:
> +        newmessage = '\n***\n'.join(
> +            [ctx.description()] +
> +            [repo[r].description() for r in internalchanges] +
> +            [oldctx.description()]) + '\n'
>       commitopts['message'] = newmessage
>       # date
>       commitopts['date'] = max(ctx.date(), oldctx.date())
> @@ -446,6 +459,8 @@
>                  'edit': edit,
>                  'f': fold,
>                  'fold': fold,
> +               'a': amend,
> +               'amnd': amend,
>                  'd': drop,
>                  'drop': drop,
>                  'm': message,
> @@ -681,7 +696,7 @@
>       m, a, r, d = repo.status()[:4]
>       if m or a or r or d:
>           # prepare the message for the commit to comes
> -        if action in ('f', 'fold'):
> +        if action in ('f', 'fold', 'a', 'amnd'):
>               message = 'fold-temp-revision %s' % currentnode
>           else:
>               message = ctx.description()
> @@ -704,15 +719,19 @@
>           # to parent.
>           replacements.append((ctx.node(), tuple(newchildren)))
>
> -    if action in ('f', 'fold'):
> +    if action in ('f', 'fold', 'a', 'amnd'):
>           if newchildren:
>               # finalize fold operation if applicable
>               if new is None:
>                   new = newchildren[-1]
>               else:
>                   newchildren.pop()  # remove new from internal changes
> -            parentctx, repl = finishfold(ui, repo, parentctx, ctx, new, opts,
> -                                         newchildren)
> +            foldopts = opts
> +            if action in ('a', 'amnd'):
> +                foldopts = foldopts.copy()
> +                foldopts['amend'] = True
> +            parentctx, repl = finishfold(ui, repo, parentctx, ctx, new,
> +                                         foldopts, newchildren)
>               replacements.extend(repl)
>           else:
>               # newchildren is empty if the fold did not result in any commit
> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-arguments.t
> --- a/tests/test-histedit-arguments.t	Wed Aug 06 12:16:58 2014 -0500
> +++ b/tests/test-histedit-arguments.t	Wed Aug 06 16:51:41 2014 -0400
> @@ -57,6 +57,7 @@
>     #  p, pick = use commit
>     #  e, edit = use commit, but stop for amending
>     #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>     #  d, drop = remove commit from history
>     #  m, mess = edit message without changing commit content
>     #
> @@ -255,6 +256,7 @@
>     #  p, pick = use commit
>     #  e, edit = use commit, but stop for amending
>     #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>     #  d, drop = remove commit from history
>     #  m, mess = edit message without changing commit content
>     #
> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-bookmark-motion.t
> --- a/tests/test-histedit-bookmark-motion.t	Wed Aug 06 12:16:58 2014 -0500
> +++ b/tests/test-histedit-bookmark-motion.t	Wed Aug 06 16:51:41 2014 -0400
> @@ -73,6 +73,7 @@
>     #  p, pick = use commit
>     #  e, edit = use commit, but stop for amending
>     #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>     #  d, drop = remove commit from history
>     #  m, mess = edit message without changing commit content
>     #
> @@ -133,6 +134,7 @@
>     #  p, pick = use commit
>     #  e, edit = use commit, but stop for amending
>     #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>     #  d, drop = remove commit from history
>     #  m, mess = edit message without changing commit content
>     #
> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-commute.t
> --- a/tests/test-histedit-commute.t	Wed Aug 06 12:16:58 2014 -0500
> +++ b/tests/test-histedit-commute.t	Wed Aug 06 16:51:41 2014 -0400
> @@ -67,6 +67,7 @@
>     #  p, pick = use commit
>     #  e, edit = use commit, but stop for amending
>     #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>     #  d, drop = remove commit from history
>     #  m, mess = edit message without changing commit content
>     #
> @@ -344,6 +345,7 @@
>     #  p, pick = use commit
>     #  e, edit = use commit, but stop for amending
>     #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>     #  d, drop = remove commit from history
>     #  m, mess = edit message without changing commit content
>     #
> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-fold.t
> --- a/tests/test-histedit-fold.t	Wed Aug 06 12:16:58 2014 -0500
> +++ b/tests/test-histedit-fold.t	Wed Aug 06 16:51:41 2014 -0400
> @@ -105,6 +105,50 @@
>
>
>
> +amend will fold without preserving the folded commit's message
> +
> +  $ hg histedit d2ae7f538514 --commands - 2>&1 <<EOF | fixbundle
> +  > pick d2ae7f538514 b
> +  > amnd ee283cb5f2d5 e
> +  > pick 6de59d13424a f
> +  > pick 9c277da72c9b d
> +  > EOF
> +  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
> +  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +
> +log after edit
> +  $ hg logt --graph
> +  @  3:c4a9eb7989fc d
> +  |
> +  o  2:8e03a72b6f83 f
> +  |
> +  o  1:391ee782c689 b
> +  |
> +  o  0:cb9a9f314b8b a
> +
> +
> +description is taken from amended commit
> +
> +  $ hg log --debug --rev 1
> +  changeset:   1:391ee782c68930be438ccf4c6a403daedbfbffa5
> +  phase:       draft
> +  parent:      0:cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
> +  parent:      -1:0000000000000000000000000000000000000000
> +  manifest:    1:b5e112a3a8354e269b1524729f0918662d847c38
> +  user:        test
> +  date:        Thu Jan 01 00:00:00 1970 +0000
> +  files+:      b e
> +  extra:       branch=default
> +  extra:       histedit_source=d2ae7f538514cd87c17547b0de4cea71fe1af9fb,ee283cb5f2d5955443f23a27b697a04339e9a39a
> +  description:
> +  b
> +
> +
> +
>   check saving last-message.txt
>
>     $ cat > $TESTTMP/abortfolding.py <<EOF
> @@ -128,9 +172,9 @@
>     > EOF
>
>     $ rm -f .hg/last-message.txt
> -  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 6de59d13424a --commands - 2>&1 <<EOF | fixbundle
> -  > pick 6de59d13424a f
> -  > fold 9c277da72c9b d
> +  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 8e03a72b6f83 --commands - 2>&1 <<EOF | fixbundle
> +  > pick 8e03a72b6f83 f
> +  > fold c4a9eb7989fc d
>     > EOF
>     0 files updated, 0 files merged, 1 files removed, 0 files unresolved
>     allow non-folding commit
> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-obsolete.t
> --- a/tests/test-histedit-obsolete.t	Wed Aug 06 12:16:58 2014 -0500
> +++ b/tests/test-histedit-obsolete.t	Wed Aug 06 16:51:41 2014 -0400
> @@ -57,6 +57,7 @@
>     #  p, pick = use commit
>     #  e, edit = use commit, but stop for amending
>     #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>     #  d, drop = remove commit from history
>     #  m, mess = edit message without changing commit content
>     #
> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-outgoing.t
> --- a/tests/test-histedit-outgoing.t	Wed Aug 06 12:16:58 2014 -0500
> +++ b/tests/test-histedit-outgoing.t	Wed Aug 06 16:51:41 2014 -0400
> @@ -49,6 +49,7 @@
>     #  p, pick = use commit
>     #  e, edit = use commit, but stop for amending
>     #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>     #  d, drop = remove commit from history
>     #  m, mess = edit message without changing commit content
>     #
> @@ -80,6 +81,7 @@
>     #  p, pick = use commit
>     #  e, edit = use commit, but stop for amending
>     #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>     #  d, drop = remove commit from history
>     #  m, mess = edit message without changing commit content
>     #
> @@ -103,6 +105,7 @@
>     #  p, pick = use commit
>     #  e, edit = use commit, but stop for amending
>     #  f, fold = use commit, but combine it with the one above
> +  #  a, amnd = add commit content to one above, dropping message (hg amend)
>     #  d, drop = remove commit from history
>     #  m, mess = edit message without changing commit content
>     #
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
Augie Fackler - Aug. 11, 2014, 1:25 p.m.
On Thu, Aug 7, 2014 at 4:40 PM, Pierre-Yves David
<pierre-yves.david@ens-lyon.org> wrote:
>
>
> On 08/07/2014 11:43 AM, adgar@google.com wrote:
>>
>> # HG changeset patch
>> # User Mike Edgar <adgar@google.com>
>> # Date 1407358301 14400
>> #      Wed Aug 06 16:51:41 2014 -0400
>> # Node ID 8723c4a5b7256ce436bdaf8476c18b0f2c875fff
>> # Parent  4354b1e35f533f72d5b6ccc76e8bc742f8cb5257
>> histedit: add "amnd" command to fold commit data and drop message
>> (issue4256)
>
>
> "amnd" is a fairly cryptic. How about shortening it the same was as message?
> That would give use "amen".

Let's just go all the way to amend, and do the following suggestion as
a followup later? (Mike, don't feel obligated to do the followup
unless it sounds interesting.) Does that work for you Pierre-Yves?

>
> On longer terms we could allow any subset of the command to be used (As we
> do for mercurial command line). a, amen and amend would be used. (Same would
> apply for others (eg: m, mess, messa, message)

I still like this after a few days of reflection.

>
>
>
>>
>> This new histedit command (short for "amend") acts like "hg amend" does
>> for
>> working copy: it accumulates changes without interrupting the user and
>> asking
>> for an updated commit message.
>>
>> diff -r 4354b1e35f53 -r 8723c4a5b725 hgext/histedit.py
>> --- a/hgext/histedit.py Wed Aug 06 12:16:58 2014 -0500
>> +++ b/hgext/histedit.py Wed Aug 06 16:51:41 2014 -0400
>> @@ -36,6 +36,7 @@
>>    #  p, pick = use commit
>>    #  e, edit = use commit, but stop for amending
>>    #  f, fold = use commit, but combine it with the one above
>> + #  a, amnd = add commit content to one above, dropping message (hg
>> amend)
>>    #  d, drop = remove commit from history
>>    #  m, mess = edit message without changing commit content
>>    #
>> @@ -57,6 +58,7 @@
>>    #  p, pick = use commit
>>    #  e, edit = use commit, but stop for amending
>>    #  f, fold = use commit, but combine it with the one above
>> + #  a, amnd = add commit content to one above, dropping message (hg
>> amend)
>>    #  d, drop = remove commit from history
>>    #  m, mess = edit message without changing commit content
>>    #
>> @@ -179,6 +181,7 @@
>>   #  p, pick = use commit
>>   #  e, edit = use commit, but stop for amending
>>   #  f, fold = use commit, but combine it with the one above
>> +#  a, amnd = add commit content to one above, dropping message (hg amend)
>>   #  d, drop = remove commit from history
>>   #  m, mess = edit message without changing commit content
>>   #
>> @@ -293,7 +296,9 @@
>>       extra = commitopts.get('extra')
>>
>>       parents = (first.p1().node(), first.p2().node())
>> -    editor = cmdutil.getcommiteditor(edit=True, editform='histedit.fold')
>> +    editor = None
>> +    if not commitopts.get('amend'):
>> +        editor = cmdutil.getcommiteditor(edit=True,
>> editform='histedit.fold')
>>       new = context.memctx(repo,
>>                            parents=parents,
>>                            text=message,
>> @@ -335,6 +340,11 @@
>>           _('Make changes as needed, you may commit or record as needed
>> now.\n'
>>             'When you are finished, run hg histedit --continue to
>> resume.'))
>>
>> +def amend(ui, repo, ctx, ha, opts):
>> +    amendopts = opts.copy()
>> +    amendopts['amend'] = True
>> +    return fold(ui, repo, ctx, ha, amendopts)
>> +
>>   def fold(ui, repo, ctx, ha, opts):
>>       oldctx = repo[ha]
>>       hg.update(repo, ctx.node())
>> @@ -362,10 +372,13 @@
>>           username = ui.username()
>>       commitopts['user'] = username
>>       # commit message
>> -    newmessage = '\n***\n'.join(
>> -        [ctx.description()] +
>> -        [repo[r].description() for r in internalchanges] +
>> -        [oldctx.description()]) + '\n'
>> +    if opts.get('amend'):
>> +        newmessage = ctx.description()
>> +    else:
>> +        newmessage = '\n***\n'.join(
>> +            [ctx.description()] +
>> +            [repo[r].description() for r in internalchanges] +
>> +            [oldctx.description()]) + '\n'
>>       commitopts['message'] = newmessage
>>       # date
>>       commitopts['date'] = max(ctx.date(), oldctx.date())
>> @@ -446,6 +459,8 @@
>>                  'edit': edit,
>>                  'f': fold,
>>                  'fold': fold,
>> +               'a': amend,
>> +               'amnd': amend,
>>                  'd': drop,
>>                  'drop': drop,
>>                  'm': message,
>> @@ -681,7 +696,7 @@
>>       m, a, r, d = repo.status()[:4]
>>       if m or a or r or d:
>>           # prepare the message for the commit to comes
>> -        if action in ('f', 'fold'):
>> +        if action in ('f', 'fold', 'a', 'amnd'):
>>               message = 'fold-temp-revision %s' % currentnode
>>           else:
>>               message = ctx.description()
>> @@ -704,15 +719,19 @@
>>           # to parent.
>>           replacements.append((ctx.node(), tuple(newchildren)))
>>
>> -    if action in ('f', 'fold'):
>> +    if action in ('f', 'fold', 'a', 'amnd'):
>>           if newchildren:
>>               # finalize fold operation if applicable
>>               if new is None:
>>                   new = newchildren[-1]
>>               else:
>>                   newchildren.pop()  # remove new from internal changes
>> -            parentctx, repl = finishfold(ui, repo, parentctx, ctx, new,
>> opts,
>> -                                         newchildren)
>> +            foldopts = opts
>> +            if action in ('a', 'amnd'):
>> +                foldopts = foldopts.copy()
>> +                foldopts['amend'] = True
>> +            parentctx, repl = finishfold(ui, repo, parentctx, ctx, new,
>> +                                         foldopts, newchildren)
>>               replacements.extend(repl)
>>           else:
>>               # newchildren is empty if the fold did not result in any
>> commit
>> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-arguments.t
>> --- a/tests/test-histedit-arguments.t   Wed Aug 06 12:16:58 2014 -0500
>> +++ b/tests/test-histedit-arguments.t   Wed Aug 06 16:51:41 2014 -0400
>> @@ -57,6 +57,7 @@
>>     #  p, pick = use commit
>>     #  e, edit = use commit, but stop for amending
>>     #  f, fold = use commit, but combine it with the one above
>> +  #  a, amnd = add commit content to one above, dropping message (hg
>> amend)
>>     #  d, drop = remove commit from history
>>     #  m, mess = edit message without changing commit content
>>     #
>> @@ -255,6 +256,7 @@
>>     #  p, pick = use commit
>>     #  e, edit = use commit, but stop for amending
>>     #  f, fold = use commit, but combine it with the one above
>> +  #  a, amnd = add commit content to one above, dropping message (hg
>> amend)
>>     #  d, drop = remove commit from history
>>     #  m, mess = edit message without changing commit content
>>     #
>> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-bookmark-motion.t
>> --- a/tests/test-histedit-bookmark-motion.t     Wed Aug 06 12:16:58 2014
>> -0500
>> +++ b/tests/test-histedit-bookmark-motion.t     Wed Aug 06 16:51:41 2014
>> -0400
>> @@ -73,6 +73,7 @@
>>     #  p, pick = use commit
>>     #  e, edit = use commit, but stop for amending
>>     #  f, fold = use commit, but combine it with the one above
>> +  #  a, amnd = add commit content to one above, dropping message (hg
>> amend)
>>     #  d, drop = remove commit from history
>>     #  m, mess = edit message without changing commit content
>>     #
>> @@ -133,6 +134,7 @@
>>     #  p, pick = use commit
>>     #  e, edit = use commit, but stop for amending
>>     #  f, fold = use commit, but combine it with the one above
>> +  #  a, amnd = add commit content to one above, dropping message (hg
>> amend)
>>     #  d, drop = remove commit from history
>>     #  m, mess = edit message without changing commit content
>>     #
>> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-commute.t
>> --- a/tests/test-histedit-commute.t     Wed Aug 06 12:16:58 2014 -0500
>> +++ b/tests/test-histedit-commute.t     Wed Aug 06 16:51:41 2014 -0400
>> @@ -67,6 +67,7 @@
>>     #  p, pick = use commit
>>     #  e, edit = use commit, but stop for amending
>>     #  f, fold = use commit, but combine it with the one above
>> +  #  a, amnd = add commit content to one above, dropping message (hg
>> amend)
>>     #  d, drop = remove commit from history
>>     #  m, mess = edit message without changing commit content
>>     #
>> @@ -344,6 +345,7 @@
>>     #  p, pick = use commit
>>     #  e, edit = use commit, but stop for amending
>>     #  f, fold = use commit, but combine it with the one above
>> +  #  a, amnd = add commit content to one above, dropping message (hg
>> amend)
>>     #  d, drop = remove commit from history
>>     #  m, mess = edit message without changing commit content
>>     #
>> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-fold.t
>> --- a/tests/test-histedit-fold.t        Wed Aug 06 12:16:58 2014 -0500
>> +++ b/tests/test-histedit-fold.t        Wed Aug 06 16:51:41 2014 -0400
>> @@ -105,6 +105,50 @@
>>
>>
>>
>> +amend will fold without preserving the folded commit's message
>> +
>> +  $ hg histedit d2ae7f538514 --commands - 2>&1 <<EOF | fixbundle
>> +  > pick d2ae7f538514 b
>> +  > amnd ee283cb5f2d5 e
>> +  > pick 6de59d13424a f
>> +  > pick 9c277da72c9b d
>> +  > EOF
>> +  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
>> +  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
>> +  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
>> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
>> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
>> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
>> +
>> +log after edit
>> +  $ hg logt --graph
>> +  @  3:c4a9eb7989fc d
>> +  |
>> +  o  2:8e03a72b6f83 f
>> +  |
>> +  o  1:391ee782c689 b
>> +  |
>> +  o  0:cb9a9f314b8b a
>> +
>> +
>> +description is taken from amended commit
>> +
>> +  $ hg log --debug --rev 1
>> +  changeset:   1:391ee782c68930be438ccf4c6a403daedbfbffa5
>> +  phase:       draft
>> +  parent:      0:cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
>> +  parent:      -1:0000000000000000000000000000000000000000
>> +  manifest:    1:b5e112a3a8354e269b1524729f0918662d847c38
>> +  user:        test
>> +  date:        Thu Jan 01 00:00:00 1970 +0000
>> +  files+:      b e
>> +  extra:       branch=default
>> +  extra:
>> histedit_source=d2ae7f538514cd87c17547b0de4cea71fe1af9fb,ee283cb5f2d5955443f23a27b697a04339e9a39a
>> +  description:
>> +  b
>> +
>> +
>> +
>>   check saving last-message.txt
>>
>>     $ cat > $TESTTMP/abortfolding.py <<EOF
>> @@ -128,9 +172,9 @@
>>     > EOF
>>
>>     $ rm -f .hg/last-message.txt
>> -  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 6de59d13424a --commands
>> - 2>&1 <<EOF | fixbundle
>> -  > pick 6de59d13424a f
>> -  > fold 9c277da72c9b d
>> +  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 8e03a72b6f83 --commands
>> - 2>&1 <<EOF | fixbundle
>> +  > pick 8e03a72b6f83 f
>> +  > fold c4a9eb7989fc d
>>     > EOF
>>     0 files updated, 0 files merged, 1 files removed, 0 files unresolved
>>     allow non-folding commit
>> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-obsolete.t
>> --- a/tests/test-histedit-obsolete.t    Wed Aug 06 12:16:58 2014 -0500
>> +++ b/tests/test-histedit-obsolete.t    Wed Aug 06 16:51:41 2014 -0400
>> @@ -57,6 +57,7 @@
>>     #  p, pick = use commit
>>     #  e, edit = use commit, but stop for amending
>>     #  f, fold = use commit, but combine it with the one above
>> +  #  a, amnd = add commit content to one above, dropping message (hg
>> amend)
>>     #  d, drop = remove commit from history
>>     #  m, mess = edit message without changing commit content
>>     #
>> diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-outgoing.t
>> --- a/tests/test-histedit-outgoing.t    Wed Aug 06 12:16:58 2014 -0500
>> +++ b/tests/test-histedit-outgoing.t    Wed Aug 06 16:51:41 2014 -0400
>> @@ -49,6 +49,7 @@
>>     #  p, pick = use commit
>>     #  e, edit = use commit, but stop for amending
>>     #  f, fold = use commit, but combine it with the one above
>> +  #  a, amnd = add commit content to one above, dropping message (hg
>> amend)
>>     #  d, drop = remove commit from history
>>     #  m, mess = edit message without changing commit content
>>     #
>> @@ -80,6 +81,7 @@
>>     #  p, pick = use commit
>>     #  e, edit = use commit, but stop for amending
>>     #  f, fold = use commit, but combine it with the one above
>> +  #  a, amnd = add commit content to one above, dropping message (hg
>> amend)
>>     #  d, drop = remove commit from history
>>     #  m, mess = edit message without changing commit content
>>     #
>> @@ -103,6 +105,7 @@
>>     #  p, pick = use commit
>>     #  e, edit = use commit, but stop for amending
>>     #  f, fold = use commit, but combine it with the one above
>> +  #  a, amnd = add commit content to one above, dropping message (hg
>> amend)
>>     #  d, drop = remove commit from history
>>     #  m, mess = edit message without changing commit content
>>     #
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel@selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel
>>
>
> --
> Pierre-Yves David
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Martin Geisler - Aug. 12, 2014, 10:09 a.m.
Augie Fackler <lists@durin42.com> writes:

> On Thu, Aug 7, 2014 at 4:40 PM, Pierre-Yves David
> <pierre-yves.david@ens-lyon.org> wrote:
>>
>>
>> On longer terms we could allow any subset of the command to be used
>> (As we do for mercurial command line). a, amen and amend would be
>> used. (Same would apply for others (eg: m, mess, messa, message)
>
> I still like this after a few days of reflection.

Yes, please :) That would also allow us to get rid of the "f, foo"
syntax as just write "foo" directly.

Patch

diff -r 4354b1e35f53 -r 8723c4a5b725 hgext/histedit.py
--- a/hgext/histedit.py	Wed Aug 06 12:16:58 2014 -0500
+++ b/hgext/histedit.py	Wed Aug 06 16:51:41 2014 -0400
@@ -36,6 +36,7 @@ 
  #  p, pick = use commit
  #  e, edit = use commit, but stop for amending
  #  f, fold = use commit, but combine it with the one above
+ #  a, amnd = add commit content to one above, dropping message (hg amend)
  #  d, drop = remove commit from history
  #  m, mess = edit message without changing commit content
  #
@@ -57,6 +58,7 @@ 
  #  p, pick = use commit
  #  e, edit = use commit, but stop for amending
  #  f, fold = use commit, but combine it with the one above
+ #  a, amnd = add commit content to one above, dropping message (hg amend)
  #  d, drop = remove commit from history
  #  m, mess = edit message without changing commit content
  #
@@ -179,6 +181,7 @@ 
 #  p, pick = use commit
 #  e, edit = use commit, but stop for amending
 #  f, fold = use commit, but combine it with the one above
+#  a, amnd = add commit content to one above, dropping message (hg amend)
 #  d, drop = remove commit from history
 #  m, mess = edit message without changing commit content
 #
@@ -293,7 +296,9 @@ 
     extra = commitopts.get('extra')
 
     parents = (first.p1().node(), first.p2().node())
-    editor = cmdutil.getcommiteditor(edit=True, editform='histedit.fold')
+    editor = None
+    if not commitopts.get('amend'):
+        editor = cmdutil.getcommiteditor(edit=True, editform='histedit.fold')
     new = context.memctx(repo,
                          parents=parents,
                          text=message,
@@ -335,6 +340,11 @@ 
         _('Make changes as needed, you may commit or record as needed now.\n'
           'When you are finished, run hg histedit --continue to resume.'))
 
+def amend(ui, repo, ctx, ha, opts):
+    amendopts = opts.copy()
+    amendopts['amend'] = True
+    return fold(ui, repo, ctx, ha, amendopts)
+
 def fold(ui, repo, ctx, ha, opts):
     oldctx = repo[ha]
     hg.update(repo, ctx.node())
@@ -362,10 +372,13 @@ 
         username = ui.username()
     commitopts['user'] = username
     # commit message
-    newmessage = '\n***\n'.join(
-        [ctx.description()] +
-        [repo[r].description() for r in internalchanges] +
-        [oldctx.description()]) + '\n'
+    if opts.get('amend'):
+        newmessage = ctx.description()
+    else:
+        newmessage = '\n***\n'.join(
+            [ctx.description()] +
+            [repo[r].description() for r in internalchanges] +
+            [oldctx.description()]) + '\n'
     commitopts['message'] = newmessage
     # date
     commitopts['date'] = max(ctx.date(), oldctx.date())
@@ -446,6 +459,8 @@ 
                'edit': edit,
                'f': fold,
                'fold': fold,
+               'a': amend,
+               'amnd': amend,
                'd': drop,
                'drop': drop,
                'm': message,
@@ -681,7 +696,7 @@ 
     m, a, r, d = repo.status()[:4]
     if m or a or r or d:
         # prepare the message for the commit to comes
-        if action in ('f', 'fold'):
+        if action in ('f', 'fold', 'a', 'amnd'):
             message = 'fold-temp-revision %s' % currentnode
         else:
             message = ctx.description()
@@ -704,15 +719,19 @@ 
         # to parent.
         replacements.append((ctx.node(), tuple(newchildren)))
 
-    if action in ('f', 'fold'):
+    if action in ('f', 'fold', 'a', 'amnd'):
         if newchildren:
             # finalize fold operation if applicable
             if new is None:
                 new = newchildren[-1]
             else:
                 newchildren.pop()  # remove new from internal changes
-            parentctx, repl = finishfold(ui, repo, parentctx, ctx, new, opts,
-                                         newchildren)
+            foldopts = opts
+            if action in ('a', 'amnd'):
+                foldopts = foldopts.copy()
+                foldopts['amend'] = True
+            parentctx, repl = finishfold(ui, repo, parentctx, ctx, new,
+                                         foldopts, newchildren)
             replacements.extend(repl)
         else:
             # newchildren is empty if the fold did not result in any commit
diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t	Wed Aug 06 12:16:58 2014 -0500
+++ b/tests/test-histedit-arguments.t	Wed Aug 06 16:51:41 2014 -0400
@@ -57,6 +57,7 @@ 
   #  p, pick = use commit
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  a, amnd = add commit content to one above, dropping message (hg amend)
   #  d, drop = remove commit from history
   #  m, mess = edit message without changing commit content
   #
@@ -255,6 +256,7 @@ 
   #  p, pick = use commit
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  a, amnd = add commit content to one above, dropping message (hg amend)
   #  d, drop = remove commit from history
   #  m, mess = edit message without changing commit content
   #
diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-bookmark-motion.t
--- a/tests/test-histedit-bookmark-motion.t	Wed Aug 06 12:16:58 2014 -0500
+++ b/tests/test-histedit-bookmark-motion.t	Wed Aug 06 16:51:41 2014 -0400
@@ -73,6 +73,7 @@ 
   #  p, pick = use commit
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  a, amnd = add commit content to one above, dropping message (hg amend)
   #  d, drop = remove commit from history
   #  m, mess = edit message without changing commit content
   #
@@ -133,6 +134,7 @@ 
   #  p, pick = use commit
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  a, amnd = add commit content to one above, dropping message (hg amend)
   #  d, drop = remove commit from history
   #  m, mess = edit message without changing commit content
   #
diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-commute.t
--- a/tests/test-histedit-commute.t	Wed Aug 06 12:16:58 2014 -0500
+++ b/tests/test-histedit-commute.t	Wed Aug 06 16:51:41 2014 -0400
@@ -67,6 +67,7 @@ 
   #  p, pick = use commit
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  a, amnd = add commit content to one above, dropping message (hg amend)
   #  d, drop = remove commit from history
   #  m, mess = edit message without changing commit content
   #
@@ -344,6 +345,7 @@ 
   #  p, pick = use commit
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  a, amnd = add commit content to one above, dropping message (hg amend)
   #  d, drop = remove commit from history
   #  m, mess = edit message without changing commit content
   #
diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-fold.t
--- a/tests/test-histedit-fold.t	Wed Aug 06 12:16:58 2014 -0500
+++ b/tests/test-histedit-fold.t	Wed Aug 06 16:51:41 2014 -0400
@@ -105,6 +105,50 @@ 
   
   
 
+amend will fold without preserving the folded commit's message
+
+  $ hg histedit d2ae7f538514 --commands - 2>&1 <<EOF | fixbundle
+  > pick d2ae7f538514 b
+  > amnd ee283cb5f2d5 e
+  > pick 6de59d13424a f
+  > pick 9c277da72c9b d
+  > EOF
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+log after edit
+  $ hg logt --graph
+  @  3:c4a9eb7989fc d
+  |
+  o  2:8e03a72b6f83 f
+  |
+  o  1:391ee782c689 b
+  |
+  o  0:cb9a9f314b8b a
+  
+
+description is taken from amended commit
+
+  $ hg log --debug --rev 1
+  changeset:   1:391ee782c68930be438ccf4c6a403daedbfbffa5
+  phase:       draft
+  parent:      0:cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
+  parent:      -1:0000000000000000000000000000000000000000
+  manifest:    1:b5e112a3a8354e269b1524729f0918662d847c38
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  files+:      b e
+  extra:       branch=default
+  extra:       histedit_source=d2ae7f538514cd87c17547b0de4cea71fe1af9fb,ee283cb5f2d5955443f23a27b697a04339e9a39a
+  description:
+  b
+  
+  
+
 check saving last-message.txt
 
   $ cat > $TESTTMP/abortfolding.py <<EOF
@@ -128,9 +172,9 @@ 
   > EOF
 
   $ rm -f .hg/last-message.txt
-  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 6de59d13424a --commands - 2>&1 <<EOF | fixbundle
-  > pick 6de59d13424a f
-  > fold 9c277da72c9b d
+  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 8e03a72b6f83 --commands - 2>&1 <<EOF | fixbundle
+  > pick 8e03a72b6f83 f
+  > fold c4a9eb7989fc d
   > EOF
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   allow non-folding commit
diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t	Wed Aug 06 12:16:58 2014 -0500
+++ b/tests/test-histedit-obsolete.t	Wed Aug 06 16:51:41 2014 -0400
@@ -57,6 +57,7 @@ 
   #  p, pick = use commit
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  a, amnd = add commit content to one above, dropping message (hg amend)
   #  d, drop = remove commit from history
   #  m, mess = edit message without changing commit content
   #
diff -r 4354b1e35f53 -r 8723c4a5b725 tests/test-histedit-outgoing.t
--- a/tests/test-histedit-outgoing.t	Wed Aug 06 12:16:58 2014 -0500
+++ b/tests/test-histedit-outgoing.t	Wed Aug 06 16:51:41 2014 -0400
@@ -49,6 +49,7 @@ 
   #  p, pick = use commit
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  a, amnd = add commit content to one above, dropping message (hg amend)
   #  d, drop = remove commit from history
   #  m, mess = edit message without changing commit content
   #
@@ -80,6 +81,7 @@ 
   #  p, pick = use commit
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  a, amnd = add commit content to one above, dropping message (hg amend)
   #  d, drop = remove commit from history
   #  m, mess = edit message without changing commit content
   #
@@ -103,6 +105,7 @@ 
   #  p, pick = use commit
   #  e, edit = use commit, but stop for amending
   #  f, fold = use commit, but combine it with the one above
+  #  a, amnd = add commit content to one above, dropping message (hg amend)
   #  d, drop = remove commit from history
   #  m, mess = edit message without changing commit content
   #