HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //proc/self/root/lib64/python2.7/site-packages/mercurial/phases.pyc
�
1�3\c@@s'dZddlmZddlZddlZddlmZddlmZm	Z	m
Z
mZmZddl
mZmZmZmZmZejd�Zd	Zd
Zed�\ZZZeeBZeZeed�ZedZege e�Z!dd
dge!d*de!e<de!e<e"ed�Z#e"ed�Z$e"d�eD��Z%d�Z&ed�Z'd�Z(d�Z)d�Z*de+fd��YZ,ed�Z-d�Z.d�Z/d�Z0d�Z1d�Z2d �Z3d!�Z4d"e+fd#��YZ5d$�Z6d%�Z7d&�Z8d'�Z9dS((s� Mercurial phases support code

    ---

    Copyright 2011 Pierre-Yves David <pierre-yves.david@ens-lyon.org>
                   Logilab SA        <contact@logilab.fr>
                   Augie Fackler     <durin42@gmail.com>

    This software may be used and distributed according to the terms
    of the GNU General Public License version 2 or any later version.

    ---

This module implements most phase logic in mercurial.


Basic Concept
=============

A 'changeset phase' is an indicator that tells us how a changeset is
manipulated and communicated. The details of each phase is described
below, here we describe the properties they have in common.

Like bookmarks, phases are not stored in history and thus are not
permanent and leave no audit trail.

First, no changeset can be in two phases at once. Phases are ordered,
so they can be considered from lowest to highest. The default, lowest
phase is 'public' - this is the normal phase of existing changesets. A
child changeset can not be in a lower phase than its parents.

These phases share a hierarchy of traits:

            immutable shared
    public:     X        X
    draft:               X
    secret:

Local commits are draft by default.

Phase Movement and Exchange
===========================

Phase data is exchanged by pushkey on pull and push. Some servers have
a publish option set, we call such a server a "publishing server".
Pushing a draft changeset to a publishing server changes the phase to
public.

A small list of fact/rules define the exchange of phase:

* old client never changes server states
* pull never changes server states
* publish and old server changesets are seen as public by client
* any secret changeset seen in another repository is lowered to at
  least draft

Here is the final table summing up the 49 possible use cases of phase
exchange:

                           server
                  old     publish      non-publish
                 N   X    N   D   P    N   D   P
    old client
    pull
     N           -   X/X  -   X/D X/P  -   X/D X/P
     X           -   X/X  -   X/D X/P  -   X/D X/P
    push
     X           X/X X/X  X/P X/P X/P  X/D X/D X/P
    new client
    pull
     N           -   P/X  -   P/D P/P  -   D/D P/P
     D           -   P/X  -   P/D P/P  -   D/D P/P
     P           -   P/X  -   P/D P/P  -   P/D P/P
    push
     D           P/X P/X  P/P P/P P/P  D/D D/D P/P
     P           P/X P/X  P/P P/P P/P  P/P P/P P/P

Legend:

    A/B = final state on client / state on server

    * N = new/not present,
    * P = public,
    * D = draft,
    * X = not tracked (i.e., the old client or server has no internal
          way of recording the phase.)

    passive = only pushes


    A cell here can be read like this:

    "When a new client pushes a draft changeset (D) to a publishing
    server where it's not present (N), it's marked public on both
    sides (P/P)."

Note: old client behave as a publishing server with draft only content
- other people see it as public
- content is pushed as draft

i(tabsolute_importNi(t_(tbinthextnullidtnullrevtshort(terrortpycompattsmartsetttxnutiltutils>i20si@i itpublictdrafttsecrettarchivedtinternalicc@s|]}|t@r|VqdS(N(t
HIDEABLE_FLAG(t.0tp((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pys	<genexpr>�scC@s
d|jkS(s6True if the internal phase can be used on a repositorysinternal-phase(trequirements(trepo((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytsupportinternal�scC@s|j�}t}gtD]}t�^q}ywtj|j|jd�\}}zDx=|D]5}|j�\}}	|t	|�j
t|	��q\WWd|j�XWnZt
k
r}
|
jtjkr��n|r�x |D]}|||�}q�Wnt}nX||fS(s�Read phase roots from disk

    phasedefaults is a list of fn(repo, roots) callable, which are
    executed if the phase roots file does not exist. When phases are
    being initialized on an existing repository, this could be used to
    set selected changesets phase to something else than public.

    Return (roots, dirty) where dirty is true if roots differ from
    what is being stored.
    t
phaserootsN(t
unfilteredtFalset	allphasestsetR
t
trypendingtroottsvfstsplittinttaddRtclosetIOErrorterrnotENOENTtTrue(Rt
phasedefaultstdirtytitrootstftpendingtlinetphasetnhtinst((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyt
_readroots�s$!
%

cC@sZg}xDt|�D]6\}}x'|D]}|jtj||��q&WqWdj|�S(s�encode a 'phase -> nodes' mapping into a binary stream

    Since phases are integer the mapping is actually a python list:
    [[PUBLIC_HEADS], [DRAFTS_HEADS], [SECRET_HEADS]]
    t(t	enumeratetappendt
_fphasesentrytpacktjoin(tphasemappingt
binarydataR.tnodesthead((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytbinaryencode�s

!cC@s�gtD]}g^q}tj}xstr�|j|�}t|�|krn|rjtjtd���nPntj	|�\}}||j
|�q%W|S(s{decode a binary stream into a 'phase -> nodes' mapping

    Since phases are integer the mapping is actually a python list.sbad phase-heads stream(RR5tsizeR&treadtlenRtAbortRtunpackR4(tstreamR)theadsbyphaset	entrysizetentryR.tnode((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytbinarydecode�s		cC@sL|dkrdS|j|�}|dk	r8|d}n||f||<dS(sSadd a phase move the <data> dictionnary

    If data is None, nothing happens.
    Ni(tNonetget(tdatatrevtoldtnewtexisting((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyt_trackphasechange�s
t
phasecachecB@s�eZed�Zdd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zdd
�Zd�Zd�Zd�ZRS(cC@sS|rOt||�\|_|_d|_d|_|j|�|j|_ndS(Ni(	R1RR(t_loadedrevslenRHt
_phasesetst
filterunknownRtopener(tselfRR't_load((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyt__init__�s		
c@s�|j|�t|�}t|kr�t|�dkrP|\}|j|�n)tjg|D]}|j|^q]��|jjr��|jj�n|dkr�t	j
��S|t	j
��@Sn�tt�j|�}|s�t	j
|�St|�dkr|\}|j|�n)tjg|D]}|j|^q%��|dkr_t	j
|�}n�si|S|j�fd��SdS(s&return a smartset for the given phasesic@s
|�kS(N((tr(trevs(s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyt<lambda>R2N(t
loadphaserevsRRR?RRtuniont	changelogtfilteredrevsRHR	tbasesetRt
differencetfullreposettfilter(RURtphasestsubsetR((RYs6/usr/lib64/python2.7/site-packages/mercurial/phases.pyt	getrevset�s0
	)

	)cC@sY|jdddt�}|j|_|j|_|j|_|j|_|j|_|S(NRV(t	__class__RHRRR(RTRQRR(RUtph((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytcopys
cC@s.x'dD]}t||t||��qWdS(s4replace all values in 'self' with content of phcacheRR(RTRQRRN(RR(RTRQRR(tsetattrtgetattr(RUtphcacheta((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytreplaces
cC@sY|j�}g}x4tD],}|jtj|jj|j|��qW|jj|�S(N(	Rt
trackedphasesR4RtmaplistR]RKRt
computephases(RURtnativerootsR.((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyt_getphaserevsnatives
cC@s�|j�}|j}gtD]}t�^q|_t�}x�tt�D]�}tj|j	|j
|�}|rJt|j|��}x|D]}|j|�q�W|j
|�|j|�||j|<qJqJWt|�|_dS(N(RR]RRRRtreversedRnRRoRKRtdescendantsR!tdifference_updatetupdateR?RQ(RURtclR.t
lowerrootsR*tpsR((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyt_computephaserevspure s		


cC@s\|jdkrXy%|j|�}|\|_|_WqXtk
rT|j|�qXXndS(s0ensure phase information is loaded in the objectN(RRRHRrRQtAttributeErrorRz(RURtres((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyR[0s
cC@sd|_d|_dS(Ni(RQRHRR(RU((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyt
invalidate9s	cC@s�|tkrtS|tkr1ttd���n||jkrZ|j�|j|�nx%tD]}||j|kra|SqaWtS(Nscannot lookup negative revision(	RRt
ValueErrorRRQR}R[RnRR(RURRKR.((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyR.=s

cC@sN|js
dS|jdddtdt�}z|j|�Wd|j�XdS(NRtwt
atomictempt
checkambig(R(RTR&t_writeR"(RUR+((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytwriteOs	cC@saxQt|j�D]@\}}x1t|�D]#}|jd|t|�f�q)WqWt|_dS(Ns%i %s
(R3RtsortedR�RRR((RUtfpR.R*th((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyR�Xs%cC@sG||j|<|j�t|_|jdd|j�d|jd<dS(NR.Rt1tphases_moved(R(RR}R&R(taddfilegeneratorR�thookargs(RUR.tnewrootsttr((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyt_updateroots^s


	cC@s�|j�}|j||||�|dk	r�d|jkr�|jd}|jj}|j}x?|D]4}||�}	|||	�}
t||	d|
�qfWn|j�dS(NRc(	Rt_retractboundaryRHtchangesR]RKR.ROtinvalidatevolatilesets(RURR�ttargetphaseR:t
phasetrackingttorevR.tnRKtrevphase((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytregisternewfs
	
cC@s�|dkrd}n|jjd�}|j�}t�}g}x,tj|dtt��D]}	g|D].}
|j	|||
j
��|	krl|
^ql}|s�Pn|j|	}|jd||�}|j
|�|r�q_nx-|D]%}
t||
|j	||
�|�q�Wtd�|jd||�D��}||kr_|j|	||�|j||�q_q_W|s�|dkr�|j||||�n|j�n|S(s�Set all 'nodes' to phase 'targetphase'

        Nodes with a phase lower than 'targetphase' are not affected.

        If dryrun is True, no actions will be performed

        Returns a set of revs whose phase is changed or should be changed
        Rcis%ln::%lncs@s|]}|j�VqdS(N(RF(Rtctx((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pys	<genexpr>�ssroots((%ln::) - %ld)iN(RHR�RIRRRtxrangeR?RR.RKRRYRvROR�textendR�R�(RURR�R�R:tdryrunR�R�tdelrootsR.R�toldstaffectedRXR*((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytadvanceboundaryss:		#
.



cC@s-|j|d }|dkr&d}n|jjd�}|j�}|j||||�r|dk	r|j|}||}t|jd||��}	x�tj	|dd�D]h}
|
r�||
}t|jd||	��}|	|8}	n|	}x!|D]}
t
||
|
|�q�Wq�Wn|j�dS(NiRcs(%ln::) - (%ln::)i����s%ln::%ld(RRHR�RIRR�RRYRR�ROR�(RURR�R�R:toldrootsR�RMRLR�R.R*RYRX((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytretractboundary�s&	




c@s�|ttfkrEt��rEt|}d|}tj|��n�j��|j|}t|�}}	g|D].}
|j	��|
j
��|kru|
^qu}|r�t|kr�tjt
d���n|j�}|j|�t�fd�|D���g|D]"}
�|
j
��kr|
^q}�jd|�}
t��fd�|D��}|jd�|
D��n||	kr�|j|||�tStS(Ns-this repository does not support the %s phases!cannot change null revision phasec3@s|]}�|j�VqdS(N(RK(RR�(R(s6/usr/lib64/python2.7/site-packages/mercurial/phases.pys	<genexpr>�ssroots(%ln::)c3@s+|]!}�|j��kr|VqdS(N(RK(RR�(t
minnewrootR(s6/usr/lib64/python2.7/site-packages/mercurial/phases.pys	<genexpr>�scs@s|]}|j�VqdS(N(RF(RR�((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pys	<genexpr>�s(RRRt
phasenamesRtProgrammingErrorRRRR.RKRR@RRhRvtminR�R&R(RURR�R�R:tnametmsgtcurrentrootst
finalrootsR�R�R�t
aboverootstupdatedroots((R�Rs6/usr/lib64/python2.7/site-packages/mercurial/phases.pyR��s0



.

"c@s�t}|jj�x�t|j�D]u\}}t�fd�|D��}|r"x.|D]&}|jjdt|�|f�qWW|j	|�t
}q"q"W|r�t
|_n|j�dS(s�remove unknown nodes from the phase boundary

        Nothing is lost as unknown nodes only hold data for their descendants.
        c3@s!|]}|�kr|VqdS(N((RRF(tnodemap(s6/usr/lib64/python2.7/site-packages/mercurial/phases.pys	<genexpr>�ss0removing unknown node %s from %i-phase boundary
N(
RR]R�R3RR�tuitdebugRtsymmetric_difference_updateR&R(R}(RURtfilteredR.R:tmissingtmnode((R�s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyRS�s
	

	N(t__name__t
__module__R&RWRHReRhRmRrRzR[R}R.R�R�R�R�R�R�R�RS(((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyRP�s"	!													
2		#cC@sJ|jj�}|j||||d|�}|sF|jj|�n|S(suAdd nodes to a phase changing other nodes phases if necessary.

    This function move boundary *forward* this means that all nodes
    are set in the target phase or kept in a *lower* phase.

    Simplify boundary to contains phase roots only.

    If dryrun is True, no actions will be performed

    Returns a set of revs whose phase is changed or should be changed
    R�(t_phasecacheRhR�Rm(RR�R�R:R�RkR�((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyR��s	cC@s9|jj�}|j||||�|jj|�dS(s�Set nodes back to a phase changing other nodes phases if
    necessary.

    This function move boundary *backward* this means that all nodes
    are set in the target phase or kept in a *higher* phase.

    Simplify boundary to contains phase roots only.N(R�RhR�Rm(RR�R�R:Rk((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyR�scC@s9|jj�}|j||||�|jj|�dS(s�register a new revision and its phase

    Code adding revisions to the repository should use this function to
    set new changeset in their target phase (or higher).
    N(R�RhR�Rm(RR�R�R:Rk((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyR�scC@s�tj�}dt}|j�j}xO|jjtD]=}|jj||j|��tkr6||t	|�<q6q6W|j
�r�d|d<n|S(s/List phases root for serialization over pushkeys%iR&t
publishing(RtsortdictR
RR]R�RR.RKRR�(RtkeystvalueRwR((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyt
listphases(s
$
cC@s�|j�}|j���||j�}tt|��}tt|��}||kr�||kr�|jd��#}t|||t|�g�WdQXtS||kr�tSt	SWdQXdS(s/List phases root for serialization over pushkeys
pushkey-phaseN(
RtlockR.tabsR ttransactionR�RR&R(RtnhextoldphasestrtnewphasestrtcurrentphasetnewphasetoldphaseR�((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyt	pushphaseFs
"cC@s{|j}gtD]}g^q}xRtt D]F}dt|}g|j||�D]}|j|�^qT||<q-W|S(s�Finds the phase heads for a subset of a history

    Returns a list indexed by phase number where each item is a list of phase
    head nodes.
    sheads(%%ln & %s())(R]RRR�RYRF(RRdRwR)RCR.trevsetRX((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytsubsetphaseheadsWs	6cC@spxitd D]]}d}g|j||||�D]}|j�^q1}|rt||�||�qqWdS(s+Updates the repo with the given phase headsi����s%ln - _phase(%s)N(RRRFR�(RttrgetterRCR.R�tctheads((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytupdatephasesgs
2c	C@s|j�}g}|jj}x�|j�D]�\}}|dkrIq+nt|�}t|�}|tkr�|tkr�|jj	t
d�|�q�q+|tkr�||kr�|j|�q�q+|jj	t
d�||f�q+Wt
|||�}||fS(s�Compute phases heads and root in a subset of node from root dict

    * subset is heads of the subset
    * roots is {<nodeid> => phase} mapping. key and value are string.

    Accept unknown element input
    R�s2ignoring inconsistent public root from remote: %s
s,ignoring unexpected root from remote: %i %s
(RR]R�t	iteritemsRR RRR�twarnRR
R4tnewheads(	RRdR*t
draftrootsR�R�R.RFtpublicheads((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytanalyzeremotephasests&tremotephasessummarycB@seZdZd�ZRS(ssummarize phase information on the remote side

    :publishing: True is the remote is publishing
    :publicheads: list of remote public phase heads (nodes)
    :draftheads: list of remote draft phase heads (nodes)
    :draftroots: list of remote draft phase root (nodes)
    cC@s�|j�}||_|jdt�|_t|||�}|\|_|_|jd|j|�}g|D]}|j	�^qm|_
dS(NR�sheads(%ln::%ln)(Rt_allremoterootsRIRR�R�R�R�RRFt
draftheads(RURtremotesubsettremoterootstunfitanatdheadsR�((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyRW�s	(R�R�t__doc__RW(((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyR��sc@s:ddlm}|j�}|j}|jj�|s;|S|sQ|tgkrUgSt�fd�|D��}g|D]}�|�^qx}|jd||�}|j	|�|jd||�}||8}|s�|r!|j
|�|jd|�}	|j|||	�}
|j	|
�ntj
|jt|��S(s�compute new head of a subset minus another

    * `heads`: define the first subset
    * `roots`: define the second we subtract from the firsti(tdagopc3@s'|]}|tkr�|�VqdS(N(R(RR�(RK(s6/usr/lib64/python2.7/site-packages/mercurial/phases.pys	<genexpr>�ss
(%ld::%ld)s-parents(%ld + (%ld and merge())) and not nullsparents(%ld) and not null(R2R�RR]R�RIRRRYRuRvtreachablerootsRRoRFR�(RR�R*R�Rwt	new_headsR�t
affected_zonet
candidatest
prunestarttpruned((RKs6/usr/lib64/python2.7/site-packages/mercurial/phases.pyR��s*	
	

cC@s||jdd�}ytj|�SWnRtk
rwyt|�SWqxtk
rstd�}tj||��qxXnXdS(suhelper to get the target phase of new commit

    Handle all possible values for the phases.new-commit options.

    Rcs
new-commits0phases.new-commit: not a valid phase name ('%s')N(tconfigR�tindexR~R RRtConfigError(R�tvR�((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytnewcommitphase�s

cC@st|jjd�S(s@utility function that check if a repo have any secret changeset.i(tboolR�R(R((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyt	hassecret�scC@s<|dkrd}n
t|}i|d6|d6t|d6S(NR2RFR�R.(RHR�(RFRLRM((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pytpreparehookargs�s	

(:R�t
__future__RR$tstructti18nRRFRRRRRR2RRR	R
RtStructR5t
INTERNAL_FLAGRtrangeRR
RRRRRnRHR?R�ttuplet
mutablephasestremotehiddenphasestlocalhiddenphasesRR1R<RGROtobjectRPR�R�R�R�R�R�R�R�R�R�R�R�R�(((s6/usr/lib64/python2.7/site-packages/mercurial/phases.pyt<module>esR((



				�$		
				
		%