0
     ˆÁÀÅ528¿ÃÂ     ‹      Í•Q�“@…ß÷WŒóà[¹¥´jvÌZšØØm›.F�1d`†2‘28ÜÝnýõB©MÑÝh6>1gÎ70wØ1>,'äup5#Ë·¯fÓ1¡=€wÎÀüæÁÐêÛ “9%4E,Î¶Û­µu,mÖ¬ ÅM6„�ŠÑ(¨wÆê{Þa©ä¢º†
3éMs!ïˆNè,•�C(ŒŽSS	{¥Ì0Z#d*‚b‡©ÎË¶¡ü’)”ƒÆ¦2†ƒ3‹´ØÕÚo^yì£òh?G=4Ã”ÜòL­s—¢.¨ÇÔfMJ»T¬ó¢ŒçŸ­µJ(áºôãt¼øTéª‰ë·=ÆI• qéË±;¿X¸—Ô›ó�dÀOk®*�O½/‘l´P‰’¢S|Ý^«¯Ý†~£ñeU ÒùQ
b5ÖYYðŠuT¤¦­j$âO«ÁãŸcy¹šÌºj–DÔÇtüTÔ[r#s$¾22Fmv’Æöi•ÅÅ÷’rµN‘z„ôÈIåàPÞa.xœÄ
C•+C«ØQ¯U´ÓþoÐ<ëÙý^ÿ9±‡çÎˆ�.¡5zóX"â…ì)~ÿƒc�áfS4ÍàÉŸèLHÓ&èÚ$aXìb§2¡þ�ŽÕ}X^Ô,C§“å÷ûâž­M“Á¾3h€oRXWˆc    5   ˆl–Ü4ý( ©¤ýÔâ€rà…p.©‹Fÿ�þB gp%yù^“ùÇƒh¹ÆÄÃ      0
  A   ˆl–äY>”JeJe@†à¸Û*bÑ¿�þBFÜY¹BáYI#MùÈƒtMµÇ_ŠI|¥�+Wé3ž¯ÆÅ V    # win32text.py - LF <-> CRLF/CR translation utilities for Windows/Mac users
#
#  Copyright 2005, 2007-2009 Olivia Mackall <olivia@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

'''perform automatic newline conversion (DEPRECATED)

  Deprecation: The win32text extension requires each user to configure
  the extension again and again for each clone since the configuration
  is not copied when cloning.

  We have therefore made the ``eol`` as an alternative. The ``eol``
  uses a version controlled file for its configuration and each clone
  will therefore use the right settings from the start.

To perform automatic newline conversion, use::

  [extensions]
  win32text =
  [encode]
  ** = cleverencode:
  # or ** = macencode:

  [decode]
  ** = cleverdecode:
  # or ** = macdecode:

If not doing conversion, to make sure you do not commit CRLF/CR by accident::

  [hooks]
  pretxncommit.crlf = python:hgext.win32text.forbidcrlf
  # or pretxncommit.cr = python:hgext.win32text.forbidcr

To do the same check on a server to prevent CRLF/CR from being
pushed or pulled::

  [hooks]
  pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf
  # or pretxnchangegroup.cr = python:hgext.win32text.forbidcr
'''


import re
from mercurial.i18n import _
from mercurial.node import short
from mercurial import (
    cmdutil,
    extensions,
    registrar,
)
from mercurial.utils import stringutil

# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
# be specifying the version(s) of Mercurial they are tested with, or
# leave the attribute unspecified.
testedwith = b'ships-with-hg-core'

configtable = {}
configitem = registrar.configitem(configtable)

configitem(
    b'win32text',
    b'warn',
    default=True,
)

# regexp for single LF without CR preceding.
re_single_lf = re.compile(b'(^|[^\r])\n', re.MULTILINE)

newlinestr = {b'\r\n': b'CRLF', b'\r': b'CR'}
filterstr = {b'\r\n': b'clever', b'\r': b'mac'}


def checknewline(s, newline, ui=None, repo=None, filename=None):
    # warn if already has 'newline' in repository.
    # it might cause unexpected eol conversion.
    # see issue 302:
    #   https://bz.mercurial-scm.org/302
    if newline in s and ui and filename and repo:
        ui.warn(
            _(
                b'WARNING: %s already has %s line endings\n'
                b'and does not need EOL conversion by the win32text plugin.\n'
                b'Before your next commit, please reconsider your '
                b'encode/decode settings in \nMercurial.ini or %s.\n'
            )
            % (filename, newlinestr[newline], repo.vfs.join(b'hgrc'))
        )


def dumbdecode(s, cmd, **kwargs):
    checknewline(s, b'\r\n', **kwargs)
    # replace single LF to CRLF
    return re_single_lf.sub(b'\\1\r\n', s)


def dumbencode(s, cmd):
    return s.replace(b'\r\n', b'\n')


def macdumbdecode(s, cmd, **kwargs):
    checknewline(s, b'\r', **kwargs)
    return s.replace(b'\n', b'\r')


def macdumbencode(s, cmd):
    return s.replace(b'\r', b'\n')


def cleverdecode(s, cmd, **kwargs):
    if not stringutil.binary(s):
        return dumbdecode(s, cmd, **kwargs)
    return s


def cleverencode(s, cmd):
    if not stringutil.bina