[PATCH stable] subrepo: use standard handling of \ in subpath replacement strings (BC)

Mads Kiilerich mads at kiilerich.com
Sun Jul 29 20:18:18 CDT 2012


Matt Mackall wrote, On 07/27/2012 09:07 PM:
> On Thu, 2012-07-26 at 02:57 +0200, Mads Kiilerich wrote:
>> # HG changeset patch
>> # User Mads Kiilerich <mads at kiilerich.com>
>> # Date 1343264252 -7200
>> # Branch stable
>> # Node ID 1de046d28995fb6c5af554882d2c5ec14b364ece
>> # Parent  1675ef8a2bf2e32e9f42aa3a74b48c0f44ff9b80
>> subrepo: use standard handling of \ in subpath replacement strings (BC)
> So if I've checked in a .hgsub file which contains replacement patterns
> using backslashes, I won't be able to check it out after upgrading?
>
> That seems a rather big deal.

Negative. All sane setups will work as before.

   /foo/bar = /foobar
and
   /foo/(.*)/bar = /foobar/\1
will work as before

But
   /foo/bar = \foobar
will have to be written as
   /foo/bar = \\foobar
or (on windows)
   /foo/bar = /foobar

and
   /foo/(.*)/bar = \foobar\\1
will have to be written as
   /foo/(.*)/bar = \\foobar\\\1
or (on windows)
   /foo/(.*)/bar = /foobar/\1

It will thus also become possible to unambiguously write
   /foo/(.*) = c:\\1984foo\1
or
   /foo/(.*) = /foo\\1984/\1

And there will not be any wrong quoting so
   foo/bar = foo'bar
will work as expected and no longer map to
   foo\'bar

(There is very little test coverage for subpaths. I guess I should add 
these cases and prove that I'm right it works that way.)

... But agreed, still possibly a rather big deal for those who have 
worked around the previous undocumented behaviour and now rely on it. 
Having to deal with the old behaviour is however also a big deal.

/Mads


More information about the Mercurial-devel mailing list