-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyc

ó
î:ïNc@@sdZddlmZdddddgZddlmZmZmZm	Z	dd	l
mZdd
lm
Z
ddlmZmZddlmZed
„Zdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdS(sCReconcilers are able to fix some potential data errors in a branch.i(tabsolute_importtKnitReconcilertPackReconcilert	reconcilet
ReconcilertRepoReconciler(tcleanupterrorstrevisiontui(tmutter(t	topo_sort(tAdapterFactorytFulltextContentFactory(tgettextcC@s t|d|ƒ}|jƒdS(seReconcile the data in dir.

    Currently this is limited to a inventory 'reweave'.

    This is a convenience method, for using a Reconciler object.

    Directly using Reconciler is recommended for library users that
    desire fine grained control or analysis of the found issues.

    :param canonicalize_chks: Make sure CHKs are in canonical form.
    tcanonicalize_chksN(RR(tdirRt
reconciler((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR*scB@sAeZdZded„Zd„Zd„Zd„Zd„Z	RS(s0Reconcilers are used to reconcile existing data.cC@s||_||_dS(sCreate a Reconciler.N(tbzrdirR(tselfRtotherR((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyt__init__=s	cC@s5tjjƒ|_z|jƒWd|jjƒXdS(s!Perform 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.
        * `fixed_branch_history`: None if there was no branch, False if the
          branch history was correct, True if the branch history needed to be
          re-normalized.
        N(R	t
ui_factorytnested_progress_bartpbt
_reconciletfinished(R((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRBs
cC@s|jƒ|jƒdS(s.Helper function for performing reconciliation.N(t_reconcile_brancht_reconcile_repository(R((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRUs
cC@s|y|jjƒ|_Wntjk
r6d|_dSXtjj	t
dƒ|jjƒ|jjdt
ƒ}|j|_dS(NsReconciling branch %stthorough(Rtopen_branchtbranchRtNotBranchErrortNonetfixed_branch_historyR	RtnoteRtbaseRtTruet
fixed_history(Rtbranch_reconciler((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRZs	 cC@s)|jjƒ|_tjjtdƒ|jjƒ|jj	tdƒddƒ|j
rªy|jjWn0tk
r—t
jtdƒ|jfƒ‚nX|jjƒ}n|jjdtƒ}|j|_|j|_|jrtjjtdƒƒtjjtdƒƒntjjtd	ƒƒdS(
NsReconciling repository %ssReconciling repositoryiis%s cannot canonicalize CHKs.Rs;Reconcile aborted: revision index has inconsistent parents.s!Run "bzr check" for more details.sReconciliation complete.(Rtfind_repositorytrepoR	RR#Rtuser_urlRtupdateRtreconcile_canonicalize_chkstAttributeErrorRtBzrErrorRR%tinconsistent_parentstgarbage_inventoriestaborted(Rtrepo_reconciler((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRes(	
	

N(
t__name__t
__module__t__doc__R!tFalseRRRRR(((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR:s			tBranchReconcilercB@s>eZdZed„Zd„Zd„Zd„Zd„ZRS(s"Reconciler that works on a branch.cC@sd|_||_||_dS(N(R!R&RR(Rta_branchR((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRs		cC@s,tj|jƒ}|j|_|jƒdS(N(RtOperationWithCleanupsRtadd_cleanupt
run_simple(Rt	operation((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR†scC@sS|jjƒ|j|jjƒtjjƒ|_|j|jjƒ|j	ƒdS(N(
Rt
lock_writeR:tunlockR	RRRRt_reconcile_steps(R((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR‹s

cC@s|jƒdS(N(t_reconcile_revision_history(R((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR?’scC@s|jjƒ\}}g}|jjjƒ}y4x-|j|tjfƒD]}|j|ƒqIWWntj	k
rwnX|j
ƒ|t|ƒkrát|_
tjjtdƒj|t|ƒƒƒ|jjt|ƒ|ƒnt|_
tjjtdƒƒdS(Ns%Fixing last revision info {0}  => {1}srevision_history ok.(Rtlast_revision_infot
repositoryt	get_graphtiter_lefthand_ancestryt
_mod_revisiont
NULL_REVISIONtappendRtRevisionNotPresenttreversetlenR%R&R	RR#Rtformattset_last_revision_infoR6(Rt
last_revnotlast_revision_idtreal_historytgraphtrevid((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR@•s$	
	
	(	R3R4R5R6RRRR?R@(((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR7~s			cB@s€eZdZd
ed„Zd„Zd„Zd„Zd„Z	d„Z
d„Zd„Zd	„Z
d
„Zd„Zd„ZRS(syReconciler 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.
    cC@s1d|_d|_t|_||_||_dS(sä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.
        iN(R0R/R6R1R)R(RR)RR((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR»s
				cC@s,tj|jƒ}|j|_|jƒdS(snPerform 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(RR9RR:R;(RR<((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRÈs
cC@sS|jjƒ|j|jjƒtjjƒ|_|j|jjƒ|j	ƒdS(N(
R)R=R:R>R	RRRRR?(R((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRÖs

cC@s|jƒdS(s/Perform the steps to reconcile this repository.N(t_reweave_inventory(R((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR?ÝscC@sL|jjƒ}|jjtdƒƒ|jj|_|jj|_tg|jj	ƒD]}|d^qVƒ|_
i|_d|_|j
t|j
ƒƒx|j
D]}|j|ƒq¤W|jƒ|jrý|jsã|jrýtjjtdƒƒdS|jjtdƒddƒ|jjƒtjjtdƒƒ|jjƒ}|j
t|jƒƒgt|jƒD]}|f^qq}|j|jj|dtƒ|jt|ƒƒ}|j|ƒt|j	ƒƒtg|j
D]}|f^q߃kstƒ‚n|jjtd	ƒƒ|jjƒd|_tjjtd
ƒƒdS(s`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.
        sReading inventory dataiÿÿÿÿis
Inventory ok.NsBacking up inventorysBackup inventory created.t	unordereds
Writing weavesInventory regenerated.(!R)tget_transactionRR+Rtinventoriest	inventoryt	revisionstsettkeystpendingt
_rev_graphR/t_setup_stepsRJt_graph_revisiont_check_garbage_inventoriesR0RR	RR#t_backup_inventoryt_temp_inventoriesRt_change_inv_parentstget_record_streamR%t_new_inv_parentstinsert_record_streamtAssertionErrort_activate_new_inventoryR!(Rttransactiontkeytrev_idtnew_inventoriest
revision_keyststreamRQ((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRRásB/		


%
(
	cC@s+tg|j|dD]}|f^qƒS(s/Lookup ghost-filtered parents for revision_key.iÿÿÿÿ(ttupleR[(Rtrevision_keyRQ((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRcscc@sx†|D]~}||jƒ}|r^|d|kr^|jdƒ}t|j||j|ƒVnt|j||ƒ}|V|jdƒqWdS(s/Adapt a record stream to reconcile the parents.itfulltextsadding inventoriesN(Rhtget_bytes_asR
tsha1Rt
_reweave_step(RRltget_parentstall_revision_keystrecordtwanted_parentstbytestadapted_record((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRas
cC@s||_d|_dS(s6Setup the markers we need to control the progress bar.iN(ttotaltcount(Rt	new_total((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR\+s	cC@sv|jdƒ|jj|ƒ}g}x=|jD]2}|j|ƒrT|j|ƒq/td|ƒq/W||j|<dS(s(Load a revision into the revision graph.sloading revisionssfound ghost %sN(RrR)tget_revision_reconcilet
parent_idst_parent_is_availableRGR
R[(RRitrevtparentstparent((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR]0s
cC@s{|js
dSt|jjƒƒ}t|jjƒƒ}|j|ƒ}t|ƒ|_x|D]}td|dƒq\WdS(sÑ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.
        NsGarbage inventory {%s} found.iÿÿÿÿ(	RRXRVRYRWt
differenceRJR0R
(RRURWtgarbageRn((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR^>s	
cC@sM||jkrtSdt|jj|fgƒƒk}|oL|jj|ƒS(sšTrue if parent is a fully available revision

        A fully available revision has a inventory and a revision object in the
        repository.
        i(R[R%RJRVtget_parent_mapR)thas_revision(RRtinv_present((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR~Ms$cC@s/|jj||j|jƒ|jd7_dS(s,Mark a single step of regeneration complete.iN(RR+RzRy(Rtmessage((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRrXsN(R3R4R5R!R6RRRR?RRRcRaR\R]R^R~Rr(((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR°s	
				6						cB@s;eZdZd„Zd„Zd„Zd„Zd„ZRS(s…Reconciler that reconciles a knit format repository.

    This will detect garbage inventories and remove them in thorough mode.
    cC@sS|jrOy|jƒWntjk
r7t|_dSX|jƒ|jƒndS(s/Perform the steps to reconcile this repository.N(Rt
_load_indexesRt
BzrCheckErrorR%R1t
_gc_inventoryt_fix_text_parents(R((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR?ds		
cC@s•|jjƒ|_|jjtdƒddƒ|jj|_|jjtdƒddƒ|jjƒ|jj	|_	|jjtdƒddƒdS(s$Load indexes for the reconciliation.sReading indexesiiiN(
R)RTRgRR+RRURVt(_check_for_inconsistent_revision_parentsRW(R((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRˆps
cC@s·|jjtdƒddƒ|jƒ|jjtdƒddƒ|jsetjjtdƒƒdS|jjtdƒddƒ|jj	ƒtjjtdƒƒ|jj
ƒ}|jj|jj
ƒƒ}t|ƒ}g|D]}|d	^qá}|jt|ƒƒ|j|jj|d
tƒ|jt|ƒƒ}|j|ƒt|j
ƒƒt|ƒksqtƒ‚n|jjtdƒƒ|jjƒd|_tjjtdƒƒdS(
sCRemove inventories that are not referenced from the revision store.sChecking unused inventoriesiiis
Inventory ok.NsBacking up inventorysBackup Inventory creatediÿÿÿÿRSs
Writing weavesInventory regenerated.(RR+RR^R0R	RR#R)R_R`RWR„RYRR\RJRaRVRbR%t__getitem__RXRdReRfR!(RRjRPRkRhtrevision_idsRl((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRŠzs2
	


	c@s#|jjƒ}g|jjƒD]}|d^q}tdt|ƒƒ|jjƒ}|j|jj|j	ƒ\}}|j
}i}x|D]}i||d<qŽWxž|jƒD]\}}	|d‰|d}
tg|	dD]}|d^qáƒ}tg|	dD]}|d^qƒ}
|j
ˆiƒ}||
f||
<q³Wi}x5|D]-}|j
|dgƒ}|j|dƒqTWx—t|ƒD]‰\}‰|j	jtdƒ|t|ƒƒ|ˆ}t‡fd†|Dƒƒ}ˆ|krÿ|ˆ}ng}|jˆ|||ƒq’WdS(s[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.
        iÿÿÿÿs3Prepopulating revision text cache with %d revisionsiisFixing text parentsc3@s)|]}|dˆkr|dVqdS(iiÿÿÿÿN((t.0Rh(tfile_id(s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pys	<genexpr>ÁsN(R)RTRWRYR
RJt_get_versioned_file_checkertcheck_file_version_parentsttextsRt
text_indext	iteritemsRmt
setdefaultRGt	enumerateR+RRXt_fix_text_parent(RRgRhtversionst
vf_checkertbad_parentstunused_versionsR”tper_id_bad_parentstdetailsRiRtknit_parentstcorrect_parentstfile_detailstfile_id_versionsttext_keyt
versions_listtnumtversions_with_bad_parentstid_unused_versionst
file_versions((Rs4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR‹šs@	&
	


''



c
@std|t|ƒƒtdt|ƒƒd|‰i‰tƒ}x¾|D]¶}||kraqInb||kr~||d}nE|jjj||fgƒ}g|||fD]}	|	d^q­}g|D]}
ˆ|
f^qʈˆ|f<|j||fƒqIW‡‡fd†}|jjj|dtƒ}|jj	ˆƒ|jjj
||ƒƒ|jj	|ƒtˆƒr‹|jjˆ|ƒndS(	s9Fix bad versionedfile entries in a single versioned file.s$fixing text parent: %r (%d versions)s(%d are unused)stemp:%siiÿÿÿÿc3@sXxQ|D]I}|jdƒ}ˆ|jdf}ˆ|}t|||j|ƒVqWdS(NRoiÿÿÿÿ(RpRhR
Rq(RlRuRwtnew_keyR€(tnew_file_idtnew_parents(s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pytfix_parentsàs


ttopologicalN(R
RJRXR)R“R„taddRbR%t_remove_file_idRdt
_move_file_id(
RRR¦Rœtall_versionstneeded_keystversionR€tpmapRhRR¬Rl((RªR«s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR˜Ìs,	

	
')(R3R4R5R?RˆRŠR‹R˜(((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR^s		
	 	2cB@s2eZdZdeed„Zd„Zd„ZRS(sxReconciler 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.
    cC@s/tt|ƒj|d|d|ƒ||_dS(NRR(tsuperRRR(RR)RRR((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRscC@s|js
dS|jj}|jƒ|jƒ|j|jƒ|jƒ}|jjƒ}t	t
|jjj
ƒƒƒ}t	|ƒrà|jrš|jj}n|jj}|||d||jƒ}|dk	rí|j|ƒqín
|j|ƒ|t	t
|jjj
ƒƒƒ|_dS(s/Perform the steps to reconcile this repository.Ns
.reconcile(RR)t_pack_collectiont
ensure_loadedt
lock_namesR:t
_unlock_namest	all_packstall_revision_idsRJtlisttinventory_indextcombined_indextiter_all_entriesRt_canonicalize_chks_packt_reconcile_packRR!t_discard_and_saveR0(Rt
collectiontpackst
all_revisionsttotal_inventoriestreconcile_methtnew_pack((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyR?s*	

	
	cC@sKx!|D]}|jjj|ƒqW|jjjƒ|jjj|ƒdS(seDiscard 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(R)R¶t_remove_pack_from_memoryt_save_pack_namest_obsolete_packs(RRÄtpack((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRÂ!s

N(R3R4R5R!R6RR?RÂ(((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyRîs
			N(R5t
__future__Rt__all__tbzrlibRRRRER	tbzrlib.traceR
tbzrlib.tsortRtbzrlib.versionedfileRR
tbzrlib.i18nRR6RtobjectRR7RRR(((s4/usr/lib/python2.7/dist-packages/bzrlib/reconcile.pyt<module>s"	"D2®

Copyright © 2017 || Recoded By Mr.Bumblebee