
    6hI                        S SK Jr  SSKJr  SSKJrJr  SSKJrJ	r	J
r
JrJrJr  S rSS jrSS	 jrS
 rSS jrS r SS jrS rg)    )annotations   )_)hexnullrev)context
mergestatemetadataphasesscmutilsubrepoutilc                    U R                   S:X  a  SnSnX4$ U R                  R                  SS5      nUS:g  nUS;   nX4$ )zreturn 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   experimentals   copies.write-to   changeset-only)r   s   compatibility)filecopiesmodeuiconfig)repowritechangesetcopywritefilecopymetawritecopiestos       2/usr/lib/python3/dist-packages/mercurial/commit.py_write_copy_metar      sh     33!  00 8JK)->>* /
 
 00    Nc                   U R                  5       n UR                  5       UR                  5       pTUR                  5       nU R	                  5          U R                  S5       n[        XqX#S9u  pUR                  5       R                  5       n
U
b  S H  nU
R                  US5        M     U R                  R                  S:X  a  [        X
U	5      n
U R                  R                  5       nU R                  R                  [!        S5      5        U R                  R#                  U5        U R                  R%                  UU	UR'                  5       UUR)                  5       UR)                  5       UUR+                  5       U
5	      nX   R-                  5       nXR                  R                  5       :w  a*  U R/                  XR                  R1                  U5      5        UR3                  5       U=(       a    UR3                  5       =(       d    SnnU R5                  SS	[3        U5      UUS
9  [6        R8                  " U R                  U5      nXR                  R                  5       :H  =(       a    X   R;                  5       (       + nU(       a   U(       d  [<        R>                  " XUU/5        UsSSS5        sSSS5        $ ! , (       d  f       O= fSSS5        g! , (       d  f       g= f)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.
s   commit)errororigctxN)   p1copies   p2copies
   filesadded   filesremoveds   extras   committing changelog
r   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   ctxr   r   r(   r)   r*   trmnfilesr.   nameoldtipnr:   xp1xp2targetphase	waspublics                      r   	commitctxrL   +   s*    ??DVVXsvvx88:D	d&&y1R"2%I			  " 		$% >>((H4&tE:E &&( 	Q012""2&NNOOGGIGGIHHJ

 gkkm^^**,,##C)I)I#)NO668R_BFFH3S		Q 	 	
 "00#> nn3355Odioo>O:O	y tse<u 2111s%   K"IK/	K
K	K
K*c           	     D   UR                  5       nUR                  5       n[        U5      u  pg[        R                  " 5       n[
        R
                  R                  U5      n	[        XIU5      n
U
 H  nUR                  U5        M     0 nUR                  5       R                  5       R                  5       (       dA  U	R                  5       R                  5        H  u  pUR                  S5      nUc  M  XU'   M!     UR                  5       (       a  U(       d  UR                  R!                  S5        UR                  5       nUR#                  UR%                  5       5        U(       a>  UR'                  UR)                  5       5        UR+                  UR-                  5       5        OSUR%                  5       (       d3  U(       d,  UR                  R!                  S5        UR                  5       nO[/        XXXS9nU(       aW  UR                  5       U:X  aC  UR%                  5       nUR0                  R3                  U5      (       d   eUR#                  U5        U(       a>  UR5                  UR7                  5       5        UR9                  UR;                  5       5        UU4$ )Ns   outside-narrow-merge-actions   reusing known manifest
s*   reusing manifest from p1 (no file change)
)r   )r   r(   r   r
   ChangingFilesr	   read_get_salvagedmark_salvagednarrowmatchalways	allextrasitemsgetmanifestnoder   debugupdate_touchedrD   update_added
filesaddedupdate_removedfilesremoved_process_filestouchedissubsetupdate_copies_from_p1p1copiesupdate_copies_from_p2p2copies)rB   rA   r   r   r   r(   r   r   rD   mssalvagedsnarrow_filesfeactionrC   	origfiless                     r   r-   r-   |   s   88:D	B,<T,B)""$E				#	#D	)BTs+HA  L88:!!#**,,LLN((*DAUU9:F!"(Q + ,12SYY[)s~~/0  !1!1!34YY[[DE__BRJ7'')R/MMO	}}%%i0000Y'##CLLN3##CLLN3u9r   c                v   / nU R                   S:H  nU(       a  [        UR                  5       5      S:  a  UR                  5       (       an  [	        UR                  5       R                  5       5       HC  nUR                  U5      R                  S5      nUS:X  d  M+  XR;   d  M2  UR                  U5        ME     U$ )zrreturns 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sortedrT   keysextrasrV   append)r   re   rA   rf   copy_sdfnamemight_removeds          r   rP   rP      s    
 H!!%::G3s{{}%)99;; 3 3 56 "		% 0 4 45O P F*| .	 7
 Or   c                D	   UR                  5       nUR                  5       nUR                  5       n[        U5      u  pUR	                  5       nUR	                  5       nUR                  5       nUR                  5       nUR                  5       nUR                  5       n/ n[        UR                  5       5      n[        U5      nUR                  R                  [        S5      5        [        R                  " U5      nUR                  5       UR!                  5       -   nUR#                  UR%                  5       5        UR'                  5         U GH#  nUR                  R                  U" U5      S-   5        UU;   GaI  UR)                  U5      nU[*        R,                  :X  a#  UR/                  U5        UR1                  U5        OU[*        R2                  :X  aX  UR5                  U5        UR1                  U5        UU   nUR7                  U5      S   =(       d    SnUR9                  UUU5        OU[*        R:                  :X  aX  UR=                  U5        UR1                  U5        UU   nUR7                  U5      S   =(       d    SnUR9                  UUU5        O&[        S5      n[        S5      nUR?                  UUS9eGMx   UU   nUc  UR1                  U5        GM  UR1                  U5        [A        UUUUUX
U5      u  nnU(       aA  US:X  a  UR5                  U5        O)US	:X  a  URC                  U5        OUR=                  U5        UR9                  UUURE                  5       5        GM&     U Vs/ s H  nUU;   d  UU;   d  M  UPM     nn[K        U Vs/ s H  nUU;   d  M  UPM     sn5      nU H  nUU	 M     URM                  5       [N        :X  a  URQ                  U5        OB[R        RT                  " XXU45      nU H#  nU" U5      (       a  M  UR/                  U5        M%     [W        U UUUUURX                  UU[[        U5      5	      n U $ ! [F         a/    UR                  RI                  [        S
5      U" U5      -  5        e f = fs  snf s  snf )Ns   committing files:
   
r   r   s/   corrupted mergestate, unknown narrow action: %bs   restart the merge)hintaddedmergeds   trouble committing %s!
).r   r(   r)   r   manifestctxr/   rO   listremovedrp   r   r5   r   r   getuipathfnmodifiedr}   extendrt   sortrV   r	   CHANGE_REMOVEDmark_removedrv   CHANGE_ADDED
mark_addedfindsetCHANGE_MODIFIEDmark_touchedAbort_filecommitmark_mergedflagsOSErrorwarnrs   r:   r   r\   r
   get_removal_filter_commit_manifestr_   bool)!rB   rA   re   rD   rh   r   r   r(   r)   r   r   m1ctxm2ctxmctxmm1m2r}   r   linkrevuipathfn	all_filesri   narrow_actionfnoder   msgr|   fctx
is_toucheddroprfrC   s!                                    r   r^   r^      s   88:D	B	B,<T,B)NNENNE::<D		A	B	B E3;;=!G$iGGGLL)*+""4(H,I\&&()NNXa[5()(,,Q/M
 9 99""1%q!*"9"99  #Q1

1a(/Ca&*"<"<<""1%Q1

1a(/Ca&JK-.kk#Dk11	q6D|q!Q$/$B%!z !W,((+#x/))!,**1-a

-Q \ "8'QQ"WRq'G8g0ga1g01DaD 	vvx7W%((22.>?Aa55""1%  

	\

B I;  	GGLL67(1+EF	
 90s+   	Q%BQ<RR!
R/R9Rc                   UR                  5       nUR                  XR                  5      n	UR                  XR                  5      n
SnXs=:X  a  U R                  :X  a  O  OSn[        U[        R
                  5      (       a  UR                  5       nXU
4;   a  U R                  R                  SU-  5        XR                  :w  a#  UR                  U5      UR                  5       :w  d2  XR                  :w  a%  UR                  U5      UR                  5       :w  a  SnX4$ U R                  U5      n0 nUR                  5       nSnU(       a  X:w  a  UR                  U5      nU
nU(       a  XR                  :X  d  Uc  X;   a  X?   nU	nU(       aQ  U R                  R                  SX[        U5      4-  5        U(       a  XS'   [        U5      US'   U R                  UpGOU R                  R                  [        S5      X4-  5        OXR                  :X  a  XR                  pOXR                  :w  a  UR                  5       (       a1  UR!                  U5      R                  S	5      S
:X  a  XR                  pO|UR                  5       (       a1  UR!                  U5      R                  S5      S:w  a  XR                  pO6UR#                  X5      nU	U;   a  XR                  pOU
U;   a  U R                  n
SnU R                  R%                  SS5      (       a;  UR                  5       (       a&  UR!                  U5      R                  S5      S:X  a  SnUR'                  5       nXR                  :w  d4  XR                  :X  d%  U(       d  UR)                  U	U5      (       d  U(       a/  Uc  XR                  :X  a  SnOSnUR+                  UXXIU
5      nUU4$ X;   a+  UR                  U5      UR                  5       :w  a  SnU	nUU4$ U	nUU4$ )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'
Nr}   s   reusing %s filelog entry
r   s    %s: copy %s:%s
s   copys   copyrevs8   warning: can't find ancestor for '%s' copied from '%s'!
s   filenode-sources   others   mergedro   Fr   s   merge-track-salvagedrn   Tr~   )pathrV   nullid
isinstancer   filectxfilenoder   rX   r   file
copysourcer   r   r   rr   ru   commonancestorsheads
configbooldatacmpr7   )r   r   	manifest1	manifest2r   rB   includecopymetare   rx   fparent1fparent2r_   r$   flogmetacfnamer   cnode
newfparentfparentancestorsforce_new_nodetexts                         r   r   r     sc   > IIKE}}UKK0H}}UKK0HG*t{{*$(( }}h''GGMM7%?@KK'OOE*djjl:KK'OOE*djjl:$= 99UDD__FE&/( f%
KK'5=&%-E!)J GGMM.%U1LLM &W#&u:Z !%jhGGLL+ /	" 
[[	 %{{(	[[	 99;;299U+//0BCxO!);;hYY[[RYYu-11)<F!);;h  $88L++%-{{(--;;N 	?,CDDIIKKIIe  !;<F99;DKK{{"88Hd##?;;&$"tHE '> 
		 6$**, F '> '>r   c	           
        UR                  5       n	Sn
UR                  5       nUR                  5       nUR                  5       nUR	                  5       nU(       d4  UR                  U[        R                  " XR                  5       5      5      n
U(       d"  U
(       a  U	R                  R                  S5        U(       d  U
(       aq  U	R                  R                  [        S5      5        U(       a  SnOU	R                  5       nUR                  U UUR                  5       UR                  5       UUUS9nU$ U	R                  R                  S5        UR                  5       nU$ )ac  make 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.
NsI   not reusing manifest (no file change in changelog, but manifest differs)
s   committing manifest
)matchs;   reusing manifest from p1 (listed files actually unchanged)
)r   r(   r)   r   rO   diffr   
matchfilesrD   r   rX   r5   r   rR   writerW   )rB   r   rA   r   manifestrD   r}   r   has_some_narrow_actionr   mdr(   r)   r   r   r   rC   s                    r   r   r     s   , 88:D	B 
B	BNNE	B WWXw11$		DER2	
 Q/01 "E$$&EZZOOOO  
 I 	O	
 __Ir   c                6   UR                   nUR                  nUR                  nUR                  n[	        UR
                  5      n[        U 5      S   (       d,  U=(       d    SnU=(       d    SnU=(       d    SnU=(       d    SnX4XV4nUc  [        S U 5       5      (       a  0 nUb  [        R                  " X#5      nX1S'   Ub  [        R                  " X$5      nXAS'   Ub  [        R                  " X%5      nXQS'   Ub  [        R                  " X&5      nXaS'   U$ )z2encode copy information into a `extra` dictionnaryr   Nc              3  (   #    U  H  oS Lv   M
     g 7f)N ).0xs     r   	<genexpr>%_extra_with_copies.<locals>.<genexpr>  s     BMqd]Ms   r   r    r!   r"   )copied_from_p1copied_from_p2r}   r   rs   r_   r   anyr
   encodecopiesencodefileindices)r   r.   rD   rb   rd   r[   r]   extrasentriess           r   r3   r3     s   ##H##HJ==L5==!ED!!$
 #t#t'4
#+t
@M}BMBBB((9%k((9%k//B
)m11%F!-oLr   )FN)NF)F)
__future__r   i18nr   r$   r   r    r   r	   r
   r   r   r   r   rL   r-   rP   r^   r   r   r3   r   r   r   <module>r      sR    # 
 1&Nb(V"^Bb\ !GT r   