Search code examples
mercurialnewlinehgrc

Mercurial - cleverencode - cleverdecode - multiple file patterns - mercurial.ini


How do I specify the CRLF encode/decode option in mercurial.ini in Windows?

The documentation gives the following options:

[extensions]
win32text =
[decode]
** = cleverdecode:
[encode]
** = cleverencode:

for all files and,

[extensions]
win32text =
[decode]
**.txt = cleverdecode:
[encode]
**.txt= cleverencode:

for one kind of files (here .txt files).

What I need is to specify *.xml, *.java etc!


Solution

  • Add more lines to the [decode] and [encode] sections:

    [extensions]
    win32text =
    
    [decode]
    **.txt = cleverdecode:
    **.java = cleverdecode:
    **.xml = cleverdecode:
    
    [encode]
    **.txt = cleverencode:
    **.java = cleverencode:
    **.xml = cleverencode:
    

    By the way, the double-star matches any path and spans directory separators. See hg help patterns for more information about the so-called "globbing" options in Mercurial.