403Webshell
Server IP : 74.208.236.16  /  Your IP : 216.73.217.15
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : u102440577 ( 7172810)
PHP Version : 8.4.26
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /kunden/lib/python3/dist-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /kunden/lib/python3/dist-packages/mercurial/__pycache__/exchange.cpython-313.pyc
�

6�h�����SSKJr SSKrSSKrSSKJr SSKJrJr SSK	J
rJrJ
r
JrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJ r  SSK!J"r"J#r#J$r$ SSK%J&r& \RNr'\RPr(S	r)SoS
jr*Sr+Sr,S
r-Sr.Sr/"SS5r0\"S5\"S54\"S5\"S54\"S5\"S54S.r1SpSjr2/r30r4Sr5Sr6Sr7\5"S5S5r8\5"S5S 5r9\5"S!5S"5r:\5"S#5S$5r;S%r<S&r=/r>0r?SoS'jr@S(rAS)rB\@"S*5S+5rC\@"S,5S-5rD\@"S5S.5rE\@"S5S/5rFS0rGS1rH\@"S25S35rI\@"S#5S45rJS5rKS6rLS7rMS8rN\@"S9SS:9S;5rOS<rPS=rQS>rR\R�4S?jrTS@rUSArV"SBSC5rW"SDSE\R�5rYSFrZSGr[SHr\SqSIjr]/r^0r_SJr`SKra\`"SL5SM5rb\`"SN5SO5rcSPrdSQreSRrfSSrgSTrhSUriSVrjSWrkSoSXjrlSYrm/rn0roSoSZjrpS[rqSrS\jrr\p"S]5S^5rs\p"SN5SsS_j5rt\p"S#5StS`j5ru\p"Sa5StSbj5rv\p"S25SuScj5rw\p"Sd5SuSej5rx\p"Sf5SrSgj5ry\p"Sh5SrSij5rzSjr{Skr|Slr}Smr~Snrg)v�)�annotationsN�)�_)�hex�nullrev)�	bookmarks�bundle2�bundlecaches�changegroup�	discovery�error�lock�logexchange�
narrowspec�obsolete�obsutil�phases�pushkey�pycompat�requirements�scmutil�streamclone�url�util�wireprototypes)�hashutil�
stringutil�urlutil)�
repositorys	narrowaclc��[R"US5nSnU(dISnURS5(d0URS5(a[R"X5nSnSnOU(aUR	U5nUSSUSSpvUS:wa"[
R"[S	5U-5eUS
:Xa0Uc[R"US5n[R"X5$URS5(a[R"XXg-S9$US
:Xa[R"U5$[
R"[S5X'4-5e)N��streamsHG�sHG10sUNr�s%s: not a Mercurial bundles10�2)�magicstringsS1s%s: unknown bundle version %s)
r�readexactly�
startswith�headerlessfixup�joinr
�Abortr�cg1unpackerr	�getunbundlerr�streamcloneapplier)�ui�fh�fname�vfs�header�alg�magic�versions        �4/usr/lib/python3/dist-packages/mercurial/exchange.py�
readbundler85s2��
�
$�
$�R��
+�F�
�C����� � ��'�'�F�,=�,=�e�,D�,D��,�,�R�8�B��F��C��	��������A�a�[�&��1�+�7���~��k�k�!�9�:�U�B�C�C��%���;��)�)�"�a�0�C��&�&�r�/�/�	�	�	�D�	!�	!��#�#�B���H�H�	�E�	��-�-�b�1�1��k�k�
�.�/�5�2B�B�
�	
�c��/n[UR55H/up#[RU5nUR	SX#4-5 M1 SRU5$)Ns%s=%s�;)�sorted�items�urlreq�quote�appendr*)�params�parts�key�values    r7�_format_paramsrETsP���E��V�\�\�^�,�
�����U�#��
���X���,�-�-��9�9�U��r9c��Sn0n[XS5n[U[R5(aJURnUS:XaSnU"U5nU(d"[
R"[S5U-5eSU-$[U[R5(Ga�SUR;a?U"URS5nU(d"[
R"[S5U-5eOSnSnUR5GH\nURS	:XaQURS
n	U	S;aSnM-U	S
;aSnX�S'M;[
R"[S5U-[S5S9eURS:XaSUcP[RURS5n
U
R"5n[R "U5nSU-s $URS:XaSUcP[RURS5n
U
R"5n[R "U5nSU-s $URS:XdGM>SUS'UR"(aGMWSUS'GM_ U(dSUS	'SnSXg4-nU(aUS-
nU[%U5-
nU$[U[&R(5(a4[&R*"U5Sn
[R "U
5n
SU
-$[
R"[S 5U-5e)!z�Infer the bundlespec from a bundle file handle.

The input file handle is seeked and the original seek position is not
restored.
c��[RRU5R5S$![a gf=f�Nr)r�compengines�
forbundletype�
bundletype�KeyError)r4s r7�speccompression�&getbundlespec.<locals>.speccompressioncs>��	��#�#�1�1�#�6�A�A�C�A�F�F���	��	�s�/2�
?�?Ns_truncatedBZsBZs!unknown compression algorithm: %ss%s-v1sCompressionsnone�changegroup�version)�01s02sv2)s03s
cg.versions7changegroup version %s does not have a known bundlespecs#try upgrading your Mercurial client��hintsstream2srequirementssnone-v2;stream=v2;%ssstream3-expsnone-v2;stream=v3-exp;%s�
obsmarkerssyessobsolescencesnosobsolescence-mandatorys%s-%sr;r$snone-packed1;%ssunknown bundle type: %s)r8�
isinstancerr,�_typer
r+rr	�
unbundle20rA�	iterparts�typer>�unquote�split�_formatrequirementsparams�	mandatoryrErr.�readbundle1header)r/r0rMrA�br4�compr6�part�	cgversionr�splitted�spec�	formatteds              r7�
getbundlespecrf\s�����F��2�4� �A��!�[�,�,�-�-��g�g���/�!��C��s�#����+�+�a� D�E��K�L�L��$���	�A�w�)�)�	*�	*��Q�X�X�%�"�1�8�8�N�#;�<�D���k�k��:�;�d�B����
�D����K�K�M�D��y�y�N�*� �K�K�
�3�	���.�#�G��(�*�#�G�,5�=�)��+�+��2��"�	"�
�E�F�
�����j�(�W�_�%�~�~�d�k�k�/�.J�K��'�-�-�/�� �:�:�8�D��.��7�7����n�,���%�~�~�d�k�k�/�.J�K��'�-�-�/�� �:�:�8�D��2�V�;�;����m�+�*0���'��~�~�~�8=�F�4�5�A"�D�%*�F�>�"��G��4�/�)����D�L�D��N�6�*�*�D���	�A�{�5�5�	6�	6�"�4�4�R�8��;���5�5�l�C�	�!�I�-�-��k�k�!�6�7�!�;�<�<r9c��URnU(a-URnUVs/sHoT"U5(dMUPM nnO
UR/nU(dUR5n[R
"XU5$s snf)z�Computes which revs are outgoing given a set of common
and a set of heads.

This is a separate function so extensions can have access to
the logic.

Returns a discovery.outgoing object.
)�	changelog�hasnode�nullid�headsr�outgoing)�repork�common�clri�ns      r7�_computeoutgoingrq�sf��
���B�
��*�*��#�2�V��w�q�z�!�V��2���+�+�������
�����d�E�2�2��3s
�A<�A<c�"�URnURnURSS5nUR(dUS;ag[	UR
S5nUR
SS5(dgURc!URS5RS5nO/URS	UR5nXQRS5-nU(a�US
:Xa'UR[S5[U5-5 gUS:XaKUR[S
5[U5-5(a[R"[S55egUS:Xa6[S5[U5-n[S5n[R"XgS9egg)N�experimentalsauto-publish)�warn�confirm�abort�phases�
publishingFsservedsnot public()s::%ln - public()rts$%i changesets about to be published
rus2push and publish %i changesets (yn)?$$ &Yes $$ &Nos	user quitrvs push would publish %i changesetss:use --publish or adjust 'experimental.auto-publish' configrR)rmr/�config�publish�listkeys�remote�get�revs�filtered�warnr�len�promptchoicer
�
CanceledErrorr+)�pushoprmr/�behavior�remotephases�	published�msgrSs        r7�
_checkpublishr��sd���;�;�D�	
���B��y�y��/�:�H�
�~�~��)H�H���F�M�M�9�5�L����M�5�1�1��
�{�{���M�M�)�,�1�1�/�B�	��I�I�1�6�;�;�?�	�	�]�]�9�-�-�	���w���G�G��:�;�c�)�n�L�
���
#�����G�H��i�.�!����)�)�!�L�/�:�:�	�
��
!��7�8�3�y�>�I�C����D��+�+�c�-�-�
"�r9c���URRnURSS5nSU;=(a SU;nU=(d  URR	S5(+$)zoreturn true if a pull/push must use bundle1

This function is used to allow testing of the older bundle version�devel�legacy.exchange�bundle2sbundle1)rmr/�
configlistr|�capable)�opr/�exchange�forcebundle1s    r7�
_forcebundle1r��sU��
�����B��}�}�X�'9�:�H��X�-�H�*��2H�L��<�r�y�y�0�0��<�<�<r9c��\rSrSrSrS	Sjr\RS5r\RS5r	\
S5rSrg)
�
pushoperation�z�A object that represent a single push operation

Its purpose is to carry push related state and very common operations.

A new pushoperation should be created at the beginning of each push and
discarded afterward.
Nc	�j�XlURUlX lX0lX@lX`lXPl[5UlSUl	SUl
SUlSUlSUl
SUlSUlSUlSUl[5Ul/UlSUl0UlX�lXplg�N)rmr/r|�forcer~r�	newbranch�set�	stepsdone�cgresult�bkresultrl�remoteheads�
pushbranchmap�incomingr��outdatedphases�fallbackoutdatedphases�
outobsmarkers�outbookmarks�	trmanager�pkfailcb�pushvarsrz)	�selfrmr|r�r~r�rrzr�s	         r7�__init__�pushoperation.__init__s����	��'�'������
��	�"��"��������
���
���
����"�����
� ���"���&*��#� �U�����������
� �
��r9c�.�URR$)z2future remote heads if the changeset push succeeds)rl�ancestorsof�r�s r7�futureheads�pushoperation.futureheadsPs���}�}�(�(�(r9c��URcURR$URR	5nURR
nURR	5nURnURRnURnURn/n[5nURH4n	U"U	5n
X�;aURU
5 M#URU
5 M6 URUSS9nU(a�URRV	s1sH
o�"U	5iM nn	UR[ 5 [5n
UHGn
U"U
5up�X�;aX�;aU
RU5 X�;dM/X�;dM6U
RU5 MI U
(a#URSX�5nUR#U5 [%U5V
s/sH
o�"U
5PM sn
$s sn	fs sn
f)z/future remote heads if the changeset push failsT��	inclusivezheads(%ld::%ld))r~rl�commonheadsrm�
unfilteredrnrh�index�rev�node�
parentrevsr��addr@�	ancestors�missingr�updater<)r��unfirnro�to_rev�to_node�parent_revs�
unselected�cheadsrp�r�known_non_heads�missing_revs�root_points�p1�p2rks                 r7�
fallbackheads�pushoperation.fallbackheadsUs����9�9���=�=�,�,�,��y�y�#�#�%��(���%�%���y�y�#�#�%��
�^�^���������'�'���m�m���
�������A��q�	�A��{��
�
�1�
��!�!�!�$���,�,�v��,�>���/3�}�}�/D�/D�E�/D�!�F�1�I�/D�L�E����W�%��%�K�!��$�Q�����)�b�.G��O�O�B�'��)�b�.G��O�O�B�'�"���	�	�"3�[�N���
�
�e�$�$*�6�N�3�N�q���
�N�3�3��F��4s�'G1�G6c�T�UR(aUR$UR$)z3set of all common heads after changeset bundle push)r�r�r�r�s r7r��pushoperation.commonheads�s#���=�=��#�#�#��%�%�%r9)r�rr�r�r�r�r�r�r�rlr�r�rzr�r�r|r�r�rmr~r�r�r/�FNF�FN)
�__name__�
__module__�__qualname__�__firstlineno__�__doc__r�r�
propertycacher�r��propertyr��__static_attributes__r�r9r7r�r��sk����
�����I�V
���)��)�
���74��74�r�&��&r9r�supdating bookmark %s
supdating bookmark %s failed
sexporting bookmark %s
sexporting bookmark %s failed
sdeleting remote bookmark %s
s#deleting remote bookmark %s failed
)�update�export�deletec	�z�Uc0n[UUUUUUU40[R"U5D6nURR	5(a�[URR5URR	5R-
n	U	(a<[S5SR[U	55-n
[R"U
5eURR5(d[R"[S55eURRS5(d[R"[S55e[[ R""UR55HsnUR$R'5Hup�U
R)U5(dM M= [R"[S5[R*"U5-5e S=p�UR,R/SS	5n[1U5(d<U(a5[2R4"U5(dURR75nURR95n[;URS
URR=55UlURRIU5 [KU5 [MU5 URN(d[QU5 [1U5(d[SU5 [UU5 [WU5 [YU5 [[U5 UR>bUR>R]5 [^R`"UR>X�5 UR,R/SS5(a[bRd"X5 U$![R@aAnSn
U
[BRD"U5-n
UR,RGU
5 SnAGNeSnAff=f![^R`"UR>X�5 f=f)
a;Push outgoing changesets (limited by revs) from a local
repository to remote. Return an integer:
  - None means nothing to push
  - 0 means HTTP error
  - 1 means we pushed and remote head count is unchanged *or*
    we have outgoing changesets but refused to push
  - other values as described by addchangegroup()
N�:required features are not supported in the destination: %s�, s!destination does not support push�unbundlesLcannot push: destination does not support the unbundle wire protocol commandsJcannot push: required sidedata category not supported by this client: '%s'rs�bundle2.pushbacks
push-responses"cannot lock source repository: %s
�remotenames)3r�r�	strkwargsr|�localr�rmr�	supportedrr*r<r
r+�canpushr�r	�read_remote_wanted_sidedata�_sidedata_computersr=r}�bytestrr/�
configboolr��bookmod�bookmarksinstore�wlockr�transactionmanagerrr��LockUnavailabler�forcebytestr�debug�	checkpushr��_pushdiscoveryr��_checksubrepostate�_pushbundle2�_pushchangeset�_pushsyncphase�
_pushobsolete�
_pushbookmark�close�lockmod�releaser�pullremotenames)rmr|r�r~r�rrz�opargsr�r�r��category�kind�	computersr�r�maypushback�errs                  r7�pushr�s^��$�~���
���
�����	��
�
�V�
$�	�F��}�}���������(�(�)�F�M�M�,?�,?�,A�,K�,K�K�	��������F�7�O�,�	.�C�
�+�+�c�"�"��=�=� � �"�"��k�k�!�@�A�B�B��=�=� � ��-�-��k�k�
�2�
�
�	
��7�>�>�v�}�}�M�N�� $�7�7�=�=�?�O�D��}�}�X�&�&�� @��+�+��-���"�"�8�,�	-��
�O���E�(7�	!�!�)�)�.�.��#��K�
#�6�*�*���0�0��6�6����)�)�+���;�;�#�#�%�D�1����-�v�}�}�/@�/@�/B� �F��	�����f�%��f���v���|�|��v�&��V�$�$��� ��v���v���f���f�����'����"�"�$�����(�(�$�6��w�w���/�>�:�:��#�#�D�1��M��7�$�$�	!�9�C��:�*�*�3�/�/�C��I�I�O�O�C� � ��
	!��,	����(�(�$�6�s2�4B6N?�*B;P�?P�6P�	P�P�P�#P:c�^�U4SjnU$)ahdecorator for function performing discovery before push

The function is added to the step -> function mapping and appended to the
list of steps.  Beware that decorated function will be added in order (this
may matter).

You can only use this decorator for a new step, if you want to wrap a step
from an extension, change the pushdiscovery dictionary directly.c�\>�T[;deU[T'[RT5 U$r�)�pushdiscoverymapping�pushdiscoveryorderr@��func�stepnames �r7�dec�pushdiscovery.<locals>.dec0�0����3�3�3�3�)-��X�&��!�!�(�+��r9r��r	r
s` r7�
pushdiscoveryr&������Jr9c�@�[Hn[UnU"U5 M g�zRun all discovery stepsN)rr)r�r	�steps   r7r�r�9���&��#�H�-���V��'r9c��URn[URS55(a[URS55(dgURRHonXnSUR5;dMSUR
5;dM3[UR5H#nURU5nURSS9 M% Mq g)zDEnsure all outgoing referenced subrepo revisions are present locallys.hgsubs.hgsubstateNT)�onpush)rmr��filerlr��manifest�filesr<�substate�sub�verify)r�rmrp�ctx�subpathrs      r7r�r�@s����;�;�D��t�y�y��#�$�$�C��	�	�.�0I�,J�,J��
�_�_�
$�
$���g�������&�>�S�Y�Y�[�+H�!�#�,�,�/���g�g�g�&���
�
�$�
�'�0�	%r9s	changesetc��[RnUR(a2U"URURUR
URS9nO&U"URURUR
S9nUup4n[RnU"URURURUUR
S9nXplXPlX@l	g)z-discover the changeset that need to be pushed)r�r�)r�)�	onlyheads�	commonincr�N)
r�findcommonincomingr~rmr|r��findcommonoutgoingrlr�r�)r��fcir rn�incr��fcorls        r7�_pushdiscoverychangesetr&Ss����
&�
&�C�
�{�{���K�K��M�M��,�,����	
�	�����V�]�]�&�,�,�G�	�(��F��
�
&�
&�C������
�
��+�+���l�l��H��O�$���Or9sphasec�J�URnURnUR5nURnURR
n[
URS5nURRSS5(aHU(aAURR(d&URSS5(a/Ul/Ul
gURVs1sH
ou"U5iM nn[R "URUU5Ul[%UR"R&5n	UR"R(n
UR"R(=(d UR*nURVs1sH
ou"U5iM nnUR,R/U[R05n
U
(aX�-
nSnO
X�-
nX�-nSnU(d/=nnO'UR3X�U5nUVs/sHnUUPM
 nnU(aUR55nOX�-
nUR*(aUR7X�-5 OU(aUR7U5 UR9U5Vs/sHnUUPM
 snUlUUl
gs snfs snfs snfs snf)	zldiscover the phase that needs to be pushed

(computed for both success and failure case for changesets push)rw�ui�_usedassubreporxFNsheads(%ld::%ld)sheads((%ld::%ld) and public()))rlrmr�rhr�r�r{r|r/r�r�r}r�r�r�r�RemotePhasesSummaryr�r��draft_roots�
publishingrz�_phasecache�get_raw_set�draftr~�copyr��headrevs)r�rlrmr�ror�r�rp�fallbackheads_rev�droots�fallback_publishing�push_publishingr��drafts�fallback_roots�revset�fallback�fallback_revr�r�s                    r7�_pushdiscoveryphaser;ns=��
���H��;�;�D��?�?��D�	
���B�
�X�X�\�\�F��F�M�M�9�5�L�	�	�	���U�$5�6�6�����'�'����]�E�2�2�!#���(*��%��,2�,@�,@�A�,@�q����,@��A� �4�4�������F��
��$�$�0�0�
1�F� �-�-�8�8���)�)�4�4�F����O�'/�'7�'7�8�'7�!�F�1�I�'7�L�8�
�
�
�
)�
)�$����
=�F���.��#������&��2���"$�$��<��y�y��9J�K��%1�2�\��D��G�\��2�� �%�%�'�	� �)�	�
�~�~����*�3�4�	�����&�.0�k�k�)�.D�E�.D��T�!�W�.D�E�F��$,�F�!��KB��9��3��Fs�J�>J�5J�2J s	obsmarkerc�|�[R"UR[R5(dgURR(dgS[URS5;agURnURSUR5nURRRUS9Ul
g)N�obsoletes
namespacess::%ln�r~)r�	isenabledrm�exchangeopt�obsstorer{r|r~r��relevantmarkersr�)r�rmr~s   r7�_pushdiscoveryobsmarkersrC�s������f�k�k�8�+?�+?�@�@���;�;�����(�6�=�=�-�@�@���;�;�D��9�9�X�v�1�1�2�D�!�;�;�/�/�?�?�T�?�J�F�r9�	bookmarksc�Z�URnURR5nURnUR	S5 SnUR
(aO[R"URRUR
5nURRUSS9n[R"[US55nURVs1sHorRR!U5iM nn[R""X"RU5n	[%XX�U	5$s snf)Nschecking for updated bookmarks
r�Tr�rD)r/rmr�r|r�r~r�maplistrhr�r�r��unhexlifybookmarksr{r�
_bookmarks�
expandname�comparebookmarks�_processcompared)
r�r/rmr|r��revnums�remotebookmark�bookmark�explicitr`s
          r7�_pushdiscoverybookmarksrP�s���	���B��;�;�!�!�#�D�
�]�]�F��H�H�
0�1��I�
�{�{��"�"�4�>�>�#5�#5�v�{�{�C���N�N�,�,�W��,�E�	��/�/����0N�O�N�>D�=M�=M��=M����"�"�8�,�=M�
���#�#�D�/�/�>�J�D��F�x��N�N��s�$D(c�*�UupVpxp�p�URn
UHYup�nX�;aURU5 U(aX�R5U;dM;URR	UUU45 M[ UH�up�nX�;dM
URU5 [
R"U5(a0URR[S5U-5 SUl
MiU(aHX�R5U;a2[S5nURRUU-5 SUl
M�URR	USU45 M� [U5[U	5-[U
5-H[up�nX�;dM
URU5 U(aX�R5U;dM=URR	UUU45 M] UH<up�nX�;dM
URU5 URR	UUS45 M> UHup�nX�;dM
URU5 M  U(a<[U5nURR[S5US-5 SUl
URR5 g)zftake decision on bookmarks to push to the remote repo

Exists to help extensions alter this behavior.
s#cannot push divergent bookmark %s!
r$s1cannot push bookmark X without its revision: %s!
r9s>bookmark %s does not exist on the local or remote repository!
rN)rm�remover�r�r@r��isdivergentr/r�rr��listr<�sort)r��pushedrO�	remotebmsr`�addsrc�adddst�advsrc�advdst�diverge�differ�invalid�samermr_�scid�dcidr�s                  r7rKrK�s&��
FJ�B�F�F�G�W��;�;�D��
����=��O�O�A�������)�V�3����&�&��4���7�	 � �
����=��O�O�A���"�"�1�%�%��	�	���q�!H�I�A�M�N�"#����D�J�N�N�,�F�:��M�N���	�	���s�Q�w�'�"#����#�#�*�*�A�s�D�>�:� ��f���W�
�5��V��D�
����=��O�O�A���T�Z�^�^�-��7��#�#�*�*�A�t�T�?�;�	E� �
����=��O�O�A�����&�&��4��~�6�	 ��
����=��O�O�A�����(�#���	�	���
�+�
��q�k�	
�	
����
�����r9c��URnURR5nUR(d,[R
"URX!R5 gUR(d�UR(a�[S5n[S5n[S5n[S5UUS.nURHunX'nUR5(a[R"X8-5eUR5(dMK[R"XhR!5SU-5e ["R$"U5 g)	NFs%push includes obsolete changeset: %s!s,push includes phase-divergent changeset: %s!s.push includes content-divergent changeset: %s!s#push includes orphan changeset: %s!)sorphansphase-divergentscontent-divergentrT)rlrmr�r�r�nochangesfoundr/�excludedr�rArr�rr
r+�
isunstable�
instabilitiesr�
checkheads)	r�rlr��mso�mspd�mscd�mstr�rs	         r7�_pushcheckoutgoingrls�����H��;�;�!�!�#�D�������t�w�w��.?�.?�@���<�<��=�=��<�=�C��D�E�D��F�G�D��C�D�$(�&*��C�!�,�,���j���<�<�>�>��+�+�c�i�0�0��^�^�%�%� �+�+�c�*;�*;�*=�a�*@�&A�C�&G�H�H�-�	���V�$�r9c�^^�UU4SjnU$)acdecorator for function generating bundle2 part

The function is added to the step -> function mapping and appended to the
list of steps.  Beware that decorated functions will be added in order
(this may matter).

You can only use this decorator for new steps, if you want to wrap a step
from an extension, attack the b2partsgenmapping dictionary directly.c�>�T[;deU[T'Tc[RT5 U$[RTT5 U$r�)�b2partsgenmapping�b2partsgenorderr@�insert�r�idxr	s ��r7r
�b2partsgenerator.<locals>.decQsN����0�0�0�0�&*��(�#��;��"�"�8�,���
�"�"�3��1��r9r��r	rsr
s`` r7�b2partsgeneratorrvG������Jr9c�>�UR(GdURR(a�SURR	SS5;nUR
SLnU(aU(a$UR
S[UR5S9 g[5nUR
R5H;upVUupxp�UcM[U5nU[U
5U--nXK[U5-
-nM= U(a%[[U55nUR
SUS9 gggg)z\Generate race condition checking parts

Exists as an independent function to aid extensions
srelateds
checkheadsr�Nscheck:heads��datascheck:updated-heads)r�rlr��capabilitiesr}r��newpart�iterr�r�r=r<)
r��bundler�allowunrelated�emptyremote�affected�branchrkr��newheads�
unsyncedheads�discardedheadsr|rzs
             r7�_pushb2ctxcheckheadsr�]s����<�<�<�F�O�O�7�7�#�w�';�';�'?�'?��2�(
�
���*�*�d�2�����O�O�N��f�6H�6H�1I�O�J��u�H�!'�!5�!5�!;�!;�!=�
��GL�D��}��*� ��-�F���N� 3�f� <�<�H���X�� 6�6�H�">���F�8�,�-����� 6�T��B��8�<r9c��[URR=(d2 UR=(d UR=(d UR
5$)z&return True if we are pushing anything)�boolrlr�r�r�r�)r�s r7�_pushingr�xsH��������	�� � �	����	����	�r9scheck-bookmarksc�z�[U5(aUR(ag[R"UR5nSU;nUR
(aU(dg/nUR
HupVnUR
XV45 M [R"URU5nURSUS9 g)zinsert bookmark move checkingNrDscheck:bookmarksry)r�r�r	�bundle2capsr|r�r@r��binaryencodermr|)	r�r~�b2caps�hasbookmarkcheckrz�book�old�new�	checkdatas	         r7�_pushb2checkbookmarksr��s����F���v�|�|��
�
 �
 ����
/�F�#�v�-�����$4��
�D� �-�-���3����T�K� �.��$�$�V�[�[�$�7�I��O�O�&�Y�O�7r9scheck-phasesc�J^�[U5(aUR(ag[R"UR5nSURSS5;nURGb8U(Ga/[RVs0sHoD/_M nnURR5RRmU[RRU4SjURR55 U[R RU4SjURR"55 [%UR'55(aBUHnXVR)5 M [R*"U5nUR-SUS9 ggggs snf)	zinsert phase move checkingN�headsrwr�c3�4># �UH
nT"U5v� M g7fr�r���.0r�r�s  �r7�	<genexpr>�%_pushb2checkphases.<locals>.<genexpr>�s����%
� @�1�G�A�J�J� @���c3�4># �UH
nT"U5v� M g7fr�r�r�s  �r7r�r��s����$
� ?�1�G�A�J�J� ?�r�scheck:phasesry)r�r�r	r�r|r}r�r�	allphasesrmr�rhr��public�extend�public_headsr/r+�any�valuesrUr�r|)	r�r~r��
hasphaseheads�p�checks�phaser�r�s	        @r7�_pushb2checkphasesr��sI����F���v�|�|��
�
 �
 ����
/�F���
�
�9�b� 9�9�M�
���&�=�!'�!1�!1�2�!1�A�R�%�!1��2��+�+�(�(�*�4�4�9�9���v�}�}��$�$�%
� &� 3� 3� @� @�%
�	
�	�v�|�|��#�#�$
� &� 3� 3� ?� ?�$
�	
��v�}�}�������
�"�"�$� ��+�+�F�3�I��O�O�O�)�O�<�	 �,9�&��2s�F c	�^^	�STR;agTRRS5 [T5(dgTRR	T5 [TU5 [R"TR5nSnURS5nU(aiUVs/sH+nU[R"TR5;dM)UPM- nnU(d[R"[S55e[U5n[R "TR5n[R""TRTR$USUUS9nUR'SUS9m	U(aT	R)S	U5 [*R,"TR5(aT	R)S
S5 [.R0TRR2;aT	R)SS5 U	U4S
jnU$s snf)zohandle changegroup push through bundle2

addchangegroup result is stored in the ``pushop.cgresult`` attribute.
�
changesetsNrQrO�no common changegroup version�push��
bundlecaps�remote_sidedataryrP�treemanifest�1�exp-sidedatac�>�URRTR5n[US5S:XdeUSSSTlg)z0extract addchangegroup returns from server replyrOrr�returnN)�records�
getreplies�idr�r�)r��	cgreplies�cgpartr�s  ��r7�handlereply�_pushb2ctx.<locals>.handlereply�sI����J�J�)�)�&�)�)�4�	��9�^�,�-��2�2�2�#�N�3�A�6�y�A��r9)r�r�rlrm�prepushoutgoinghooksr�r	r�r|r}r�supportedoutgoingversionsr
r+r�maxr��
makestreamrlr|�addparamr�istreemanifestr�REPO_FEATURE_SIDE_DATA�features)
r�r~r�r6�
cgversions�vr��cgstreamr�r�s
`        @r7�
_pushb2ctxr��s������(�(�(��
������'��f�%�%��
�K�K�$�$�V�,����)�
�
 �
 ����
/�F��G����N�+�J�� �
����K�9�9�&�+�+�F�F�
��	�
�
��+�+�a� @�A�B�B��j�/���9�9�&�-�-�H�O��%�%����������'�
�H��_�_�^�(�_�
;�F�����
�G�,����f�k�k�*�*������.��(�(�F�K�K�,@�,@�@������.�B����A
s�%(G:�G:c�F�SUR;ag[R"UR5nURR
nSUR
SS5;nSU;nSURSS5;nU(aU(d[X5$U(a[X5$g)z!handle phase push through bundle2rwNr�r��pushkeyr�r�)
r�r	r�r|rmr/r�r}�_pushb2phaseheads�_pushb2phasespushkey)r�r~r�r/�legacyphase�
haspushkeyr�s       r7�
_pushb2phasesr��s����F�$�$�$��
�
 �
 ����
/�F�	�����B��r�}�}�X�7I�J�J�K��v�%�J���
�
�9�b� 9�9�M��[� ��1�1�	�#�F�4�4�
r9c�>�URRS5 UR(al[RVs0sHo"/_M nnUSRSUR55 [R"U5nURSUS9 ggs snf)z6push phase information through a bundle2 - binary partrwrc3�@# �UHoR5v� M g7fr�)r�)r��hs  r7r��$_pushb2phaseheads.<locals>.<genexpr>�s���B�,A�q�&�&�(�(�,A�s��phase-headsryN)r�r�r�rr�r�r�r|)r�r~r��updates�	phasedatas     r7r�r��s���
������#�
���"(�"2�"2�3�"2�Q�b�5�"2��3���
���B�F�,A�,A�B�B��'�'��0�	�����Y��7�	��3s�Bc�R^^�TRRS5 /mU4Sjn[RnTRH�nURS5nUR
SU"S55 UR
SU"UR555 UR
SU"S[R-55 UR
SU"S[R-55 TRURU45 UTRUR'M� UU4S	jnU$)
z7push phase information through a bundle2 - pushkey partrwc�>�[UR5nTH,up4X2:XdM[R"[	S5U-5e g)Nsupdating %s to public failed)�int�partidr
r+r)r��exc�targetidr�r��	part2nodes     �r7�
handlefailure�+_pushb2phasespushkey.<locals>.handlefailures<����s�z�z�?��%�L�F��!��k�k�!�$C�"D�t�"K�L�L�&r9r��	namespace�key�old�%d�newc�6>�TH�upURRU5nUSn[U5S::deSnU(d[S5U-nO$[	USS5(d[S5U-nUcMwTR
R
U5 M� g)Nr�rs'server ignored update of %s to public!
rr��updating %s to public failed!
)r�r�r�rr�r/r�)r�r�r��partrep�resultsr�r�r�s      ��r7r��)_pushb2phasespushkey.<locals>.handlereplys����%�L�F��j�j�+�+�F�3�G��j�)�G��w�<�1�$�$�$��C���C�D�t�K������I�.�/�/��:�;�d�B�����	�	���s�#�&r9)r�r�r�encoder�r|r�rrr/r�r@r�r�)r�r~r��enc�
newremoteheadrar�r�s`      @r7r�r��s����
������#��I�M��.�.�C��.�.�
����z�*���
�
�l�C�	�N�3��
�
�f�c�-�"3�"3�"5�6�7��
�
�f�c�%�&�,�,�"6�7�8��
�
�f�c�%�&�-�-�"7�8�9����$�'�'�=�1�2�#0������� �/�$��r9rTc�\�SUR;ag[R"UR5n[R
"U5cgURR
S5 UR(a7[R"UR5n[R"X5 gg)NrT)r�r	�obsmarkersversionr{r�
commonversionr�r�r�
sortedmarkers�buildobsmarkerspart)r�r~�remoteversions�markerss    r7�_pushb2obsmarkersr�"s�����(�(�(���.�.�w�/C�/C�D�N����n�-�5��
������'�
����'�'��(<�(<�=���#�#�G�5�r9c��SUR;ag[R"UR5nURR
R
SS5nSU;nU(dSU;a[X5$SU;a[X5$g)z$handle bookmark push through bundle2rDNr�r�r�)	r�r	r�r|rmr/r��_pushb2bookmarkspart�_pushb2bookmarkspushkey)r�r~r��legacy�legacybookss     r7�_pushb2bookmarksr�/s{���v�'�'�'��
�
 �
 ����
/�F�
�[�[�^�^�
&�
&�x�1C�
D�F��&�(�K��<�6�1�#�F�4�4�	�v�	�&�v�7�7�
r9c�$�U(dgU(dgg)z"small utility for bookmark pushingr�r�r�r�)r�r�s  r7�	_bmactionr�?s����
��r9c��U(aRURUR5[R:Xa"[R
"[
S5U-5egg)z6abort if a given bookmark points to a secret changesets:cannot push bookmark %s as it points to a secret changesetN)rmr�r�secretr
r+r)r�r�r_s   r7�_abortonsecretctxr�HsH������D�!�'�'�)�V�]�]�:��k�k�
�K�L�q�P�
�	
�;�tr9c�|^^�TRRS5 TR(dg/m/nTRH@up4n[TXS5 UR	X545 TR	U[XE545 MB [R"TRU5nURSUS9 UU4SjnU$)NrDryc�p>�TRnTH#up#UR[USU-5 M% grH)r/�status�
bookmsgmap)r�r/r��action�
allactionsr�s    ��r7r��)_pushb2bookmarkspart.<locals>.handlereply^s3���
�Y�Y��&�L�D��I�I�j��(��+�d�2�3�'r9)
r�r�r�r�r@r�r�r�rmr|)	r�r~rzr�r�r�r�r�rs	`       @r7r�r�Ps����
������&������J�
�D� �-�-���3��&�#�,����T�K� ����4��3�!4�5�6�.��$�$�V�[�[�$�7�I��O�O�L�y�O�1�4��r9c	�^^^
�TRRS5 /m
[RnU
4SjnTRH�upEn[TXd5 UR
S5nURSU"S55 URSU"U55 URSU"[U555 URSU"[U555 SnU(dS	nO	U(dS
nT
RURXH45 UTRUR'M� U
U4Sjn	U	$)NrDc�>�[UR5nTH<up4nX2:XdM
[R"[USR5U-5e e)Nr)r�r�r
r+r�rstrip)r�r�r�r�r�r�	part2books      �r7r��._pushb2bookmarkspushkey.<locals>.handlefailurelsS����s�z�z�?��$-� �F�&��!��k�k�*�V�"4�Q�"7�">�">�"@�4�"G�H�H�%.�	�ur9r�r�r�r�r�r�r�r�c��>�T	RnTH�up#nURRU5nUSn[U5S::deU(d)T	RR	[S5U-5 Mg[
USS5nU(a UR[USU-5 M�UR	[USU-5 T	RcM�ST	l	M� g)Nr�rs"server ignored bookmark %s update
rr�)
r/r�r�r�r�rr�rrr�)
r�r/r�r�rr�r��retrr�s
        ��r7r��,_pushb2bookmarkspushkey.<locals>.handlereply�s����
�Y�Y��$-� �F�&��j�j�+�+�F�3�G��j�)�G��w�<�1�$�$�$���	�	���q�!G�H�4�O�P��'�!�*�Y�/�0����I�I�j��0��3�d�:�;��G�G�J�v�.�q�1�D�8�9����2�*+���%.r9)r�r�rr�r�r�r|r�rr@r�r�)r�r~r�r�r�r�r�rarr�rs`         @r7r�r�gs����
������&��I�
�.�.�C��!�-�-���3��&�#�,����z�*���
�
�l�C��$5�6��
�
�f�c�$�i�(��
�
�f�c�#�c�(�m�,��
�
�f�c�#�c�(�m�,�����F���F����$�'�'�4�0�1�#0������� �.�,�"�r9�pushvars)rsc�&�URnU(a~0nUH;nSU;aSn[R"XT-5eURSS5upgXsU'M= UR	S5nUR5Hup�UR
X�SS9 M gg)zsend shellvars via bundle2�=sIunable to parse variable '%s', should follow 'KEY=VALUE' or 'KEY=' formatrr
F�r]N)r�r
r+r[r|r=r�)r�r~r��	shellvars�rawr��kr�rarCrDs           r7�_getbundlesendvarsr�s������H���	��C��3��4���k�k�#�)�,�,��9�9�T�1�%�D�A��a�L�����{�+��#�/�/�+�J�C��M�M�#��M�6�,�r9c���[R"UR[R"UR55nUR
=(a URR
SS5n[R"[R"URUSS95nURSUS9 /n[H7n[UnU"X5n[U5(dM&URU5 M9 URS::ag[ R""UR%55nURR'5n	U	R)S	US
/URR+5S.5R-5n
SSS5 SnU(aUR
R6n[R8"URW
UURS
9n
UHnU"W
5 M
 g!,(df   Nk=f![.R0a'n[.R2"[5S5U-5eSnAff=f![.R0a'n[.R2"[5S5U-5eSnAf[R:a�nURR/[5S5U-5 UR<b4URR/[5S5SUR<--5 [.R2"[5S55eSnAff=f![.R>aEn[AURB5nX�RD;aeURDU"X5 SnAGN�SnAff=f)z�push data to the remote using bundle2

The only currently supported type of data is changegroup but this will
evolve in the future.rsr��client)�
allowpushback�roles	replycapsryrNr��force)sbundler��url�missing support for %s�r|sremote: %s
s(%s)spush failed on remote)#r	�bundle20r/r�r|r�r��
encodecaps�getrepocapsrmr|rpro�callabler@�nbpartsr�chunkbuffer�	getchunks�commandexecutor�callcommandr�resultr
�BundleValueError�RemoteErrorr�transaction�
processbundle�
AbortFromPartrS�
PushkeyFailedr�r�r�)r�r~�pushback�capsblob�
replyhandlers�partgenname�partgenr�stream�e�replyr��trgetterr�r��rephands                r7r�r��s���
���v�y�y�'�*=�*=�f�m�m�*L�M�G�����F�I�I�$8�$8��,�%�H�
�!�!����F�K�K�x�i�P��H��O�O�L�x�O�0��M�&��#�K�0���f�&���C�=�=�� � ��%�	'����!���
�
�
�g�/�/�1�
2�F�"-�	H����.�.�0�A��
�
��#)�#+�*� &�
�
� 1� 1� 3����&�(��1�	A��H��!�+�+�7�7���&�&�������}�}�	�B�$!�����!�C1�0���%�%�	H��#�#�A�&?�$@�3�$F�G�G��	H���%�%�	H��#�#�A�&?�$@�3�$F�G�G���$�$�	A��I�I�O�O�A�o�.��4�5��x�x�#��	�	����/� 2�g����6H� I�J��#�#�A�&>�$?�@�@��		A��
���-��S�Z�Z������(��������,�,��	-�s��-G;�>G*�G;�A
H9�*
G8�4G;�7L�8G;�;H6�"H1�1H6�6L�9L�
"I/�/L�BL
�
L�L�M.�):M)�)M.c	��SUR;agURRS5 [U5(dgURR	S5(deUR
R
U5 URnSnURc9UR(d(UR
RR(dSnOSn[R"UR
USSUUS9nUR(aS	/nOURnURR!XEUR
R#55Ulg)
z7Make the actual push of changeset bundle to remote repor�Nr�TFrQr�)�fastpathr�r)r�r�rlr|r�rmr�rlr~rdrh�filteredrevsr�makechangegroupr�r��unbundlerr�)r�rlr�r8�cgr�s      r7r�r��s	����(�(�(��
������'��f�%�%���=�=� � ��-�-�-�-�
�K�K�$�$�V�,����H��J�
�{�{�����V�[�[�2�2�?�?�����	�	$�	$�����
����

�B��|�|��j���(�(���m�m�,�,�R�f�k�k�o�o�>O�P�F�Or9c
�~�URn[URS5nURR	SS5(a/U(a(UR
cUR
SS5(aSS0nU(d[X5 gURR5nURRRnURRnUVs/sH
od"U5PM nn[R"URUU5up�UV
s/sH
o�"U
5PM nn
UR
SS5(a[X5 O%[X5 [X[R 5 UR
(aSUR";agUR$nOUR&nUR"R)S5 UV
s/sHo�R5U;dMU
PM nn
UH�nURR+5nUR-SSUR/5S	[R -S	[R0-S
.5R35n
SSS5 W
(aM�URR5[7S5U-5 M� gs snfs sn
fs sn
f!,(df   NR=f)z2synchronise phase information locally and remotelyrwr(r)NrxFsTruer�r��r�r�r�r�r�)r�r{r|r/r�r�r}�_localphasemovermr�rhr�r�r�r�analyze_remote_phasesr/r�r�r�r�r$r%rr�r&r�r)r�r�r�r�r�r�rp�cheads_revs�pheads_revs�_drr��pheads�outdated�cr�r3s                r7r�r�s4��
�
�
�F��F�M�M�9�5�L��	�	���U�$5�6�6���O�O�#����]�E�2�2�&�w�/�����'��{�{�%�%�'�����%�%�)�)���.�.�%�%��*0�1�&�Q�v�a�y�&��1�!�7�7��K�K���
���
'2�2�k��'�!�*�k��2����M�5�1�1��F�+��F�+��F�F�L�L�9��?�?��F�,�,�,���,�,�H��4�4�H������Y�'� (�B�x�!�6�6�8�6�+A�A�x��B�%�M����.�.�0�A��M�M��&/� -� 1� 1� 3� %���� 4� %��
�
� 5�	���&�(��1��1��	�	����8�9�M�I��&��92��3��(C�1�0�s%�J�J$�
J)�%J)�AJ.�.
J<	c��UR(a;[R"URURR	5X!5 gUVs/sH'o2URUR5:dM%UPM) nn[RUnU(a(URR[S5U-5 ggs snf)z0move <nodes> to <phase> in the local source repos8cannot lock source repo, skipping local %s phase update
N)
r�r�advanceboundaryrmr)r��
phasenamesr/rr)r��nodesr�rp�actualmoves�phasestrs      r7r?r?gs���
�������K�K��)�)�5�5�7��	
�#(�J�%�Q�6�;�;�q�>�3G�3G�3I�+I�q�%��J��$�$�U�+����I�I����/���	�
���Ks�$C�9Cc	�^�SUR;agURnURnURRS5 UR(a�UR
R
S5 /n[R"UR5n[R"U5n[USS9H*nXVnURURSUSU55 M, UVs/sH
o�(aMUPM sn(a'[S5n	UR
RU	5 gggs snf)	z5utility function to push obsolete markers to a remoterTNs'try to push obsolete markers to remote
T��reverser=r9s&failed to push some obsolete markers!
)r�rmr|r�r�r/r�rr�r�_pushkeyescaper<r@rrr�)
r�rmr|�rsltsr��
remotedatarCrzr�r�s
          r7r�r�}s�����(�(�(���;�;�D�
�]�]�F�
������'�
����	�	���C�D����'�'��(<�(<�=���,�,�W�5�
��*�d�3�C��?�D��L�L�����S�#�t�D�E�4��&�u�!�A�A�u�&��>�?�C��G�G�L�L���'���'s�%
D*�3D*c�z�URS:XdSUR;agURRS5 URnURnUR
H�up4nSnU(dSnO	U(dSnUR
5nURSSU[U5[U5S.5R5nSSS5 W(a UR[USU-5 M�UR[US	U-5 URcM�S	Ul
M� g!,(df   Nn=f)
z"Update bookmark position on remoterrDNr�r�r�r�r>r)r�r�r�r/r|r�r$r%rr&rrr�r�)	r�r/r|r_r�r�rr3r�s	         r7r�r��s��
���!��|�v�/?�/?�?��
������&�	���B�
�]�]�F��*�*��������F���F�
�
#�
#�
%���
�
��".����H���H�	���f�h�
�&�
��I�I�j��(��+�a�/�0��G�G�J�v�&�q�)�A�-�.����*�"#���1+�&�
%�s�8D,�,
D:	c��\rSrSrSrS
Sjr\RS5r\RS5r	\RS5r
SrS	rg)�
pulloperationi�z�A object that represent a single pull operation

It purpose is to carry pull related state and very common operation.

A new should be created at the beginning of each pull and discarded
afterward.
Nc�X�XlX lX�lX0lUVs/sHo�RRU5PM snUlX@lXplSUl	SUl
SUlSUlX`l
SUl[5UlSUlX�lX�lX�lgs snf)NF)rmr|�remote_pathrkrHrI�explicitbookmarksr��streamclonerequestedr�rn�rheads�fetch�remotebookmarksr�r�r��clonebundleattempted�includepats�excludepats�depth)
r�rmr|rkr�rr\rYr^r_r`�pathrNs
             r7r��pulloperation.__init__�s����	��� ���
�BK�"
�AJ�X�O�O�&�&�x�0��"
����
�$8�!������������
�.����
�����$)��!�&��&���
��9"
s�$B'c���URcW[UR5n[UR5nURHnX1;dM
URU5 M U$UR$)z0heads of the set of changeset target by the pull)rkr�rnrTrZr@)r�rFrrps    r7�pulledsubset�pulloperation.pulledsubset�s]���:�:���D�K�K� �A��t�{�{�#�C��[�[���:��J�J�q�M�!��J��:�:�r9c�"�[U5(+$r�)r�r�s r7�
canusebundle2�pulloperation.canusebundle2s�� ��&�&�&r9c�B�[R"UR5$r�)r	r�r|r�s r7�remotebundle2caps�pulloperation.remotebundle2capss���"�"�4�;�;�/�/r9c�6�URR5$r�)r�r)r�s r7�gettransaction�pulloperation.gettransactions���~�~�)�)�+�+r9)r�r]rnr`r_rXr[r�rkr^r|rWr\rmrZr�rYr�)	NFr�NNNNNN)
r�r�r�r�r�r�rr�rdrgrjrmr�r�r9r7rUrU�s}�������!����
�5�n
������"
���'��'�
���0��0�,r9rUc�0�\rSrSrSrSrSrSrSrSr	g)	r�iz�An object to manage the life cycle of a transaction

It creates the transaction on demand and calls the appropriate hooks when
closing the transaction.c�6�XlX lX0lSUlgr�)rm�sourcer�_tr)r�rmrqrs    r7r��transactionmanager.__init__s���	�������r9c�f�UR(d�SUR[R"UR54-nUR
R
U5UlURURRS'URURRS'UR$)z<Return an open transaction object, constructing if necessarys%s
%s�sourcer)rrrqr�hidepasswordrrmr)�hookargs)r��trnames  r7r)�transactionmanager.transaction sz���x�x��$�+�+�w�/C�/C�D�H�H�/M�!N�N�F��y�y�,�,�V�4�D�H�+/�;�;�D�H�H���i�(�(,���D�H�H���f�%��x�x�r9c�T�URbURR5 gg)zclose transaction if createdN)rrr�r�s r7r��transactionmanager.close)s���8�8���H�H�N�N�� r9c�T�URbURR5 gg)zrelease transaction if createdN)rrr�r�s r7r��transactionmanager.release.s!���8�8���H�H���� r9)rrrmrqrN)
r�r�r�r�r�r�r)r�r�r�r�r9r7r�r�s�� �
���
r9r�c��UR5nURSSU05R5sSSS5 $!,(df   g=f)N�listkeysr�)r$r%r&)r|�	namespacer3s   r7r{r{4s8��	�	�	�	!�Q��}�}�[�<��*C�D�K�K�M�
"�	!�	!�s	�"=�
Ac�^^�UR5mTRmU4SjnU4SjnTR5n[T5n[	U5 [
RUR
;agU[T5:Xag[U4SjUR55(agU"TR5U5nU"XaR5Ul	[UR5UR-
UlM�)Nc�r>�TRSX5nUVs1sHo3R5iM sn$s snf)zReturns heads(h1 % h2)sheads(%ln %% %ln)�r�r���h1�h2�resrr�s    �r7�headsofdiff�%_fullpullbundle2.<locals>.headsofdiffFs0����h�h�+�R�4��&)�*�c�s���
�c�*�*��*��4c�r>�TRSX5nUVs1sHo3R5iM sn$s snf)zReturns heads((h1 + h2) - null)sheads((%ln + %ln - null))r�r�s    �r7�headsofunion�&_fullpullbundle2.<locals>.headsofunionKs0����h�h�3�R�<��&)�*�c�s���
�c�*�*��*r�c3�F># �UHnTRU5v� M g7fr�)ri)r�rp�unficls  �r7r��#_fullpullbundle2.<locals>.<genexpr>\s����8�-�Q�v�~�~�a� � �-�s�!)r�rhrkr��_pullbundle2r�NARROW_REQUIREMENT�allrZrnr�)	rm�pullopr�r��	old_heads�clstart�	new_headsr�r�s	       @@r7�_fullpullbundle2r�9s�����?�?��D�
�^�^�F�+�
+�
��L�L�N�	��f�+���V���*�*�d�.?�.?�?�

��c�&�k�!���8�&�-�-�8�8�8�������	�:�	�$�Y�
�
�>��
��F�M�M�*�V�]�]�:��
�!r9c��^�URR5n[R"XSSS9 [R
"UR
55mU4SjnURSU5 g)z�adds a finalize callback to transaction which can be used to show stats
to user and confirm the pull before committing transaction�pullT)�txnname�as_validatorc�>�T"5n[S5nURRU5(a[R"S5eg)Ns+accept incoming changes (yn)?$$ &Yes $$ &Nosuser aborted)rr/r�r
r+)�trrm�cm�reporefs   �r7�prompt�$add_confirm_callback.<locals>.promptms>����y��
�=�
>���7�7����#�#��+�+�o�.�.�$r9s900-pull-promptN)r�r)r�registersummarycallback�weakref�refr��addvalidator)rmr�r�r�r�s    @r7�add_confirm_callbackr�cs[���
�	�	�	%�	%�	'�B��#�#��'����k�k�$�/�/�+�,�G�/��O�O�&��/r9c���Uc0nUcU	b'U=(d
 [5nU	=(d
 [5n	OURup�[R"U5 [R"U	5 [	UU4UUUUUUU	U
S.[
R"U5D6nURR5n
U
(ao[U
R5URR-
nU(a<[S5SR[U55-n[R "U5eUR"HtnUR$R'5HunnUR)U5(dM M> [R*"[S5[
R,"U5-5e [/USUR155Ul[4R6n[8R:"U5(dUR<nU"5 UR?5 UR2 U(d@UR@RCSS5(a*UR@RE5(d[GX5 [IU5 [JRL"U5 [OU5 URP(a[SX5 [UU5 [WU5 [YU5 [[U5 SSS5 SSS5 SSS5 UR@RCSS	5(a[\R^"X5 U$!,(df   NW=f!,(df   N`=f!,(df   Ni=f)
a�Fetch repository data from a remote.

This is the main function used to retrieve data from a remote repository.

``repo`` is the local repository to clone into.
``remote`` is a peer instance.
``heads`` is an iterable of revisions we want to pull. ``None`` (the
default) means to pull everything from the remote.
``bookmarks`` is an iterable of bookmarks requesting to be pulled. By
default, all remote bookmarks are pulled.
``opargs`` are additional keyword arguments to pass to ``pulloperation``
initialization.
``streamclonerequested`` is a boolean indicating whether a "streaming
clone" is requested. A "streaming clone" is essentially a raw file copy
of revlogs from the server. This only works when the local repository is
empty. The default value of ``None`` means to respect the server
configuration for preferring stream clones.
``includepats`` and ``excludepats`` define explicit file patterns to
include and exclude in storage, respectively. If not defined, narrow
patterns from the repo instance are used, if available.
``depth`` is an integer indicating the DAG depth of history we're
interested in. If defined, for each revision specified in ``heads``, we
will fetch up to this many of its ancestors and data associated with them.
``confirm`` is a boolean indicating whether the pull should be confirmed
before committing the transaction. This overrides HGPLAIN.

Returns the ``pulloperation`` created for this pull.
N)rarkr�rrYr^r_r`r�r�sDsidedata category requested by local side without localsupport: '%s'r�rursr�)0r��
narrowpatsr�validatepatternsrUrr�r|r�rrmr�rr*r<r
r+�_wanted_sidedatar�r=r}�ProgrammingErrorr�r�rr�r�nullcontextmanagerr�r�r�rr/r��plainr��_maybeapplyclonebundler�maybeperformlegacystreamclone�_pulldiscoveryrgr��_pullchangeset�
_pullphase�_pullbookmarks�
_pullobsoleterr�)rmr|rarkr�rr�rYr^r_r`�confirmr��	peerlocalr�r�r�r�r�r�s                    r7�pullr�vs���T�~�����+�"9�!�*�S�U��!�*�S�U��#'�?�?� ������,�����,�
��������1������
�
�V�
$��F��
�
�#�#�%�I���i�,�,�-����0E�0E�E���������F�7�O�,�	.�C�
�+�+�c�"�"��)�)�� $�7�7�=�=�?�O�D�)��}�}�X�&�&�� @��(�(��%���"�"�8�,�	-��
�*�"*�$������F�F���#�#�E��#�#�D�)�)��
�
��	��$�)�)�+�v�/�/���G�G���w�
�3�3�D�G�G�M�M�O�O� ��.�	�v�&��1�1�&�9��v������T�*��v���6���v���f��! 0�+��&�w�w���/�>�:�:��#�#�D�1��M�- 0�/��+�+����s=�	M!�
M�'CL?�.M�6M!�?
M
�	M�
M	�M!�!
M/c�^�U4SjnU$)ahdecorator for function performing discovery before pull

The function is added to the step -> function mapping and appended to the
list of steps.  Beware that decorated function will be added in order (this
may matter).

You can only use this decorator for a new step, if you want to wrap a step
from an extension, change the pulldiscovery dictionary directly.c�\>�T[;deU[T'[RT5 U$r�)�pulldiscoverymapping�pulldiscoveryorderr@rs �r7r
�pulldiscovery.<locals>.decrr9r�r
s` r7�
pulldiscoveryr��rr9c�@�[Hn[UnU"U5 M gr)r�r�)r�r	rs   r7r�r�rr9sb1:bookmarksc���URbgUR(aSUR;ag[URS5n[
R"U5Ulg)z�fetch bookmark data in bundle1 case

If not using bundle2, we have to fetch bookmarks before changeset
discovery to reduce the chance and impact of race conditions.NrrD)r\rgrjr{r|r�rG)r��bookss  r7�_pullbookmarkbundle1r�sQ�����)��
����v�/G�/G� G�	��V�]�]�L�1�E�$�7�7��>�F�r9rOc��[R"URURURUR
S9nUup#nURR
5RRRnU(alU(ae[U5nUH*nU"U5(dMXv;dMURU5 M, [U5R[U55(a/nX l
X0lX@lg)zvdiscovery phase for the pull

Current handle changeset discovery only, will change handle all discovery
at some point.)rkr�N)rr!rmr|rkr�r�rhr��has_noder�r@�issubsetrnr[rZ)r��tmprnr[rZr��scommonrps        r7�_pulldiscoverychangegroupr�(s����
&�
&����V�]�]�&�,�,�f�l�l��C� ��F�6��{�{�%�%�'�1�1�7�7�@�@�H����f�+���A���{�{��#��M�M�!�$���v�;����F��,�,��E��M��L��Mr9c�r�S[URSS90nURRn[R"USS9SnUR
US'UR=(d URUS'URR[R5nU(a UR(aURUS	'U(a UR(aURUS
'U(aASUS'SUS
'URRS5 URRS5 O�URRS5 UR US'SUR#SS5;nSUR$R'SS5;nU(d'U(a SUS'URRS5 SUR$;aSUR;aS/US'SnSUR#SS5;nSUR$;n	UR(bURRS5 SUR;a"UR(cU(dU	(aSUS'SnSUR$;aLSUR;a<URRS5 UR+S/5R-S5 URRS5(aJURc=[/UR
5URR0/:XaUR2US'U(a/URRR5[7S55 O�UR (d6URRR5[7S55 SUlOiURc\[/UR
5URR0/:Xa.URRR5[7S55 [:R<"UR[:R>5(aW[@RB"UR$5n
[:RD"U
5b SUS'URRS5 [GX5 [@RH"UR5nU(aX�S'URRK5n[MU5n
SU
S'UROS U
5RQ5n[@RR"URURTSURS!9nS"URVS'[@RX"URUUURS#9 SSS5 UR (a[@Rd"W5UlWRfSHunnUS:XdM[iUU5 M U(a+0nURfSHnUS(UUS)'M UUlO<URfSH)unnUS:XdM[jRl"U5UlM+ UR(b[oU5 gg![@RZa^nURRR][7S$5U-5 [\R^"[7S%5UR`S&9eSnAf[\Rba'n[\R^"[7S'5U-5eSnAff=f!,(df   GN�=f)*zJpull data using bundle2

For now, the only supported data are changegroup.s
bundlecapsr�rT)r	r�commonr�sincludepatssexcludepatsF�cgr"rOrwr�r�r�rrDNsrequest-bookmarks�clonebundlesscbattemptedsstreaming all changes
�no changes found
�requesting all changes
rTsremote_sidedatar�ru�	getbundle)rqr|srecords)r�r|sremote: abort: %s
spull failed on remoterRrsnodesbookmark)8�
caps20to10rmr/r�canperformstreamclonernrkrZr|r�r�	NARROWCAPr^r_r�r�r[r�rjr}r\�
setdefaultr@rTrjr]rrr�rr?r@r	r�r��_pullbundle2extrapreparer�r$�dictr%r&�bundleoperationrm�modesr*r+r
r(rSr'�combinechangegroupresultsr��_pullapplyphasesr�rGr�)r��kwargsr/�	streaming�servernarrowr��hasbinaryphase�bookmarksrequested�legacybookmark�
hasbinarybookr�r�r3�args�bundler�r�r�rDr��records                     r7r�r�Is����Z����)�D�
E�F�
�����B��1�1�&�$�G��J�I��
�
�F�9���|�|�4�v�}�}�F�8���=�=�(�(��)A�)A�B�L���*�*�!'�!3�!3��~����*�*�!'�!3�!3��~�����u�
� ��y�������^�,������Y�'�	�����^�,�����u�
��2�=�=��;M�#N�N��!�V�%=�%=�%A�%A�)�R�%P�P���~� $�F�9����� � ��+��&�2�2�2��� 0� 0�0�'0�k��{�#���!�R�]�]�8�=O�%P�P�N� �F�$<�$<�<�M�
���)������1�2�	�F�$4�$4�4��"�"�*���#��|��!���f�.�.�.��v�'7�'7�7�
��� � �!5�6����k�2�.�5�5�l�C�	�
�
���o�.�.��L�L� ������F�K�K�$6�$6�#7�7�!'�!<�!<��~����������a� :�;�<�
�\�\��������a� 5�6�7�����<�<��D����$7�F�K�K�<N�<N�;O�$O��K�K�N�N�!�!�!�$?�"@�A����&�+�+�x�';�';�<�<� �2�2�6�3K�3K�L���!�!�.�1�=�$(�F�=�!���� � ��/��V�,��9�9�&�-�-�H�O��%4�!�"�	���	&�	&�	(�A��F�|��!��Y�����|�T�2�9�9�;��	H��(�(�����%�%���}�}�	�B�&0�B�H�H�\�"��!�!�������}�}�	
�
)�2�|�|�!�;�;�B�?����J�J�{�3��	�5��	�!��V�U�+�4�
����j�j��.�F�)/���E�&��%�&�/�!&��� "�
�
�;� 7��I�u��L�(�)0�)C�)C�E�)J��&�!8�
���)��v��*��5�$�$�	P��K�K�N�N� � ��#9�!:�S�!@�A��#�#�A�&>�$?�c�h�h�O�O���%�%�	H��#�#�A�&?�$@�3�$F�G�G��	H��-
)�	(�s8�.1\'� A/Y9�9\$�
A[&�&\$�="\�\$�$\'�'
\6c��g)z>hook function so that extensions can extend the getbundle callNr�)r�r�s  r7r�r��s�r9c	��SUR;agURRS5 UR(d6URRR[
S55 SUlgUR5nURc][UR5URR/:Xa/URRR[
S55 O>URc1URRS5(aURUl	URRS5(aCURR!SURUR=(d URS	9nO�URcQURR#5nUR%SURSS
.5R'5nSSS5 O�URRS5(d[(R*"[
S55eURR#5nUR%SURURSS.5R'5nSSS5 [,R."URWUSURR15URS
9n[,R2"U5Ulg!,(df   No=f!,(df   N�=f)z0pull changeset from unbundle into the local reporONr�rr�schangegroupsubsetr�r��rnrk)snodesrusWpartial pull cannot be done because other repository doesn't support changegroupsubset.)sbasesr�rur)r�r�r[rmr/rrr�rmrkrTrnrjr|r�rZ�	getbundler$r%r&r
r+r	�applybundlerr�)r�r�r<r3�bundleops     r7r�r��sK��
��)�)�)��
������(��<�<��������a� 5�6�7�����	�	�	�	 �B�
�|�|���V�]�]� 3����8J�8J�7K� K��������a� ;�<�=�	���	�&�-�-�"7�"7�8L�"M�"M��}�}���
�}�}���\�*�*�
�]�]�
$�
$��F�M�M����1N����%�
��
���	�
�]�]�
*�
*�
,������$�l�l�&����f�h�

�-�
,��]�]�
"�
"�#7�
8�
8��k�k�
�&�
�
�	
��]�]�
*�
*�
,�����$�$�l�l�$�l�l�&����f�h�
�-��"�"����
�
���
�
�����}�}�
�H��7�7��A�F�O�I-�
,��$-�
,�s�6.K(�9K9�(
K6�9
Lc�h�SUR;ag[URS5n[X5 g)Nrw)r�r{r|r�)r�r�s  r7r�r�"s+���F�$�$�$���F�M�M�9�5�L��V�*r9c	���SUR;agURRS5 [URSS55nU(a�U(d�URR5nURRRnURRnURVs/sH
od"U5PM nn[R"URUU5up�UV
s/sH
o�"U
5PM nn
URnOURn/nURR5nURRn
URRRn[R n[R"nUVs/sHnU
"X>"U55U:�dMUPM nnU(a2UR%5n[R&"URUX�5 UVs/sHnU
"X>"U55U:�dMUPM nnU(a4UR%5n[R&"URUUU5 ggs snfs sn
fs snfs snf)z/apply phase movement from observed remote staterwNrxF)r�r�r�r}rmr�rhr�r�r�rdrr@r-r��get_revr�r/rmrH)r�r�r,r�r�r�rp�pulledsubset_revsrBrCr�rD�dheadsr�r�r�r/�pnr�s                   r7r�r�*s����F�$�$�$��
������#��l�&�&�}�e�<�=�J��J��{�{�%�%�'�����%�%�)�)���.�.�%�%��06�0C�0C�D�0C�1�V�A�Y�0C��D�!�7�7��K�K���
���
'2�2�k��'�!�*�k��2��$�$���$�$�����;�;�!�!�#�D����"�"�E�
�.�.�
�
�
&�
&�C�
�]�]�F��L�L�E�"�
C�6�R�U�4��R��%9�F�%B�b�6�F�
C�
�
�
"�
"�
$�����v�{�{�B��?�"�
B�6�R�U�4��R��%9�E�%A�b�6�F�
B�
�
�
"�
"�
$�����v�{�{�B��v�>���9E��3��D��Cs$�4I�/I�I�+I�0I�
Ic
�v�SUR;agURRS5 URnURnSnURbURR
n[R"URUUURR5URURUS9 g)z?process the remote bookmark information to update the local onerDN)rO�mode)
r�r�rmr\rW�bookmarks_moder��updatefromremoter/r|rrmrX)r�rmr\r�s    r7r�r�Us����v�'�'�'��
������&��;�;�D��,�,�O��N�
���%��+�+�:�:�����������
�
��������)�)�
�r9c��SUR;agURRS5 Sn[R"UR[R
5(a�URRRS5 [URS5nSU;a�UR5n/n[USS9HOnURS5(dM[R"X$5n[R"U5upgX7-
nMQ U(a%URR RX5 URR#5 U$)	aFutility function to pull obsolete markers from a remote

The `gettransaction` is function that return the pull transaction, creating
one if necessary. We return the transaction to inform the calling code that
a new transaction have been created (when applicable).

Exists mostly to allow overriding for experimentation purposerTNs!fetching remote obsolete markers
r=sdump0TrNsdump)r�r�rr?rmr@r/r�r{r|rmr<r(r�	b85decode�_readmarkersrA�invalidatevolatilesets)r�r��	remoteobsr�rCrzr6�newmarkss        r7r�r�js
����(�(�(��
������'�	
�B����&�+�+�x�';�';�<�<��������B�C��V�]�]�K�8�	��y� ��&�&�(�B��G��i��6���>�>�'�*�*��>�>�)�.�9�D�(0�(=�(=�d�(C�%�G��'�G�	7�
����$�$�(�(��5��K�K�.�.�0�
�Ir9c��URnURURRS5=(d UR	55nUR[US-UR[S55nUR[US-UR[S55nU(d([R"[S5[U4-5eUVs/sHofS:XaSOS	U-PM nnUVs/sHofS:XaSOS	U-PM nn[URS
/55n[URS/55n[R"XxXE5upxn	U	(a8[R"[S5U[R"U	54-5e0n
U
RU5 S
U
S'S
U
S'XzS
'U(aX�S'U
$s snfs snf)z�Apply narrow fetch access control.

This massages the named arguments for getbundle wire protocol commands
so requested data is filtered through access control rules.
sREMOTE_USERs	.includessdefault.includess	.excludessdefault.excludess%%s configuration for user %s is empty�*spath:.spath:r^r_s4The following includes are not accessible for %s: %sT�narrow�
narrow_acl)r/�	shortuser�environr}�usernamer��_NARROWACL_SECTIONr
r+rr�r�restrictpatternsr�pprintr�)rmr�r/r�
user_includes�
user_excludesr��req_includes�req_excludes�invalid_includes�new_argss           r7�applynarrowaclr�s���
���B��|�|�B�J�J�N�N�>�:�K�b�k�k�m�L�H��M�M���<��
�
�
�(�*=�>��M�
�M�M���<��
�
�
�(�*=�>��M�
��k�k�
�6�7�!�8�,�
-�
�	
�;H��:G�Q�$�Y�	�H�q�L�0�-���;H��:G�Q�$�Y�	�H�q�L�0�-����v�z�z�-��4�5�L��v�z�z�-��4�5�L�3=�3N�3N��M�4�0�L� 0���k�k�
�E�F���*�*�+;�<�=�
>�
�	
�
�H��O�O�F���H�X��!�H�\��*�]���".����O��9��s�G�9Gc
�,^^"^#^$�TRnTRnURnUV	s1sH
o�"U	5iM sn	[1-n
UV	s1sH
o�"U	5iM nn	U(aUVs0sHo�S_M n
n[R
"[5n[R
"[5m"U"U#U$4SjnU"4Sjm$U"U4Sjm#[URX�S95n[U5n[
5nUVs/sHnURU5PM nn[
U5U-nUGH5nURU5nURU5Vs/sHnU[:wdMUPM nnUb3W
UnUH(n[US-U
RUUS-55U
U'M* SnUSL=(d W
UU:*nU(a�XxRR!5nU(a�XvRUS5RR!5n[#UR%UU55nU(dX['U5S:�aIXvRUS5RR!5n[#UR%UU55nO[)UR+U55nU(aRUUHn U"U U5 M UHnUR-U5 M UR-URU55 GM�U(d[/nUU;a5UUHn U"U U5 M UHnUUR-U5 M GMUHnUU==UU-ss'M GM8 U
Hn!UU!Hn U"U U!5 M M UUT"4$s sn	fs sn	fs snfs snfs snf)	a�Compute the shape of a narrowed DAG.

Args:
  repo: The repository we're transferring.
  common: The roots of the DAG range we're transferring.
          May be just [nullid], which means all ancestors of heads.
  heads: The heads of the DAG range we're transferring.
  match: The narrowmatcher that allows us to identify relevant changes.
  depth: If not None, only consider nodes to be full nodes if they are at
         most depth changesets away from one of heads.

Returns:
  A tuple of (visitnodes, relevant_nodes, ellipsisroots) where:

    visitnodes: The list of nodes (either full or ellipsis) which
                need to be sent to the client.
    relevant_nodes: The set of changelog nodes which change a file inside
             the narrowspec. The client needs these as non-ellipsis nodes.
    ellipsisroots: A dict of {rev: parents} that is used in
                   narrowchangegroup to produce ellipsis nodes with the
                   correct parents.
rc�>�TURU5 [TU5S:�a*T"U5up#T"XU5 Un[TU5S:�aM)gg)z=Add a root to an ellipsis head, splitting heads with 3 roots.r$N)r�r�)�head�	curchange�child�roots�
ellipsisroots�	splithead�
splitrootss    ���r7�addroot�!_computeellipsis.<locals>.addroot�sX����d����	�*�
�-��%�&��*�$�T�?�L�E��t�E�*��D��-��%�&��*r9c�>�TURU5 TURU5 TURU5 TURU5 gr�)�difference_updater�r��discard)rrrrs   �r7r�$_computeellipsis.<locals>.splitroots�sO����d��-�-�e�4��d�����&��e��#�#�E�*��e��$�$�U�+r9c�&>�[TU5upnX#4X4X44HPupET	RSX@XP5nUH2nXu:Xa	XTU44s s $UT;d[TU5S:dM+XtU44s s $ MR [R"[S5XX#4-5e)Ns%sort(merge() & %d::%d & %d::%d, -rev)r$s;Failed to split up ellipsis node! head: %d, roots: %d %d %d)r<r~r�r
r+r)
r�r1�r2�r3�nr1�nr2�mid�jrrms
        ��r7r�#_computeellipsis.<locals>.splithead�s�����M�$�/�0�
�����B�8�b�X�6�H�C��)�)�8�#�S��C����8��c�
�?�*��M�)�S��q�1A�-B�Q�-F��C�j�=�(�	�	7��k�k�
�#�
��� �	
!�
�	
r9r�NrF)rh�manifestlogr�r�collections�defaultdictr�rT�findmissingrevs�reversedr��changelogrevisionr��minr}r�readr��diffr�r��walkr�)%rmrnrk�known�matchr`ro�mfl�clrevrp�
commonrevs�	headsrevsr��revdepth�
ellipsisheadsrr��visit�relevant_nodes�m�
visitnodes�requiredr��prev�ps�curdepthr��needed�shallow_enough�curmf�p1mf�p2mfrrFrrrs%`                                 @@@r7�_computeellipsisrC�sD���.
���B�
�
�
�C��F�F�E�$*�+�F�q�%��(�F�+�w�i�7�J�#(�)�5�a��q��5�I�)��"+�,�)�Q�q�D�)��,��+�+�C�0�M��+�+�C�0�M�
�,�
�&�2�%�%�Z�%�I�J�G��W��E��U�N�&-�.�g��"�'�'�!�*�g�J�.��9�~��%�H����$�$�S�)��!�}�}�S�1�
E�1�t�T�W�_�d�1��
E�����}�H���!�(�Q�,����Q���	�0J�K��������$��@�(�3�-�5�*@������'�,�,�.�E���/�/��1��6�?�?�@�E�E�G���e�j�j��u�5�6���#�b�'�A�+�
�3�3�B�q�E�:�C�C�D�I�I�K�D�!�%�*�*�T�5�"9�:�F���U�Z�Z��.�/���%�c�*����c�"�+������Q������r�w�w�s�|�,���Y���h��)�#�.�D��D�#�&�/��A�!�!�$�(�(��-���A�!�!�$�
�c�(:�:�$��Y�`��!�!�$�D��D�!��%���~�}�4�4��M,��)��-��Z/��Fs#�M=�
N�+N�3N�N�Nc��S1n[R"[R"XS95nURS[RU5-5 U$)zFreturn a set with appropriate options to use bundle20 during getbundlesHG20r��bundle2=)r	rrr�r>r?)rmr�capsr.s    r7r�r�D	sC���9�D��!�!�'�"5�"5�d�"F�G�H��H�H�[�6�<�<��1�
1�2��Kr9c�^^�UU4SjnU$)avdecorator for function generating bundle2 part for getbundle

The function is added to the step -> function mapping and appended to the
list of steps.  Beware that decorated functions will be added in order
(this may matter).

You can only use this decorator for new steps, if you want to wrap a step
from an extension, attack the getbundle2partsmapping dictionary directly.c�>�T[;deU[T'Tc[RT5 U$[RTT5 U$r�)�getbundle2partsmapping�getbundle2partsorderr@rqrrs ��r7r
�%getbundle2partsgenerator.<locals>.dec_	sN����5�5�5�5�+/��x�(��;� �'�'��1���
!�'�'��X�6��r9r�rus`` r7�getbundle2partsgeneratorrLU	rwr9c�.�Ub[SU55$g)Nc3�B# �UHoRS5v� M g7f)sHG2N)r()r��caps  r7r��#bundle2requested.<locals>.<genexpr>m	s���@�Z�c�>�>�&�)�)�Z�s�F)r�)r�s r7�bundle2requestedrQk	s�����@�Z�@�@�@�r9c
�z�[R"U5n0n[U5nU(d�U(a+URSS5(d[	[S55eU(a=[	[S5SR
[UR555-5e[XU5n	SUS'U[R"UU	SUUUS	94$S
US'0n
UHanURS5(dM[RU[S5S5nU
R!["R$"U55 Mc ["R&"UR(U
5n
X&S
'X6S'[*H/n[,UnU"U
UU4UU
US.[R."U5D6 M1 U
R0US'X}R354$)z�Return chunks constituting a bundle's raw data.

Could be a bundle HG10 or a bundle HG20 depending on bundlecaps
passed.

Returns a 2-tuple of a dict with metadata about the generated bundle
and an iterator over raw chunks (of varying sizes).
r�Ts-request for bundle10 must include changegroups#unsupported getbundle arguments: %sr�rs
bundleversionrQr�r$rENr�r�)r�r�r�sprefercompressed)r�byteskwargsrQr}�
ValueErrorrr*r<�keysrqrr�r(r>rZr�r�r	�
decodecapsrr/rJrIr��prefercompressedr#)rmrqrkrnr�r�r��info�
usebundle2rlr��bcaps�blobr~�namers                r7�getbundlechunksr]q	s���"�
!�
!�&�
)�F�
�D�!�*�-�J���f�j�j���5�5���B�C��
����8�9��*�*�V�F�K�K�M�2�3�4��
�$�D��8��!"��
����"�"�����%� /�

�

�
	
��D�	��
�F������K�(�(��>�>�%��K�(8�(:�";�<�D��M�M�'�,�,�T�2�3�����t�w�w��/�G��8���9��$��%�d�+������	
�"��+�
	
�� � ��(�	
�%�!(� 8� 8�D�	���"�"�$�$�$r9r"c�0�[R"X40UD6$r�)r	�addpartbundlestream2)r~rmr�r�s    r7�_getbundlestream2r`�	s���'�'��@��@�@r9c
�b�URSS5(aU(dgSn	URS5n
U
(a_U
Vs/sH!nU[R"U5;dMUPM# n
nU
(d[R"[S55e[
U
5n	[XU5nUR(dgURSS5(ar[[[URS	/555n
[[[URS
/555n[R"URX�S9nOSn[R"UUU	UUUUS9nUR!SUS
9nU
(aUR#SU	5 UR#SS[%UR5-SS9 [&R("U5(aUR#SS5 [*R,UR.;a:UR#SS5 [0R2"U5nUR#SU5 URSS5(acURSS5(aKW
(dW(a<UR!S5nSSR5U
5SR5W54-Ulggggs snf)z.add a changegroup part to the requested bundler<TNrQrOr�r�Fr^r_)�include�exclude)r��matcherr�ryrPs	nbchangesr�rr�r�r�sexp-wanted-sidedatar�sNarrow:responsespecs%s%s�
)r}rr�r
r+rr�rqr�r<�filterr�rr/�rootr�r|r�r�rr�rr�r�r	�format_remote_wanted_sidedatar*rz)r~rmrqr�r�rkrnr�r�r6r�r�rlrbrcrdr�ra�sidedata�narrowspecparts                    r7�_getbundlechangegrouppartrk�	sG���:�:�d�D�!�!����G����N�+�J�� �
����K�9�9�$�?�?�
��	�
�
��+�+�a� @�A�B�B��j�/����V�4�H�����
�z�z�(�E�"�"����f�j�j���&C�D�E�����f�j�j���&C�D�E���"�"�4�9�9�g�O�����%�%�������'��H��?�?�>��?�9�D���
�
�j�'�*��M�M�,���H�,<�,<�(=� =��M�O����d�#�#��
�
�o�t�,��(�(�D�M�M�9��
�
�o�t�,��8�8��>���
�
�,�h�7�	�
�
�8�U�#�#��J�J�|�U�+�+�
��!���)?�@��'��J�J�w���J�J�w��+
�
���	 �
,�	$��[
s�J,� J,c��URSS5(dgU(aSU;a[R"[S55e[R
"U5n[R"X5nU(aURSUS9 gg)z+add a bookmark part to the requested bundlerFNrDs#no common bookmarks exchange methodry)r}r
r+rr��listbinbookmarksr�r|)r~rmrqr�r�r�r�rzs        r7�_getbundlebookmarkpartrn
so��
�:�:�k�5�)�)���\��/��k�k�!�B�C�D�D��$�$�T�*�E�����,�D������4��0�r9rc���URSS5nUH`nURS5nURSU5 URU5R	5n	[
R"U	5UlMb g)z@add parts containing listkeys namespaces to the requested bundler{r�rr�N)r}r|r�r{r=r�
encodekeysrz)
r~rmrqr�r�r�r{r�rarUs
          r7�_getbundlelistkeyspartsrq
sc��
�z�z�*�b�)�H��	����{�+���
�
�l�I�.��}�}�Y�'�-�-�/���&�&�t�,��	�	r9c���URSS5(a�UR5RnUcURR5nOCURR
n	UV
s/sH
o�"U
5PM nn
UVs/sH	o�cMUPM nnUR
USS9nURRUS9n
[R"U
5n
[R"X
5 ggs sn
fs snf)z8add an obsolescence markers part to the requested bundle�
obsmarkersFNTr�r>)
r}r�rhr1r�r�r�rArBrr�r	r�)r~rmrqr�r�rkr��unfi_clr1r�r�r�r~r�s              r7�_getbundleobsmarkerpartru)
s���
�z�z�,��&�&��/�/�#�-�-���=��~�~�.�.�0�H��m�m�+�+�G�27�8�%�$���
�%�H�8�'/�C�x���x�H�C�� � ��T� �:���-�-�/�/�T�/�:���'�'��0���#�#�G�5�'��9��Cs�*C*�C/�C/rwc��URSS5(Ga(U(aSURS5;a[R"[S55eUcUR	5n[
R"[5nUR5(aXW[R'GOEURRnURRn	URRn
UH"nXx"X"U55R!U5 M$ [#UR%55nU(a['U5[R(::deUR[R([55n
U
(amUR[R[55nSnUR+X�U5nUH+nU[RR!U	"U55 M- [R,Vs0sHo�[/Xx5_M nn[R0"U5nUR3SUS	9 ggs snf)
z,add phase heads part to the requested bundlerFr�rws no common phases exchange methodNs"heads(only(%ln, %ln) and public())r�ry)r}r
r+rrkr%r&r�r,rr�r-r�rhr�r�r�rTrUr�r/r~r�r<r�r|)r~rmrqr�r�rkr��headsbyphaser�r�r�r��
seenphases�
draftheads�publicheadsr8�
extraheadsr��phasemappingr�s                    r7�_getbundlephasespartr}<
s���
�z�z�(�E�"�"������I�)>�>��+�+�a� C�D�E�E��=��J�J�L�E�"�.�.�s�3���?�?���*/����'��$�$�*�*�E��>�>�&�&�D��.�.�$�$�C����U�4��Q��0�1�5�5�a�8���l�/�/�1�2�J���:��&�,�,�6�6�6�&�)�)�&�,�,���>�J��*�.�.�v�}�}�c�e�D��>��!�Y�Y�v�;�G�
�#�A� ����/�3�3�D��G�<�$�
=C�<L�<L�
�<L�5�6�,�-�.�.�<L�	�
�
�'�'��5�	�����Y��7�S#��F
s�I�hgtagsfnodesc��U(aURSS5(aSU;dg[XU5n[R"XU5 g)z�Transfer the .hgtags filenodes mapping.

Only values for heads in this bundle will be transferred.

The part data consists of pairs of 20 byte changeset node and .hgtags
filenodes raw values.
r<Tr~N)r}rqr	�addparttagsfnodescache�	r~rmrqr�r�rkrnr�rls	         r7�_getbundletagsfnodesr�m
s=��*�&�*�*�T�4�0�0�_��5N����V�4�H��"�"�4�(�;r9scache:rev-branch-cachec�
�URSS5(aHU(aASU;d;URSS5(d$URR[5(ag[	XU5n[
R"XU5 g)z�Transfer the rev-branch-cache mapping

The payload is a series of data related to each branch

1) branch name length
2) number of open heads
3) number of closed heads
4) open heads nodes
5) closed heads nodes
r<Tsrev-branch-cacher�FN)r}r/�has_sectionrrqr	�addpartrevbranchcacher�s	         r7�_getbundlerevbranchcacher��
sf��4
�J�J�t�T�"�"���f�,��:�:�h��&�&��7�7���1�2�2����V�4�H��!�!�$��:r9c��UR5n[R"SR[	U555R5nUS/:Xd(X:Xd"USU/:Xd[R"SU-5eggg)zNcheck if the heads of a repo have been modified

Used by peer for unbundling.
r9rshasheds.repository changed while %s - please try againN)rkr�sha1r*r<�digestr
�	PushRaced)rm�their_heads�contextrk�
heads_hashs     r7�check_headsr��
sz��

�J�J�L�E����s�x�x��u�
�6�7�>�>�@�J���z�!����9�j�1�1��o�o�=��G�
�	
�	2� �	"r9c	��^^^^^
^�Sm/SQmSnTRRSS5nTRS5(dTRS5(aSn[TUS	5 [	U[
R5(d�S
RT[R"T5/5nTR5 TRU5n[
R"TXTT5n	[
R"U	5mSSS5 SSS5 O�SmUUUU4Sjn
TRRSS5(dU
"5 [
R"TU
US
S9n	[
R"TXS9n	U	R mU(a#Tb TRR#SSS9 U4SjnTSbTSR%5 [.R0"TSTSTS5 Ub U"TRR355 T$!,(df   GN=f!,(df   Nf=f!U	R mU(a%Tb!TRR#SSS9 U4Sjnfff=f![&a4nSUlU(a TbTR+5=m
UlU
4SjneSnAff=f![.R0"TSTSTS5 Ub!U"TRR355 ff=f)aApply a bundle to a repo.

this function makes sure the repo is locked during the application and have
mechanism to check that no push race occurred between the creation of the
bundle and its application.

If the push was raced as PushRaced exception is raised.r�NNNNrssbundle2-output-capturesremote:http:s
remote:https:Tsuploading changesrec�8>�TS(d�[R"T5(dTR5TS'TR5TS'TR	T5TS'TTSR
S'TTSR
S'STSR
S'TS$)Nr$rrrurr�r�)r�r�r�rr)rw)�	lockandtrrmrqrs����r7rm� unbundle.<locals>.gettransaction�
s����$�Q�<�&�7�7��=�=�+/�:�:�<�I�a�L�'+�y�y�{�	�!��'+�'7�'7��'?�	�!��;A�	�!��-�-�i�8�8;�	�!��-�-�f�5�<@�	�!��-�-�j�9�$�Q�<�'r9sbundle2lazylockingr�)�
captureoutputrq)r�)r
�subprocc�(>�TRSUSS9 g�NsoutputF)rzr])r|)�outputr�s �r7�	recordout�unbundle.<locals>.recordouts����I�I�i�f��I�Nr9r$c�T>�[R"SUSS9nTRU5 gr�)r	�
bundlepartr@)r�rarBs  �r7r�r�
s(���&�1�1�%�F�e� �����T�*r9r)r/r�r(r�rUr	rWr*rrvrr)r�r�r�r*r4�
pushbufferr��
BaseException�duringunbundle2�
salvageoutput�_bundle2salvagedoutputr�r��	popbuffer)rmr<rkrqrr�r�r�r�r�rmr�r�rBr�s`  ``       @@@r7r;r;�
s����	
�A�#�I��I��G�G�&�&��2��M��~�~�o�&�&�#�.�.�9I�*J�*J��
�B+�	�D�%�!5�6��"�g�0�0�1�1��j�j�&�'�*>�*>�s�*C�!D�E�G�����d�.�.�w�7�2��(�(��r�v�s�C���5�5�b�9��8����A�1
�	(�	(��w�w�)�)�#�%:���#�$��,�,��"�"/�"�	��O� �.�.�t�R�?�B����A�$������*�*��t�*�D�O��Q�<�+��a�L�&�&�(�	���	�!��i��l�I�a�L�A�� ��d�g�g�'�'�)�*��H�w8�7�����D���A�$������*�*��t�*�D�O�*7�}��!�
�&*��#� �Q�]�9:���9J�J�E�C�6�+���
��	���	�!��i��l�I�a�L�A�� ��d�g�g�'�'�)�*�!�sv�A#J'�=H�0H�?H�J'�AI&�H)�1AI&�
H	�H�
H&�"J'�):I#�#I&�&
J$�0/J�J$�$J'�'AK.c
�d�URnURnURRSS5(dg[	U5(agUR
(agUR
S5(dgUR5nURS05R5nSSS5 SUl
[R"UW5nU(d%URR[S55 g[R"XUR S9nU(dIURR#[S55 URR#[S55 g[R$"URU5nUS	S
nUS	R'S5nU(a�[(R*R,R/5n[1[3U[5[	U5555n	Sn
[	U	5nUR7S5H-nUR7S
5up�X�;aMX�U:dM'Un
X�nM/ U
nURR9[S5U-5 [;URXX'5(a%URR9[S55 gURRSS5(a%URR#[S55 g[<R>"[S5[S5S9e!,(df   GN�=f)z0Apply a clone bundle from a remote, if possible.r(r�NTsDno clone bundles available on remote; falling back to regular clone
)rYsOno compatible clone bundles available on server; falling back to regular clone
s5(you may want to report this to the server operator)
rsURLsDIGEST�,�:sapplying clone bundle from %s
sfinished applying clone bundle
sclonebundlefallbacksfalling back to normal clone
serror applying bundles}if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false"rR) rmr|r/r�r�rkr�r$r%r&r]r
�parseclonebundlesmanifest�noter�filterclonebundleentriesrYr��sortclonebundleentriesr}�urlmod�
digesthandler�digest_algorithmsrUr��zip�ranger[r�trypullbundlefromurlr
r+)r�rmr|r3r��entriesrr��
algorithms�
preference�
best_entry�best_preference�digest_entry�cur_algo�
cur_digests               r7r�r�s����;�;�D�
�]�]�F��7�7���e�_�5�5���4�y�y��
�|�|���>�>�/�*�*��	�	�	�	!�Q��m�m�O�R�0�7�7�9��
"�
#'�F���4�4�T�3�?�G�������
�3�
�	
�	��3�3��F�,G�,G��G��	
�����
�3�
�	
�	
�����
�G�H�	
�	��1�1�$�'�'�7�C�G�
�!�*�V�
�C�
�Q�Z�^�^�I�
&�F�
��)�)�;�;�@�@�B�
��#�j�%��J��*@�A�B�
��
��j�/��"�L�L��.�L�#/�#5�#5�d�#;� �H��)���#�o�5�)�
�",�"6��
/����G�G�N�N�1�7�8�3�>�?��D�G�G�T��?�?������q�<�=�>�
���	�	�E�#9�	:�	:������Q�8�9�:��k�k�
�&�'��4��
�	
�G
"�	!�s�!L � 
L/c���U(d"[R"[SU-55eU[[R
5SnUR
U5n[R"U5$)Ns$no remote repository supplied for %s)	r
r+rr�r
�CLONEBUNDLESCHEME�get_cached_bundle_inlinerr")r/r�peer�
clonebundleid�peerclonebundles     r7�inline_clone_bundle_openr�|sX����k�k�!�C�c�I�J�K�K���L�:�:�;�=�>�M��3�3�M�B�O����O�,�,r9c	�r�UR5 URS5nUR[R5(a
[XU5nO[R"XUS9n[XS5n[U[R5(aURU5 O[R"XUSU5 SSS5 SSS5 g![R a;nUR#[%S5[&R("U5-5 SnAO_SnAf[R*aEnUR#[%S5[&R("UR,5-5 SnAOSnAff=fSSS5 SSS5 g	!,(df   O=fSSS5 g!,(df   g=f)
z%Attempt to apply a bundle from a URL.s	bundleurl)r�r"r�NTsHTTP error fetching bundle: %s
serror fetching bundle: %s
F)rr)r(r
r�r�r��openr8rUrr.�applyr	r��urlerr�	httperrorr�rrr��urlerror�reason)	r/rmrr�r�r�r0r<r3s	         r7r�r��s;��	
����d�&�&�|�4��	��~�~�l�<�<�=�=�-�b�t�<���[�[���8���B�I�.�B��"�k�<�<�=�=�������#�#�D�b�/�3�G��5�������	��G�G��5�6��)�)�!�,�-�
�
�����	��G�G��0�1��)�)�!�(�(�3�4�
�
��	���15���4�4�����s^�F(�F�BC�F(�E9�'1D�F�E9�4;E4�/F�4E9�9F�=F(�
F	�F(�(
F6r�r�)
NNFr�NNNNNN)NNNN)NNNNN)NNr�)��
__future__rr%r��i18nrr�rr�rr�r	r
rrr
rr�rrrrrrrrrrrr�rr�utilsrrr�
interfacesrr�r>rr8rErfrqr�r�r�rrrrrr�r�r&r;rCrPrKrlrprorvr�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r�r�r�r?r�r�rU�
transactionalr�r{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrCr�rJrIrLrQr]r`rkrnrqrur}r�r�r�r;r�r�r�r�r9r7�<module>r�s���#�����������,��
#�	
����	
����!��
�>�S=�l3�(#.�L
=� Y&�Y&�~	
�
#�$�	�
*�+��
	
�
$�%�	�
+�,��
	
�
*�+�	�
1�2��
�
�&�	
�����q�j��
���&�(�&�|�����4�x��C-��C-�L�|��K��K�"�|��O��O�(9�x#�N��
���,C�6��$�%�8�&�8��/�"�=�#�=�.�,��3� �3�l�(��5��5�"8�"�J�-� �	6�!�	6��,��8� �8��
��.-�`�+�1�%�7�&�7�*=�@-Q�`G�T*0����,�* $�F\,�\,�~��+�+��@N�
';�T0�,
�
�
������
��|�@��
���&����?� �?��~�����@R�jI�=B�@+�(?�V�*�:5�pB5�J���
���,�����
H%�V�)�$�A�%�A��.�)�
��
���H
�*�H
�V�,�'�37�1�(�1��+�&�37�	-�'�	-��-�(�?C�6�)�6�$�)�$�?C�-8�%�-8�`�/�*�
��
��<�+�<�6�3�4�
��
��";�5�";�J
�&V
�r^
�B-�r9

Youez - 2016 - github.com/yon3zu
LinuXploit