-=[ Mr. Bumblebee ]=-
_Indonesia_

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

ó
øÙOc@@südZddlmZddlZddlmZeeƒdƒddlmZm	Z	ddl
mZddlm
Z
dd	lmZd
efd„ƒYZdefd
„ƒYZdd„Zdd„Zdefd„ƒYZdefd„ƒYZdS(sCopying of history from one branch to another.

The basic plan is that every branch knows the history of everything
that has merged into it.  As the first step of a merge, pull, or
branch operation we copy history from the source into the destination
branch.
i(tabsolute_importN(tlazy_importsI
from bzrlib import (
    tsort,
    versionedfile,
    vf_search,
    )
(terrorstui(tgettext(t
NULL_REVISION(tmuttertRepoFetchercB@s;eZdZdedd„Zd„Zd„Zd„ZRS(sµPull revisions and texts from one repository to another.

    This should not be used directly, it's essential a object to encapsulate
    the logic in InterRepository.fetch().
    cC@s”||_||_|jƒ|_||_||_||_|jjƒtd|j|jj	|j|jj	ƒz|j
ƒWd|jjƒXdS(sPCreate a repo fetcher.

        :param last_revision: If set, try to limit to the data this revision
            references.
        :param fetch_spec: A SearchResult specifying which revisions to fetch.
            If set, this overrides last_revision.
        :param find_ghosts: If True search the entire history for ghosts.
        s3Using fetch logic to copy between %s(%s) and %s(%s)N(t
to_repositorytfrom_repositoryt	_get_sinktsinkt_last_revisiont_fetch_spectfind_ghostst	lock_readRt_formatt_RepoFetcher__fetchtunlock(tselfRR	t
last_revisionRt
fetch_spec((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyt__init__5s					
cC@s¯d|_i|_tjjƒ}t|_|_zl|jt	dƒddƒ|j
ƒ}td|ƒ|jƒrvdS|jt	dƒddƒ|j
|ƒWd|jƒXdS(sªPrimary worker function.

        This initialises all the needed variables, and then fetches the
        requested revisions, finally clearing the progress bar.
        isFinding revisionsisfetching: %sNsFetching revisionsi(tcount_totaltfile_ids_namesRt
ui_factorytnested_progress_bartFalsetshow_pctt
show_counttupdateRt_revids_to_fetchRtis_emptyt_fetch_everything_for_searchtfinished(Rtpbt
search_result((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyt__fetchQs		
cC@so|jjjr=|jjjr=tj|j|jdƒ‚ntjjƒ}z|j	dƒ|jj
|jjƒ}|j|ƒ}|jj}|j	dƒ|jj
||gƒ\}}|r
|j	dƒ|j|ƒ}|j	dƒ|jj
|||ƒ\}}n|r&td|fƒ‚n|rBtd|fƒ‚n|j	dƒ|jjƒWd	|jƒXd	S(
s.Fetch all data for the given set of revisions.sdifferent rich-root supportsGet stream sourcesInserting streamsMissing keyssInserting missing keyss*second push failed to complete a fetch %r.s*second push failed to commit the fetch %r.sFinishing streamN(R	Rtrich_root_dataRRtIncompatibleRepositoriesRRRRt_get_sourcet
get_streamRt
insert_streamtget_stream_for_missing_keystAssertionErrorR"(RtsearchR#tsourcetstreamtfrom_formatt
resume_tokenstmissing_keys((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyR!ls@

	
	

	
cC@s•|jdk	r|jS|jtkr/tjƒS|jdk	rltj|j|j|jgd|j	ƒj
ƒStj|j|jd|j	ƒj
ƒSdS(sÿDetermines the exact revisions needed from self.from_repository to
        install self._last_revision in self.to_repository.

        :returns: A SearchResult of some sort.  (Possibly a
            PendingAncestryResult, EmptySearchResult, etc.)
        RN(R
tNoneRRt	vf_searchtEmptySearchResulttNotInOtherForRevsRR	RtexecutetEverythingNotInOther(R((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyR˜s
	N(	t__name__t
__module__t__doc__R3tTrueRRR!R(((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyR.s		,tInter1and2HelpercB@s8eZdZdZd„Zd„Zd„Zd„ZRS(spHelper for operations that convert data from model 1 and 2

    This is for use by fetchers and converters.
    idcC@s
||_dS(sLConstructor.

        :param source: The repository data comes from
        N(R.(RR.((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyR¹scc@stt|ƒ}xa|roxJ|jj|d ƒD]2}|jjdkrY|jƒ|j_n|Vq,W|d}qWdS(sIterate through RevisionTrees efficiently.

        Additionally, the inventory's revision_id is set if unset.

        Trees are retrieved in batches of 100, and then yielded in the order
        they were requested.

        :param revs: A list of revision ids
        idN(tlistR.trevision_treestroot_inventorytrevision_idR3tget_revision_id(Rtrevsttree((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pytiter_rev_treesÀs		c
C@sÞi}x?|j|ƒD].}|jƒ}|j|dƒ}|||<qWtƒ}x!|jƒD]}	|j|	ƒq^W|j|jƒtgƒ|j	|ƒjƒ}x3|j|ƒD]"}|jƒ}|||j
ƒ<q´W|S(Nu(REtget_root_idtget_file_revisiontsett
itervaluesRtdifference_updatetkeysRtget_parent_mapRB(
RRCt
parent_maptgrapht
revision_rootRDtroot_idRAtparentstrevision_parents((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyt_find_root_idsÓs	c	C@sÐ|jjƒ}|j|ƒ}tj|ƒ}|j|||ƒ}g|D]}|||f^qI}|jdtjdƒƒt	|ƒ|j
kr¨|jj|ƒ}nt||||j|ƒ}d|fgS(saGenerate VersionedFiles for all root ids.

        :param revs: the revisions to include
        tkeyittexts(
R.t	get_graphRLttsortt	topo_sortRStsorttoperatort
itemgettertlentknown_graph_thresholdtget_known_graph_ancestryt_new_root_data_stream(	RRCRNRMt	rev_ordertrev_id_to_root_idtrev_idt
root_id_ordertnew_roots_stream((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pytgenerate_root_textsås (R9R:R;R]RRERSRe(((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyR=°s			c	c@sSxL|D]D}|\}}t||||||ƒ}tj||ddƒVqWdS(s9Generate a texts substream of synthesised root entries.

    Used in fetches that do rich-root upgrades.
    
    :param root_keys_to_create: iterable of (root_id, rev_id) pairs describing
        the root entries to create.
    :param rev_id_to_root_id_map: dict of known rev_id -> root_id mappings for
        calculating the parents.  If a parent rev_id is not found here then it
        will be recalculated.
    :param parent_map: a parent map for all the revisions in
        root_keys_to_create.
    :param graph: a graph to use instead of repo.get_graph().
    tN(t_parent_keys_for_root_versiont
versionedfiletFulltextContentFactoryR3(	troot_keys_to_createtrev_id_to_root_id_mapRMtrepoRNtroot_keyRPRbtparent_keys((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyR_ýs
cC@s•||}g}xö|D]î}|tkr/qn||kr„y|j|ƒ}	Wntjk
rjd}
n
X|	jƒ}
d||<n
||}
||
krª|j|ƒqy|j|ƒ}	Wntjk
rÓqXy|j|	j|ƒƒWqtjk
rqXqW|dkr$|j	ƒ}n|j
|ƒ}g}x6|D].}||kr@||kr@|j|ƒq@q@Wg|D]}||f^qy}
|
S(scGet the parent keys for a given root id.
    
    A helper function for _new_root_data_stream.
    N(Rt
revision_treeRtNoSuchRevisionR3RFtappendRGtNoSuchIdRVtheads(RPRbRkRMRlRNtrev_parentst
parent_idst	parent_idRDtparent_root_idRstselected_idsRn((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyRgs@





tTargetRepoKindscB@s eZdZdZdZdZRS(spAn enum-like set of constants.
    
    They are the possible values of FetchSpecFactory.target_repo_kinds.
    tpreexistingtstackedtempty(R9R:R;tPREEXISTINGtSTACKEDtEMPTY(((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyRyRstFetchSpecFactorycB@s)eZdZd„Zd„Zd„ZRS(s•A helper for building the best fetch spec for a sprout call.

    Factors that go into determining the sort of fetch to perform:
     * did the caller specify any revision IDs?
     * did the caller specify a source branch (need to fetch its
       heads_to_fetch(), usually the tip + tags)
     * is there an existing target repo (don't need to refetch revs it
       already has)
     * target is stacked?  (similar to pre-existing target repo: even if
       the target itself is new don't want to refetch existing revs)

    :ivar source_branch: the source branch if one specified, else None.
    :ivar source_branch_stop_revision_id: fetch up to this revision of
        source_branch, rather than its tip.
    :ivar source_repo: the source repository if one found, else None.
    :ivar target_repo: the target repository acquired by sprout.
    :ivar target_repo_kind: one of the TargetRepoKinds constants.
    cC@sFtƒ|_d|_d|_d|_d|_d|_d|_dS(N(	RHt_explicit_rev_idsR3t
source_branchtsource_branch_stop_revision_idtsource_repottarget_repottarget_repo_kindtlimit(R((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyRqs					cC@s|jj|ƒdS(s:Add revision_ids to the set of revision_ids to be fetched.N(RR(Rtrevision_ids((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pytadd_revision_idszsc		C@s|jdks|jdkr7td|jfƒ‚nt|jƒdkrº|jdkrº|jdk	ryt	dƒ‚n|jt
jkr›tj
|jƒStj|j|jƒjƒSnt|jƒ}|jdk	r5|jjƒ\}}|jdk	r%|j|jjƒƒ|j|jƒn|j|ƒn	tƒ}|jt
jkrÓ|j|ƒ}tj||jƒ}|jdk	rÏ|jjƒ}t|j|jƒƒƒ}||j }|jj|ƒ}n|Stj|j|jd|d|d|jƒjƒSdS(s5Build a SearchResult or PendingAncestryResult or etc.sIncomplete FetchSpecFactory: %ris0limit is only supported with a source branch settrequired_idstif_present_idsR‡N( R†R3R„R,t__dict__R\RR‚R‡tNotImplementedErrorRyRR4tEverythingResultR8R…R7RHtheads_to_fetchRƒtdiscardRtaddRtuniontPendingAncestryResultRVR>titer_topo_ordertget_keystrevision_ids_to_search_resultR6(	RRt
must_fetchtif_present_fetcht	all_headstretRNt
topo_ordert
result_set((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pytmake_fetch_spec~s>$	
(R9R:R;RR‰R(((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyR€]s			(R;t
__future__RRZtbzrlib.lazy_importRtglobalstbzrlibRRtbzrlib.i18nRtbzrlib.revisionRtbzrlib.traceRtobjectRR=R3R_RgRyR€(((s0/usr/lib/python2.7/dist-packages/bzrlib/fetch.pyt<module>s	‚N=

Copyright © 2017 || Recoded By Mr.Bumblebee