hg convert -s svn ... pretxncommit.crlf hook failed

Ernie Rael err at raelity.com
Fri Jan 16 19:57:26 UTC 2015


On 1/13/2015 3:57 PM, Mads Kiilerich wrote:
> On 01/13/2015 08:33 PM, Ernie Rael wrote:
>>
>> Any suggestions for getting an hg repo with unix line endings using 
>> only the hg convert command? I looked at the "Customization" section 
>> of ConvertExtension and I suppose a custom getfile could do the 
>> trick; I'm wondering (hoping) there's a simpler way...
>
> I doubt there is a simpler way. The EOL extension do not have convert 
> in mind ... and the other way around. They might happen to work 
> together in the expected way ... but I wouldn't expect it.
>
> I would go the Customization route ... and perhaps keep using the eol 
> extension to maintain the encoding.
While testing this, in getfile I ran into the following

       File "C:/a/src/tools/hgconv/conv_svn_eol_to_nl.py", line 12, in
    getfile
         if not '\0' in data and '\r' in data:
    TypeError: argument of type 'NoneType' is not iterable

which occurs when generating the changeset in which the associated file 
has been removed. (When error fixed, the repo is fine. One rev has the 
file, the next one doesn't) To fix, insist on type str

             if isinstance(data, str):
                 if not '\0' in data and '\r' in data:
                     print 'conv_svn_eol_to_nl:', name
                     data = ''.join(line + '\n' for line in
    data.splitlines())

since splitlines has to work as well. This is the whole thing other than 
the boiler plate. Reminds me of why I enjoy python so much. (It does 
scan the data twice, but not production code)

I'll update the wiki soon with the few things mentioned in earlier 
email. Is it worth mentioning this getfile gotcha in the wiki? Maybe a 
sentence after the example.

Thanks for the help,
-ernie

>
> /Mads
>
>
>




More information about the Mercurial mailing list