none
  W   ˆl–Ðz¾”j_)% õÀ;q§”Å£’þDè–l²„,�7  ´ÞÍ_óÂ{‹„„-i[D<†ªoZƒ›Ù«Ã324_‹I|¥Žƒî4ÃVŸÃÂ D    ‹      mQANÃ0<Ç¯0äTjcÔCD= ÔSå®³)F©vmD…úwì4méÑ³ã�™8y4Ú‹’±/…üüÂFÄ’Ñ|Î>ƒAÈÅüÄbÔ³ï½8«•_µªRëâ§Ó¹¸_í¶k×ÿ©÷bÌ=ýiŸJ2I*Íô„¨vçó<rÞÜ³s({Îà�·ká‚‘.””üÝû–¥½U)2 UÞ8«šÂáæ OgS9+ä-�žÒ]0‚1¶uUh €ïÖ¡§(V«Ó–äòùrÄXfjž'éy3Ÿs±\@,¦f> åµjJ–íü+÷?ÐSLºè$_Ž¯cgÝ2Å]}ú­³lµ±PõNŽV†³æt¾kßÙëY}E1TÉö%û^xr       ˆÀ¿Ä655_‘I|¥‰ÓMdœv ©ƒ†ü+=ÄÃ �    ‹      Õ—ßoÚ0ÇßûWx~Ø\ý¡Ñà©#•†ÖRÔ2MÓ4U&6‰Õ$ŽlCÊþú98´*]*µ{áÎá›Ü}ì;Ç	Þ…ƒÉ÷ñ)ú<9?Cã¯ŸÎ†„[ ßº€pº?öÛžp:Â'Æ=€²,Ûe·-U“KHL–îƒ6JD¦ÍÃd/¨®‘=$œ2kQ`„I9æŒß"9C çFÆí}KŒ/DÄuåžAÆ3©–µñ»]È%ãDÅü fBe%UüººE²Ô"¢éj€bÃB7˜J¶¬Òñ_;´�°Â¤ÓU•«H`´ ©ˆó>6²À$YŒ´ŠúD$sÓ”æ7íXÌ0¢©éãÃÁÅO«“Tw“€¢DñYôGÇý“Íl<ú¸æÜjN09£Ú L21œm_9ñ•øµý�¡Ó„\GJFÈ|-‹¸‰ÉTÔ²X‚Dmªœ„ým6hto2Æ'—§£I8¼tSÂªG¬³{¡…ÄdlýÜ P(+¯	]¸÷ùTÇwCTç¯DœLj¡G•Ï€žÉ”qµ‰½8¢QRåëìf–Òêx�Ã–ï·üÈ?êyG½bþóü&—e¾	`kâq EubgÝpm)Öƒ(y^ÏþnC±»Ô—ƒr­mÝãY]Ù¨æõÅ”Xpe¬všWØá«VXs‚‡�}ÜdE|äù=WxiŠt[’;¯ÙštºOUÕÛ2¸�gw¥¦žÑê2OEnÜÙ†E´Cm]ÈrÕÕÎ¾Ä¶ô¶¤çÓú¥ŽÉÚß•BjÎaï—©Œ—ã�û¾Äç|aOK˜8ûËðt;4<`B}ô`uæÀ}‚üÊl%Áå    A   ˆl–äY>”JeJe@†à¸Û*bÑ¿�þJäk7(\+"	$i ?ÇƒeÇÃÆ_ŠI|¥�+Wé3ž¯ÆÅ k    # automv.py
#
# Copyright 2013-2016 Facebook, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""check for unrecorded moves at commit time (EXPERIMENTAL)

This extension checks at commit/amend time if any of the committed files
comes from an unrecorded mv.

The threshold at which a file is considered a move can be set with the
``automv.similarity`` config option. This option takes a percentage between 0
(disabled) and 100 (files must be identical), the default is 95.

"""

# Using 95 as a default similarity is based on an analysis of the mercurial
# repositories of the cpython, mozilla-central & mercurial repositories, as
# well as 2 very large facebook repositories. At 95 50% of all potential
# missed moves would be caught, as well as correspond with 87% of all
# explicitly marked moves.  Together, 80% of moved files are 95% similar or
# more.
#
# See http://markmail.org/thread/5pxnljesvufvom57 for context.


from mercurial.i18n import _
from mercurial import (
    commands,
    copies,
    error,
    extensions,
    pycompat,
    registrar,
    scmutil,
    similar,
)

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

configitem(
    b'automv',
    b'similarity',
    default=95,
)


def extsetup(ui):
    entry = extensions.wrapcommand(commands.table, b'commit', mvcheck)
    entry[1].append(
        (b'', b'no-automv', None, _(b'disable automatic file move detection'))
    )


def mvcheck(orig, ui, repo, *pats, **opts):
    """Hook to check for moves at commit time"""
    opts = pycompat.byteskwargs(opts)
    renames = None
    disabled = opts.pop(b'no_automv', False)
    if not disabled:
        threshold = ui.configint(b'automv', b'similarity')
        if not 0 <= threshold <= 100:
            raise error.Abort(_(b'automv.similarity must be between 0 and 100'))
        if threshold > 0:
            match = scmutil.match(repo[None], pats, opts)
            added, removed = _interestingfiles(repo, match)
            uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
            renames = _findrenames(
                repo, uipathfn, added, removed, threshold / 100.0
            )

    with repo.wlock():
        if renames is not None:
            scmutil._markchanges(repo, (), (), renames)
        return orig(ui, repo, *pats, **pycompat.strkwargs(opts))


def _interestingfiles(repo, matcher):
    """Find what files were added or removed in this commit.

    Returns a tuple of two lists: (added, removed). Only files not *already*
    marked as moved are included in the added list.

    """
    stat = repo.status(match=matcher)
    added = stat.added
    removed = stat.removed

    copy = copies.pathcopies(repo[b'.'], repo[None], matcher)
    # remove the copy files for which we already have copy info
    