o ö]LbJã@sžddlmZddlZddlmZddlmZmZddlm Z m Z m Z m Z m Z mZdd„Zdd d „Zdd d „Zdd„Zddd„Zdd„Z ddd„Zdd„ZdS)é)Úabsolute_importNé)Ú_)ÚhexÚnullrev)ÚcontextÚ mergestateÚmetadataÚphasesÚscmutilÚ subrepoutilcCs@|jdkr d}d}||fS|j dd¡}|dk}|dv}||fS)zÊreturn a (changelog, filelog) boolean tuple changelog: copy related information should be stored in the changeset filelof: copy related information should be written in the file revision óchangeset-sidedataTó experimentalscopies.write-toóchangeset-only)rs compatibility)ÚfilecopiesmodeÚuiÚconfig)ÚrepoÚwritechangesetcopyÚwritefilecopymetaÚ writecopiesto©rú2/usr/lib/python3/dist-packages/mercurial/commit.pyÚ_write_copy_metas úrFc CsØ| ¡}| ¡| ¡}}| ¡}| ¡Í| d¡·}t||||d\}} | ¡ ¡} | dur;dD]} |   | d¡q2|j j dkrGt || | ƒ} |j   ¡} |j tdƒ¡|j  |¡|j  || | ¡|| ¡| ¡|| ¡| ¡ } ||  ¡}| |j   ¡kr‡| ||j  |¡¡| ¡|r| ¡p‘d}}|jdd t| ƒ||d t |j|¡}| |j   ¡ko´|| ¡ }|rÂ|sÂt ||||g¡| WdƒWdƒS1sÕwYWdƒdS1såwYdS) a‡Add a new revision to the target repository. Revision information is passed via the context argument. ctx.files() should list all files involved in this commit, i.e. modified/added/removed files. On merge, it may be wider than the ctx.files() to be committed, since any file nodes derived directly from p1 or p2 are excluded from the committed ctx.files(). origctx is for convert to work around the problem that bug fixes to the files list in changesets change hashes. For convert to be the identity, it can pass an origctx and this function will use the same files list when it makes sense to do so. scommit)ÚerrorÚorigctxN)óp1copiesóp2copiesó filesaddedó filesremovedsextrascommitting changelog ós pretxncommitT)ÚthrowÚnodeÚparent1Úparent2) Ú unfilteredÚp1Úp2ÚuserÚlockÚ transactionÚ_prepare_filesÚextraÚcopyÚpopÚ changelogÚ_copiesstorageÚ_extra_with_copiesÚtiprevrÚnoterÚ delayupdateÚaddÚ descriptionr"ÚdateÚrevÚregister_changesetÚchangelogrevisionrÚhookr ÚnewcommitphaseÚphaser Ú registernew)rÚctxrrr&r'r(ÚtrÚmnÚfilesr,ÚnameÚoldtipÚnr8Úxp1Úxp2Ú targetphaseÚ waspublicrrrÚ commitctx-sT     ÷ ûRÆrJcCst| ¡}| ¡}t|ƒ\}}t ¡}tj |¡} t|| |ƒ} | D]} | | ¡q i} | ¡  ¡  ¡sJ|   ¡  ¡D]\} }|  d¡}|durI|| | <q8| ¡rr| sr|j d¡| ¡}| | ¡¡|rq| | ¡¡| | ¡¡n| ¡sƒ| sƒ|j d¡| ¡}n t||| || |d}|r¦| ¡|kr¦| ¡}|j |¡s¡J‚| |¡|r¶| | ¡¡| | ¡¡||fS)Nsoutside-narrow-merge-actionsreusing known manifest s*reusing manifest from p1 (no file change) )r)rr&rr Ú ChangingFilesrÚreadÚ _get_salvagedÚ mark_salvagedÚ narrowmatchÚalwaysÚ allextrasÚitemsÚgetÚ manifestnoderÚdebugÚupdate_touchedrBÚ update_addedÚ filesaddedÚupdate_removedÚ filesremovedÚ_process_filesÚtouchedÚissubsetÚupdate_copies_from_p1Úp1copiesÚupdate_copies_from_p2Úp2copies)r@r?rrrr&rrrBÚmsÚsalvagedÚsÚ narrow_filesÚfÚeÚactionrAÚ origfilesrrrr+~sF     €  €    r+cCsng}|jdk}|r5t| ¡ƒdkr5| ¡r5t| ¡ ¡ƒD]}| |¡ d¡}|dkr4||vr4|  |¡q|S)zzreturns a list of salvaged files returns empty list if config option which process salvaged files are not enabledr rómerge-removal-candidateóyes) rÚlenÚparentsÚactiveÚsortedrQÚkeysÚextrasrSÚappend)rrbr?rcÚcopy_sdÚfnameÚ might_removedrrrrM©s  €rMc st| ¡}| ¡}| ¡}t|ƒ\} } | ¡} | ¡} |  ¡} |  ¡‰|  ¡‰|  ¡‰g}t| ¡ƒ}t |ƒ}|j   t dƒ¡t  |¡}| ¡| ¡}| | ¡¡| ¡|D] }|j   ||ƒd¡||vrØ| |¡}|tjkr~| |¡| |¡nY|tjkr£| |¡| |¡ˆ|ˆ|<|  |¡dp›d}ˆ ||¡n4|tjkrÈ| |¡| |¡ˆ|ˆ|<|  |¡dpÀd}ˆ ||¡nt dƒ}t dƒ}|j||d‚qXzJ||}|durç| |¡n:| |¡t ||ˆˆ||| |ƒ\ˆ|<}|r|dkr | |¡n|d kr| !|¡n| |¡ˆ || "¡¡WqXt#y7|j  $t d ƒ||ƒ¡‚t%yc}z t&|d t'j(ƒ}|sR|r^|t'j(kr^|j  $t d ƒ||ƒ¡‚d}~ww‡‡fd d „|Dƒ}t)‡fdd „|Dƒƒ}|D]}ˆ|=q{| *¡t+kr| ,|¡nt- .|||ˆˆf¡}|D] }||ƒs§| |¡q›t/|||| ˆ|j0||t1|ƒƒ }|S)Nscommitting files: ó rr s/corrupted mergestate, unknown narrow action: %bsrestart the merge)ÚhintÚaddedÚmergedstrouble committing %s! Úerrnocs g|] }|ˆvs |ˆvr|‘qSrr©Ú.0rf)Úm1Úm2rrÚ s z"_process_files..csg|]}|ˆvr|‘qSrrr{)Úmrrrs)2rr&r'rÚ manifestctxr-rLÚlistÚremovedrlrr3rr Ú getuipathfnÚmodifiedrxÚextendrpÚsortrSrÚCHANGE_REMOVEDÚ mark_removedrrÚ CHANGE_ADDEDÚ mark_addedÚfindÚsetflagÚCHANGE_MODIFIEDÚ mark_touchedÚAbortÚ _filecommitÚ mark_mergedÚflagsÚOSErrorÚwarnÚIOErrorÚgetattrrzÚENOENTror8rrYr Úget_removal_filterÚ_commit_manifestr\Úbool)r@r?rbrBrerrr&r'rrÚm1ctxÚm2ctxÚmctxrxrƒÚlinkrevÚuipathfnÚ all_filesrfÚ narrow_actionr“ÚmsgrwÚfctxÚ is_touchedÚinstÚerrcodeÚdropÚrfrAr)r€r}r~rr[ºs´                   ÿ     €€ü    €÷ r[cCs | ¡}| ||j¡} | ||j¡} d} | | kr|jkr#nnd} t|tjƒr]| ¡} | | | fvr]|j d|¡| |jkrI|  |¡|  ¡ksW| |jkrY|  |¡|  ¡krYd} | | fS|  |¡} i}|  ¡}d}|r»||kr»| |¡}| }|rŒ| |jks‚|durŒ||vrŒ||}| }|r®|j d||t |ƒf¡|r§||d<t |ƒ|d<|j|} } nc|j  tdƒ||f¡nV| |jkrÇ| |j} } nJ| |jkr| ¡râ| |¡ d ¡d krâ| |j} } n/| ¡r÷| |¡ d ¡d kr÷| |j} } n|  | | ¡}| |vr | |j} } n| |vr|j} d }|j dd¡r-| ¡r-| |¡ d¡d kr-d}| ¡}| |jksJ| |jksJ|sJ|  | |¡sJ|rh| durZ| |jkrXd} nd} |  ||||| | ¡}|| fS||vr|  |¡|  ¡krd} | }|| fS| }|| fS)a commit an individual file as part of a larger transaction input: fctx: a file context with the content we are trying to commit manifest1: manifest of changeset first parent manifest2: manifest of changeset second parent linkrev: revision number of the changeset being created tr: current transation includecopymeta: boolean, set to False to skip storing the copy data (only used by the Google specific feature of using changeset extra as copy source of truth). ms: mergestate object output: (filenode, touched) filenode: the filenode that should be used by this changeset touched: one of: None (mean untouched), 'added' or 'modified' Nrxsreusing %s filelog entry r…s %s: copy %s:%s scopyscopyrevs8warning: can't find ancestor for '%s' copied from '%s'! sfilenode-sourcesothersmergedrkFrsmerge-track-salvagedrjTry)ÚpathrSÚnullidÚ isinstancerÚfilectxÚfilenoderrUr“ÚfileÚ copysourcerr•rrnrqÚcommonancestorsheadsÚ configboolÚdataÚcmpr5)rr¤Ú manifest1Ú manifest2rŸr@ÚincludecopymetarbrtÚfparent1Úfparent2r\r"ÚflogÚmetaÚcfnameÚfnodeÚcnodeÚ newfparentÚfparentancestorsÚforce_new_nodeÚtextrrrr‘ s¢         ÿüÿ      ÿþ  ÿ þý  ûÿr‘c  CsÂ| ¡} d} | ¡} | ¡} |  ¡} |  ¡}|s$| |t | | ¡¡¡} |s.| r.| j   d¡|s2| rU| j   t dƒ¡|r?d}n|   ¡}|j|||  ¡|  ¡|||d}|S| j   d¡|  ¡}|S)amake a new manifest entry (or reuse a new one) given an initialised manifest context and precomputed list of - files: files affected by the commit - added: new entries in the manifest - drop: entries present in parents but absent of this one Create a new manifest revision, reuse existing ones if possible. Return the nodeid of the manifest revision. NsInot reusing manifest (no file change in changelog, but manifest differs) scommitting manifest )Úmatchs;reusing manifest from p1 (listed files actually unchanged) )rr&r'rrLÚdiffr Ú matchfilesrBrrUr3rrOÚwriterT)r@rŸr?ržÚmanifestrBrxr¨Úhas_some_narrow_actionrÚmdr&r'rœr}rÃrArrrršÅs@ÿùûÿršcCsì|j}|j}|j}|j}t|jƒ}t|ƒds'|pd}|pd}|p"d}|p&d}||||f}|dur!s€z%_extra_with_copies..rrrr) Úcopied_from_p1Úcopied_from_p2rxrƒror\rÚanyr Ú encodecopiesÚencodefileindices)rr,rBr_rarXrZÚ extrasentriesrrrr1s4       r1)FN)NF)F)Ú __future__rrzÚi18nrr"rrÚrrr r r r rrJr+rMr[r‘ršr1rrrrÚs     Q+ f/ ÷ J