hgext/win32text.py
changeset 8873 e872ef2e6758
parent 8253 e553fe565c61
child 8894 868670dbc237
equal deleted inserted replaced
8872:d0c0013f8713 8873:e872ef2e6758
     2 #
     2 #
     3 #  Copyright 2005, 2007-2009 Matt Mackall <mpm@selenic.com> and others
     3 #  Copyright 2005, 2007-2009 Matt Mackall <mpm@selenic.com> and others
     4 #
     4 #
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2, incorporated herein by reference.
     6 # GNU General Public License version 2, incorporated herein by reference.
     7 #
     7 
     8 # To perform automatic newline conversion, use:
     8 '''LF <-> CRLF/CR translation utilities
     9 #
     9 
    10 # [extensions]
    10 To perform automatic newline conversion, use:
    11 # hgext.win32text =
    11 
    12 # [encode]
    12 [extensions]
    13 # ** = cleverencode:
    13 hgext.win32text =
    14 # # or ** = macencode:
    14 [encode]
    15 # [decode]
    15 ** = cleverencode:
    16 # ** = cleverdecode:
    16 # or ** = macencode:
    17 # # or ** = macdecode:
    17 
    18 #
    18 [decode]
    19 # If not doing conversion, to make sure you do not commit CRLF/CR by
    19 ** = cleverdecode:
    20 # accident:
    20 # or ** = macdecode:
    21 #
    21 
    22 # [hooks]
    22 If not doing conversion, to make sure you do not commit CRLF/CR by accident:
    23 # pretxncommit.crlf = python:hgext.win32text.forbidcrlf
    23 
    24 # # or pretxncommit.cr = python:hgext.win32text.forbidcr
    24 [hooks]
    25 #
    25 pretxncommit.crlf = python:hgext.win32text.forbidcrlf
    26 # To do the same check on a server to prevent CRLF/CR from being
    26 # or pretxncommit.cr = python:hgext.win32text.forbidcr
    27 # pushed or pulled:
    27 
    28 #
    28 To do the same check on a server to prevent CRLF/CR from being
    29 # [hooks]
    29 pushed or pulled:
    30 # pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf
    30 
    31 # # or pretxnchangegroup.cr = python:hgext.win32text.forbidcr
    31 [hooks]
       
    32 pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf
       
    33 # or pretxnchangegroup.cr = python:hgext.win32text.forbidcr
       
    34 '''
    32 
    35 
    33 from mercurial.i18n import _
    36 from mercurial.i18n import _
    34 from mercurial.node import short
    37 from mercurial.node import short
    35 from mercurial import util
    38 from mercurial import util
    36 import re
    39 import re