
    q&f                     $    d dl mZ d dlmZ ddZy)   )_)errorc                 N      j                  dd|z         rdvry fd}|S )a  Get a function that checks file handle position is as expected.

    This is used to ensure that files haven't been modified outside of our
    knowledge (such as on a networked filesystem, if `hg debuglocks` was used,
    or writes to .hg that ignored locks happened).

    Due to revlogs supporting a concept of buffered, delayed, or diverted
    writes, we're allowing the files to be shorter than expected (the data may
    not have been written yet), but they can't be longer.

    Please note that this check is not perfect; it can't detect all cases (there
    may be false-negatives/false-OKs), but it should never claim there's an
    issue when there isn't (false-positives/false-failures).
       debugs   revlog.verifyposition.)s   log   warn   failNc                 H   | j                         |k  ry t        d      }j                  d|dz   || j                         |       dk(  r)j                  |dz   || j                         |fz         y dk(  r)t	        j
                  ||| j                         |fz        y )Ns+   %s: file cursor at position %d, expected %dr      
r   r   )tellr   logwarnr   RevlogError)fhfnexpectedmsguivposs       K/usr/lib/python3/dist-packages/mercurial/revlogutils/concurrency_checker.py_checkerzget_checker.<locals>._checker   s    779 >?
xub"'')X>7?GGS5[RH$==>W_##C2rwwy(*C$CDD     )config)r   revlog_namer   r   s   `  @r   get_checkerr      s6      99X8;FGD499
E Or   N)s	   changelog)i18nr    r   r    r   r   <module>r      s     !r   