a +b( @s"dZddlmZddlmZddlmZmZmZm Z m Z m Z m Z mZmZmZmZiZeeZiZeeZeddddedd ddd Zd#d d Zedddd edfdddedfdddededfgejejejejedejdddZddZedgejdd d!d"Zd S)$aHuncommit part or all of a local changeset (EXPERIMENTAL) This command undoes the effect of a local commit, returning the affected files to their uncommitted state. This means that files modified, added or removed in the changeset will be left unchanged, and so will remain modified, added and removed in the working directory. )absolute_import)_) cmdutilcommandscontextcopieserrorobsutilpathutilpycompat registrar rewriteutilscmutil experimentaluncommitondirtywdirF)default uncommit.keepsships-with-hg-coreNc s|}t|}fdd|D} | s.dS|s>|S|| t||fddtD|dffdd } s|j t d |dur| }|s| }|s| }tj|||jg|| |||d } || S) zrRecommit ctx with changed files not in match. Return the new node identifier, or None if nothing changed. csh|]}|r|qSr.0f)matchr4/usr/lib64/python3.9/site-packages/hgext/uncommit.py Gz"_commitfiltered..Ncsi|]\}}|vr||qSrr)rdstsrc)filesrr Tsz#_commitfiltered..rc sF||vr dS||}tj|||||||d}|S)N)Z copysource)rZ memfilectxpathdataislinkZisexecget)repomemctxrZ contentctxZredirectZfctxZmctx)copiedrr filectxfnXs z"_commitfiltered..filectxfnsnote: keeping empty commit parentstextrr&userdateextra)p1setrnode copiesmodZ pathcopiesr Z iteritemsuistatusr descriptionr*r+rr$Znullidr, commitctx) r#ctxr keepcommitmessager*r+baseZ initialfilesZexcluder&newr)r%rrr_commitfiltered>s@      r:uncommitrkeeps(allow an empty commit after uncommittingsallow-dirty-working-copys'allow uncommit with outstanding changesnsnotesstore a note on uncommitsTEXTs[OPTION]... [FILE]...) helpcategoryc Os|t|t||t|}|<||}|j|j |j |j f\}}}}t t ||||t |@} |dp|jdd} | s|r| rtj|tdd|d} t|| gdt| dkrttd t| ||} | r| j| | d d } t | j t | jBt | j B}t | |}|rb|d d t|D8}t|D]\}|| j vrtd}n |j!"|rtd}ntd}tjtdt#|||dqj|$dR|ds|ds| %|d<t&||}|}|s4|'ddur(|'d}n |dd}t(|| | |||'d|'dd}|dur|tdWdWdWddSi}|| )kr|f|| )<n d|| )<|j*+"t,|||| Wdn1s0Ytj-||dd dWdn1s.0YWdn1sN0YWdn1sn0YdS)auncommit part or all of a local changeset This command undoes the effect of a local commit, returning the affected files to their uncommitted state. This means that files modified or deleted in the changeset will be left unchanged, and so will remain modified in the working directory. If no files are specified, the commit will be pruned, unless --keep is given. sallow_dirty_working_copyrrs/requires --allow-dirty-working-copy to uncommit)hint.r;scannot uncommit merge changesetT)Z listcleancSsh|]}|qSrrrrrrrrzuncommit..s0file was not changed in working directory parents.file was untracked in working directory parentsfile does not existscannot uncommit "%s"smessageslogfiler<Nrsusersdate)r7r*r+snothing to uncommit rZfixphase).rZcheck_note_sizeZresolve_commit_optionsr Z byteskwargswlocklockr2ZmodifiedZaddedZremovedZdeletedanyr.r1Z configboolZ bailifchangedrr precheckrevlenr(r InputErrorrrrr-r dirssortedZcleanZwvfsexistsZ getuipathfn transactionr3Z logmessager"r:r/dirstate parentchange movedirstate cleanupnodes)r1r#ZpatsoptsstmardZ isdirtypathZallowdirtywcopyoldrsZeligibleZbadfilesrr?r7r6Znewidmappingrrruncommit~s               (  2r[ccs4|jj|dD]}t||VqdS)zFyields the obsolete markers marking the given changeset as a successorrN)r#ZobsstoreZ predecessorsr"r/r Zmarker)r5r rrrpredecessormarkerssr\unamendT)r>Z helpbasicc s|}|||d||dt|gdtdkrht t dd}t fdd|Dst t dt t}t|dkrt d }t |t||d }||}|d <fd d } tj|f| |d} || } || } |j} | t|| Wdn1sp0Y| fi}tj ||dddWdn1s0YWdn1s0YWdn1s0YdS)a3undo the most recent amend operation on a current changeset This command will roll back to the previous version of a changeset, leaving working directory in state in which it was before running `hg amend` (e.g. files modified as part of an amend will be marked as modified `hg status`) r]r@rAscannot unamend merge changeset)s amend_sourceunamend_sourcec3s|]}|vVqdSN)r,)rkey)curctxrr rzunamend..sAworking copy parent was not created by 'hg amend' or 'hg unamend's:changeset must have one predecessor, found %i predecessorsrr^cs&z |WSty YdS0dSr_)ZfilectxKeyError)r#Zctx_r)predctxrrr&.s  zunamend..filectxfnr'NTrB)!Z unfilteredrCrDrMr rFrGrHr(rrIrrElistr\prednoder,hexrr$r-Zp2r3rr*r+r4rNrOrrPr/rQ)r1r#rRZunfiZ expected_keysZmarkerserfextrasr&ZnewctxZ newprednodeZ newpredctxrNrZr)rardrunamendsN&       ,rj)NNN) __doc__Z __future__rZmercurial.i18nrZ mercurialrrrrr0rr r r r r rZcmdtableZcommandZ configtableZ configitemZ testedwithr:ZwalkoptsZ commitoptsZ commitopts2Z commitopts3ZCATEGORY_CHANGE_MANAGEMENTr[r\rjrrrr sd  4    @     g