[PATCH] record: make m key open an editor for the commit message (issue5667)

Augie Fackler raf at durin42.com
Mon Aug 28 14:13:17 EDT 2017


Your patch looks good, but I'm unable to apply it. Did you mail this by pasting into your mail client instead of using `hg email`?

> On Aug 28, 2017, at 08:21, Peter Vitt <peter.vitt2 at uni-siegen.de> wrote:
> 
> # HG changeset patch
> # User Peter Vitt <peter.vitt2 at uni-siegen.de>
> # Date 1503920611 -7200
> #      Mon Aug 28 13:43:31 2017 +0200
> # Node ID 22ab2b29950a783a5ee52b20693a0b4f9c174fae
> # Parent  4e8a46c25facaebca476634d52dd78431d3143e8
> record: make the m key open an editor for the commit message (issue5667)
> 
> With the former crecord extension, the user could edit the commit
> message while he was de-/selecting hunks. By pressing 'm', an editor
> showed up to edit the commit message.
> 
> With record being part of mercurial, this feature is not available
> anymore. However, the help text still mentions it.
> 
> As the infrastructure needed is still present, this feature is quite
> easily ported from the crecord extension to mercurial.
> 
> It seems there is no test coverage for record ui, so I tested this patch
> manually on my local machine.
> 
> diff -r 4e8a46c25fac -r 22ab2b29950a mercurial/crecord.py
> --- a/mercurial/crecord.py      Tue Aug 22 11:00:00 2017 +0200
> +++ b/mercurial/crecord.py      Mon Aug 28 13:43:31 2017 +0200
> @@ -1440,6 +1440,17 @@
>         except curses.error:
>             pass
> 
> +    def commitMessageWindow(self):
> +        "Create a temporary commit message editing window on the screen."
> +
> +        curses.raw()
> +        curses.def_prog_mode()
> +        curses.endwin()
> +        self.commenttext = self.ui.edit(self.commenttext,
> self.ui.username())
> +        curses.cbreak()
> +        self.stdscr.refresh()
> +        self.stdscr.keypad(1) # allow arrow-keys to continue to function
> +
>     def confirmationwindow(self, windowtext):
>         "display an informational window, then wait for and return a
> keypress."
> 
> @@ -1661,6 +1672,8 @@
>             self.togglefolded()
>         elif keypressed in ["F"]:
>             self.togglefolded(foldparent=True)
> +        elif keypressed in ["m"]:
> +            self.commitMessageWindow()
>         elif keypressed in ["?"]:
>             self.helpwindow()
>             self.stdscr.clear()
> @@ -1736,3 +1749,8 @@
>                 keypressed = "foobar"
>             if self.handlekeypressed(keypressed):
>                 break
> +
> +        if self.commenttext != "":
> +            whitespaceremoved = re.sub("(?m)^\s.*(\n|$)", "",
> self.commenttext)
> +            if whitespaceremoved != "":
> +                self.opts['message'] = self.commenttext
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list