o ]Lb @sdZddlmZddlmZddlmZddlmZm Z m Z m Z iZ e e Z dZe ddd d ed ed fd dd ededfgede jddddZdddZdS)anerase file content at a given revision The censor command instructs Mercurial to erase all content of a file at a given revision *without updating the changeset hash.* This allows existing history to remain valid while preventing future clones/pulls from receiving the erased data. Typical uses for censor are due to security or legal requirements, including:: * Passwords, private keys, cryptographic material * Licensed data/code/libraries for which the license has expired * Personally Identifiable Information or other private data Censored nodes can interrupt mercurial's typical operation whenever the excised data needs to be materialized. Some commands, like ``hg cat``/``hg revert``, simply fail when asked to produce censored data. Others, like ``hg verify`` and ``hg update``, must be capable of tolerating censored data to continue to function in a meaningful way. Such commands only tolerate censored file revisions if they are allowed by the "censor.policy=ignore" config option. A few informative commands such as ``hg grep`` will unconditionally ignore censored data and merely report that it was encountered. )absolute_import)_)short)error logcmdutil registrarscmutilsships-with-hg-corecensorrsrevs#censor file from specified revisionsREVts tombstonesreplacement tombstone datasTEXTs-r REV [-t TEXT] [FILE]) helpcategoryc Ks||0|t|||||fi|WdWdS1s'wYWddS1s7wYdS)N)wlocklock _docensor)uirepopathrev tombstoneoptsr./usr/lib/python3/dist-packages/hgext/censor.pycensor4sRrcKs|s ttd|sttd|d}t||f}|s)t|dkr0ttd|d}||}t|sFttdt ||| }z||} Wnt yettd|wz| |} Wntjy~ttd|w| } g} |D]} || }||vr||| kr| |q| rd d d | D}tjtd |td d|}| dd |Dvrtjtdtdd|d}|j|| |dWddS1swYdS)Ns must specify file path to censorsmust specify revision to censors%can only specify an explicit filenamers"cannot censor file with no historysinvalid revision identifier %ss"file does not exist at revision %ss, cSsg|]}t|qSr)rnode).0crrr jsz_docensor..s cannot censor file in heads (%s)sclean/delete and commit first)hintcSsg|]}|qSr)r)rprrrrqsscannot censor working directorysclean/delete/update firstr )r)rAbortrrmatchanypatslenfilesfiler revsinglerKeyErrorfilectx LookupErrorfilenodeheadsappendjoinparentsr transactioncensorrevision)rrrrrrwctxmflogctxfctxfnoder,headnodehcheadlistwptrrrrrHsZ        "rN)r r )__doc__ __future__rmercurial.i18nrmercurial.noder mercurialrrrrcmdtablecommand testedwithCATEGORY_MAINTENANCErrrrrrs.