o ]Lb"@s4ddlmZddlmZddlmZddlmZm Z m Z m Z m Z mZmZmZmZmZmZmZe jZiZeeZd+ddZd d Z d,d dZedddgededfddd edfddd edfddd edfddd edfddd ed fd!d"ged#ed$fdd%d ed&fged'ejd(d)d*Zd S)-)absolute_import)_)getattr) bookmarkscmdutilerrorhglock logcmdutil mergestatepycompat registrarrepairscmutilutilFcCs6|}|st|t||Stj|dd|S)NT) skipmerge)statusrcheckunfinished bailifchanged)repoforcesr1/usr/lib/python3/dist-packages/mercurial/strip.pychecklocalchangess  rc Cs|j|d\}}|d}t|dr*||jkr*|dd|jjDvr*|}|S|||krMd}d}||||||||}|rM|j}| | }|S)NrsmqcSsg|]}|jqSrnode).0xrrr +sz%_findupdatetarget..sparents(wdir())s7max(((parents(%ln::%r) + %r) - %ln::%r) and branch(%s))) changelogparentsbranchr safehasattrnullidmqappliedrevsrfirst) rnodesunodep2 currentbranchpwdirrevset branchtargetclrrr_findupdatetarget$s$    r2TNc CsB||v|r%t||dt||}t|||j||r0t ||||nt |||||j } |rx| d} |j|vrMt|| || dd|DWdn1scwYt|D] } |td| qlWdn1swYWddSWddS1swYdS)N)rsstripcSg|]}|dfqSNrrbrrrr Wzstrip..bookmark '%s' deleted )wlockr rr2r cleandirstatewritecurrenttransactionr softstripstrip _bookmarks transaction_activebookmark bookmarksmod deactivate applychangessortedr) uirr(updatebackuprrsofturev repomarkstrbookmarkrrrr?;s(        Pr?s debugstriprrevsNstrip specified revision (optional, can specify revisions without this option)sREVfforcesDforce removal of changesets, discard uncommitted changes (no backup)s no-backupsdo not save backup bundlenobackups&do not save backup bundle (DEPRECATED)nsignored (DEPRECATED)kkeeps,do not modify working directory during stripBbookmarks.remove revs only reachable from given bookmarksBOOKMARKsofts:simply drop changesets from visible history (EXPERIMENTAL)s1hg debugstrip [-k] [-f] [-B bookmark] [-r] REV...) helpcategoryc s~t|}d}|ds|drd}jt||d}tt|}t|d}|rˈj }| |sRt t ddt|t|i}t|D] \}} || g|qY|D]} || rt| d } |t| qk|sˈ+d} d d |D} || | Wd n1swYWd n1swYt|D] }|t d |q|st t dt|}||||}t fddj!"D}fdd|D}t#dd }|d urA|j$rA%&dvrAd|_'d }t(|j$}t)|j$D]\}}|j*|vr5|}nq'|j$||=|+t|}|r|drt,|}|}-d|%}g}|D] }|.|/qcj!fdd D}|.|j!0||1|j!2t3j45d}t6|||||d||ddWd d S1swYd S)astrip changesets and all their descendants from the repository The strip command removes the specified changesets and all their descendants. If the working directory has uncommitted changes, the operation is aborted unless the --force flag is supplied, in which case changes will be discarded. If a parent of the working directory is stripped, then the working directory will automatically be updated to the most recent available ancestor of the stripped parent after the operation completes. Any stripped changesets are stored in ``.hg/strip-backup`` as a bundle (see :hg:`help bundle` and :hg:`help unbundle`). They can be restored by running :hg:`unbundle .hg/strip-backup/BUNDLE`, where BUNDLE is the bundle file created by the strip. Note that the local revision numbers will in general be different after the restore. Use the --no-backup option to discard the backup bundle once the operation completes. Strip is not a history-rewriting operation and can be used on changesets in the public phase. But if the stripped changesets have been pushed to a remote repository you will likely pull them again. Return 0 on success. Ts no_backuprTFrPrYsbookmark '%s' not found,rcSr3r4rr5rrrr r7zdebugstrip..Nr8sempty revision setc3s(|]}|jko|vVqdSr4)r%rev)rp)r1r strippedrevsrr s  zdebugstrip..csh|]}|qSrr)rr)r1rr szdebugstrip..r&sqtiprWs only(., %d)csg|] }|js|qSr) get_entry maybe_clean)rf)r;rrr s  rRrZ)rIrHrrrJ)7r byteskwargsgetr!listsetr revranger9r@issubsetrAbortrjoinrFkeys iteritems setdefaultappendvalues issupersetr bookmarkrevsrHr rArEr< descendantsunion differenceanyr;r"rr'r]lookup applieddirtylen enumerater savedirtyr2r(extendfilesrebuildmanifestr= mergestatemodr r:r?)rGrr(optsrIrrLnodetobookmarksmarkrmarksrsrevsrM bmchangesrNrurootsrH rootnodesqstartendi statusentryrKuctxdescendantrevs changedfilesr] dirchangesr)r1r;rr_r debugstrip\s S                ccr)F)TTNNF) __future__ri18nrr rrrCrrr r lockmodr r rrrrrreleasecmdtablecommandrr2r?CATEGORY_MAINTENANCErrrrrsx  8    !  16