[PATCH] convert.monotone: fix quotes and backslashes in change descriptions

David Reiss davidn at gmail.com
Thu May 29 13:31:15 CDT 2008

On Thu, May 29, 2008 at 4:55 AM, Patrick Mézard <pmezard at gmail.com> wrote:
> David Reiss a écrit :
>> # HG changeset patch
>> # User David Reiss <davidn at gmail.com>
>> # Date 1210924103 25200
>> # Node ID 2bf316567e5f29b35c19ba0e5a9831337689cbbf
>> # Parent  bf2bf986ff873a2cdac2df6ffa4346a8b2da63e3
>> convert.monotone: fix quotes and backslashes in change descriptions.
> Can you detail a bit more the problem being solved here ?

I have a monotone repository whose revision descriptions contain
double quotes. When using the convert extension with that repository
as the source, the descriptions end up truncated at the first
double-quote. This is because the | operator in the regex that matches
monotone certs takes the leftmost matching branch, which is the [^"],
instead of the \\". That matches the backslash, which leaves the
double quote to be interpreted as ending the quoted string. Reversing
the order makes the regex correctly match escaped double quotes inside
a double-quoted string. Then we have to remove the escaping from the
matched string, which is what the two .replace lines do. The other
change, to the split string, is to handle change descriptions that
have blank lines in them.

(How much of this belongs in the change description?)

More information about the Mercurial-devel mailing list