[PATCH RFC] commit: add --reuse-message for keeping the old commit message during amend
Augie Fackler
raf at durin42.com
Fri Feb 8 17:05:48 CST 2013
On Feb 8, 2013, at 9:34 PM, Durham Goode <durham at fb.com> wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1360352769 28800
> # Node ID a761c31f54ca302d65b33199f6c9368890267eba
> # Parent e2b176cf28e374eb146c3e131871631ab9ace537
> commit: add --reuse-message for keeping the old commit message during amend
>
> When people do 'hg commit --amend', most of the time they don't want to change
> the commit message. This adds a flag to do that without prompting the user.
>
> I imagine most people will use it in an alias such as:
>
> amend=commit --amend --reuse-message
>
> Questions:
> - Anyone have a better name? 'reuse-message' matches git which is why it was
> chosen, but it seems a little long.
I don't have a better one.
> - Marmoute proposed -L as the shortcut, since -l is used to specify a file as
> the message. Thoughts?
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -1702,7 +1702,7 @@
> date = opts.get('date') or old.date()
> editmsg = False
> if not message:
> - editmsg = True
> + editmsg = not opts.get('reuse_message')
> message = old.description()
Huh. Tests?
>
> pureextra = extra.copy()
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -1241,6 +1241,8 @@
> ('', 'close-branch', None,
> _('mark a branch as closed, hiding it from the branch list')),
> ('', 'amend', None, _('amend the parent of the working dir')),
> + ('', 'reuse-message', None,
> + _('used with amend to reuse the previous commit message')),
> ] + walkopts + commitopts + commitopts2 + subrepoopts,
> _('[OPTION]... [FILE]...'))
> def commit(ui, repo, *pats, **opts):
> diff --git a/tests/test-debugcomplete.t b/tests/test-debugcomplete.t
> --- a/tests/test-debugcomplete.t
> +++ b/tests/test-debugcomplete.t
> @@ -197,7 +197,7 @@
> add: include, exclude, subrepos, dry-run
> annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude
> clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure
> - commit: addremove, close-branch, amend, include, exclude, message, logfile, date, user, subrepos
> + commit: addremove, close-branch, amend, reuse-message, include, exclude, message, logfile, date, user, subrepos
> diff: rev, change, text, git, nodates, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, include, exclude, subrepos
> export: output, switch-parent, rev, text, git, nodates
> forget: include, exclude
> diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t
> --- a/tests/test-qrecord.t
> +++ b/tests/test-qrecord.t
> @@ -61,6 +61,7 @@
> --close-branch mark a branch as closed, hiding it from the branch
> list
> --amend amend the parent of the working dir
> + --reuse-message used with amend to reuse the previous commit message
> -I --include PATTERN [+] include names matching the given patterns
> -X --exclude PATTERN [+] exclude names matching the given patterns
> -m --message TEXT use text as commit message
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list