-=[ Mr. Bumblebee ]=-
_Indonesia_

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


:Nc@@sdZddlmZddlmZddlmZddlZddlZddlm	Z	ddl
mZeeddd	l
mZdd
lmZeZejddfd
dejddfd
dejddfd
dejddfd
dejddfd
dejddfd
ddefdYZdefdYZdefdYZdefdYZdefd YZd!Zd"efd#YZd$efd%YZd&efd'YZd(efd)YZd*efd+YZd,efd-YZd.efd/YZ d0e fd1YZ!d2e fd3YZ"d4e"fd5YZ#d6Z$d7efd8YZ%d9e%fd:YZ&d;e%fd<YZ'd=e%fd>YZ(d?efd@YZ)dAe)fdBYZ*dCe%fdDYZ+dEefdFYZ,dGZ-dHefdIYZ.dJZ/dKZ0dLZ1dMZ2dNefdOYZ3dS(Ps Versioned text file storage api.i(tabsolute_import(tcopy(tStringION(tadler32(tlazy_imports
from bzrlib import (
    annotate,
    bencode,
    errors,
    graph as _mod_graph,
    groupcompress,
    index,
    knit,
    osutils,
    multiparent,
    tsort,
    revision,
    urlutils,
    )
(tRegistry(t	TextMerges
knit-delta-gztfulltextsbzrlib.knittDeltaPlainToFullTexts
knit-ft-gztFTPlainToFullTextsknit-annotated-delta-gztDeltaAnnotatedToUnannotatedtDeltaAnnotatedToFullTextsknit-annotated-ft-gztFTAnnotatedToUnannotatedtFTAnnotatedToFullTexttContentFactorycB@seZdZdZRS(sAbstract interface for insertion and retrieval from a VersionedFile.

    :ivar sha1: None, or the sha1 of the content fulltext.
    :ivar storage_kind: The native storage kind of this factory. One of
        'mpdiff', 'knit-annotated-ft', 'knit-annotated-delta', 'knit-ft',
        'knit-delta', 'fulltext', 'knit-annotated-ft-gz',
        'knit-annotated-delta-gz', 'knit-ft-gz', 'knit-delta-gz'.
    :ivar key: The key of this content. Each key is a tuple with a single
        string in it.
    :ivar parents: A tuple of parent keys for self.key. If the object has
        no parent information, None (as opposed to () for an empty list of
        parents).
    cC@s(d|_d|_d|_d|_dS(sCreate a ContentFactory.N(tNonetsha1tstorage_kindtkeytparents(tself((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt__init__Ps			(t__name__t
__module__t__doc__R(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRAs
tChunkedContentFactorycB@s eZdZdZdZRS(sStatic data content factory.

    This takes a 'chunked' list of strings. The only requirement on 'chunked' is
    that ''.join(lines) becomes a valid fulltext. A tuple of a single string
    satisfies this, as does a list of lines.

    :ivar sha1: None, or the sha1 of the content fulltext.
    :ivar storage_kind: The native storage kind of this factory. Always
        'chunked'
    :ivar key: The key of this content. Each key is a tuple with a single
        string in it.
    :ivar parents: A tuple of parent keys for self.key. If the object has
        no parent information, None (as opposed to () for an empty list of
        parents).
     cC@s1||_d|_||_||_||_dS(sCreate a ContentFactory.tchunkedN(RRRRt_chunks(RRRRtchunks((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRis
				cC@sN|dkr|jS|dkr/dj|jStj|j||jdS(NRRt(RtjointerrorstUnavailableRepresentationRR(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytget_bytes_asqs(RRRRR!(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRXs	tFulltextContentFactorycB@s eZdZdZdZRS(s$Static data content factory.

    This takes a fulltext when created and just returns that during
    get_bytes_as('fulltext').

    :ivar sha1: None, or the sha1 of the content fulltext.
    :ivar storage_kind: The native storage kind of this factory. Always
        'fulltext'.
    :ivar key: The key of this content. Each key is a tuple with a single
        string in it.
    :ivar parents: A tuple of parent keys for self.key. If the object has
        no parent information, None (as opposed to () for an empty list of
        parents).
     cC@s1||_d|_||_||_||_dS(sCreate a ContentFactory.RN(RRRRt_text(RRRRttext((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs
				cC@sK||jkr|jS|dkr,|jgStj|j||jdS(NR(RR#RR R(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR!s
(RRRRR!(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR"zs	tAbsentContentFactorycB@s eZdZdZdZRS(sA placeholder content factory for unavailable texts.

    :ivar sha1: None.
    :ivar storage_kind: 'absent'.
    :ivar key: The key of this content. Each key is a tuple with a single
        string in it.
    :ivar parents: None.
    cC@s(d|_d|_||_d|_dS(sCreate a ContentFactory.tabsentN(RRRRR(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs			cC@std|jfdS(NsyA request was made for key: %s, but that content is not available, and the calling code does not handle if it is missing.(t
ValueErrorR(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR!s(RRRRR!(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR%s	tAdapterFactorycB@s eZdZdZdZRS(s0A content factory to adapt between key prefix's.cC@s||_||_||_dS(s#Create an adapter factory instance.N(RRt_adapted(RRRtadapted((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs		cC@s+|dkr|j|St|j|SdS(s(Return a member from the adapted object.RRN(skeysparents(t__dict__tgetattrR)(Rtattr((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt__getattr__s(RRRRR.(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR(s	cc@s,x%|D]}|jdkr|VqqWdS(s/Adapt a record stream to remove absent records.R&N(R(t
record_streamtrecord((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt
filter_absents
t_MPDiffGeneratorcB@sDeZdZdZdZdZdZdZdZRS(s3Pull out the functionality for generating mp_diffs.cC@sR||_t||_d|_i|_i|_d|_i|_i|_dS(N(((	tvfttupletordered_keystneeded_keystdiffst
parent_mapt
ghost_parentst	refcountsR(RR3tkeys((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs						c
C@sMt|j}|jj|}||_|j|}|ratjt|d|jni}|j	}t}xh|j
D]Z\}}|sqn|j||j|x%|D]}	||	dd||	<qWqW|j|t|jj||_
|j|j
|_|j|j||_||_||fS(sFind the set of keys we need to request.

        This includes all the original keys passed in, and the non-ghost
        parents of those keys.

        :return: (needed_keys, refcounts)
            needed_keys is the set of all texts we need to extract
            refcounts is a dict of {key: num_children} letting us know when we
                no longer need to cache a given parent text
        ii(tsetR5R3tget_parent_mapR8t
differenceRtRevisionNotPresenttlistt
setdefaultt	iteritemstupdatetdifference_updatetpresent_parentsR9R6R:(
RR6R8tmissing_keysR:RAtjust_parentst	child_keytparent_keystp((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt_find_needed_keyss.	"		



		cC@s`t|dkr1|jj||d|}nd}tjj|||}||j|<dS(s5Compute a single mp_diff, and store it in self._diffsiN(tlenR3t_extract_blocksRtmultiparenttMultiParentt
from_linesR7(RRtparent_linestlinestleft_parent_blockstdiff((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt
_compute_diffsc
C@s4d}||jkr|jj|}|dkr<d}ng}x|D]}||jkrdqIn|j|}|dkr|jj||jj|}n|d|j|<|j|}tj|}|j|~qIWtj|}	|	}|j	|||	~	n||jkr0||j|<ndS(Ni((
RR8tpopR9R:Rtosutilstchunks_to_linestappendRU(
RRtthis_chunksRIRQRJtrefcountt
parent_chunkstp_linesRR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt_process_one_records0	



cC@s|j\}}xf|jj|dtD]L}|jdkr[tj|j|jn|j|j|j	dq+WdS(NttopologicalR&R(
RKR3tget_record_streamtTrueRRR?RR^R!(RR6R:R0((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt_extract_diffs@scC@s6|j|jj}g|jD]}||^q S(N(RbR7RVR5(Rtdpoptk((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt
compute_diffsIs
(	RRRRRKRUR^RbRe(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR2s		,		&		t
VersionedFilecB@sLeZdZedZdZdZdZdZddde
edZdZ
dde
eddZd	Zdd
ZdZdZd
ZdZdZdZdZeZdZdZdZedZdZdZdZdZ dddZ!dZ"e#j$e#j%dZ&RS(sVersioned text file storage.

    A versioned file manages versions of line-based text files,
    keeping track of the originating version for each line.

    To clients the "lines" of the file are represented as a list of
    strings. These strings will typically have terminal newline
    characters, but this is not required.  In particular files commonly
    do not have a newline at the end of the file.

    Texts are identified by a version-id string.
    cC@stj|dS(N(trevisiontcheck_not_reserved_id(t
version_id((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRh]scC@st|jdS(s.Copy this versioned file to name on transport.N(tNotImplementedErrortcopy_to(Rtnamet	transport((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRkascC@st|jdS(sGet a stream of records for versions.

        :param versions: The versions to include. Each version is a tuple
            (version,).
        :param ordering: Either 'unordered' or 'topological'. A topologically
            sorted stream has compression parents strictly before their
            children.
        :param include_delta_closure: If True then the closure across any
            compression parents will be included (in the data content of the
            stream, not in the emitted records). This guarantees that
            'fulltext' can be used successfully on every record.
        :return: An iterator of ContentFactory objects, each of which is only
            valid until the iterator is advanced.
        N(RjR`(Rtversionstorderingtinclude_delta_closure((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR`escC@st|jdS(s#Returns whether version is present.N(Rjthas_version(RRi((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRqvscC@s
tdS(sInsert a record stream into this versioned file.

        :param stream: A stream of records to insert.
        :return: None
        :seealso VersionedFile.get_record_stream:
        N(Rj(Rtstream((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytinsert_record_streamzsc			C@s,|j|j||||||||S(s	Add a single text on top of the versioned file.

        Must raise RevisionAlreadyPresent if the new version is
        already present in file history.

        Must raise RevisionNotPresent if any of the given parents are
        not present in file history.

        :param lines: A list of lines. Each line must be a bytestring. And all
            of them except the last must be terminated with 
 and contain no
            other 
's. The last line may either contain no 
's or a single
            terminated 
. If the lines list does meet this constraint the add
            routine may error or may succeed - but you will be unable to read
            the data back accurately. (Checking the lines have been split
            correctly is expensive and extremely unlikely to catch bugs so it
            is not done at runtime unless check_content is True.)
        :param parent_texts: An optional dictionary containing the opaque
            representations of some or all of the parents of version_id to
            allow delta optimisations.  VERY IMPORTANT: the texts must be those
            returned by add_lines or data corruption can be caused.
        :param left_matching_blocks: a hint about which areas are common
            between the text and its left-hand-parent.  The format is
            the SequenceMatcher.get_matching_blocks format.
        :param nostore_sha: Raise ExistingContent and do not add the lines to
            the versioned file if the digest of the lines matches this.
        :param random_id: If True a random id has been selected rather than
            an id determined by some deterministic process such as a converter
            from a foreign VCS. When True the backend may choose not to check
            for uniqueness of the resulting key within the versioned file, so
            this should only be done when the result is expected to be unique
            anyway.
        :param check_content: If True, the lines supplied are verified to be
            bytestrings that are correctly formed lines.
        :return: The text sha1, the number of bytes in the text, and an opaque
                 representation of the inserted version which can be provided
                 back to future add_lines calls in the parent_texts dictionary.
        (t_check_write_okt
_add_lines(	RRiRRRtparent_textstleft_matching_blockstnostore_shat	random_idt
check_content((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt	add_liness(
c		C@st|jdS(s*Helper to do the class specific add_lines.N(RjR{(	RRiRRRRvRwRxRyRz((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRusc			C@s,|j|j||||||||S(sAdd lines to the versioned file, allowing ghosts to be present.

        This takes the same parameters as add_lines and returns the same.
        (Rtt_add_lines_with_ghosts(	RRiRRRRvRxRyRzRw((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytadd_lines_with_ghostss
c		C@st|jdS(s2Helper to do class specific add_lines_with_ghosts.N(RjR}(	RRiRRRRvRxRyRzRw((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR|scC@st|jdS(s'Check the versioned file for integrity.N(Rjtcheck(Rtprogress_bar((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR~scC@s6x/|D]'}|jtk	rtjdqqWdS(sACheck that lines being added to a versioned file are not unicode.RRN(t	__class__tstrRtBzrBadParameterUnicode(RRRtline((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt_check_lines_not_unicodes
cC@s7x0|D](}d|d krtjdqqWdS(s>Check that the lines really are full lines without inline EOL.s
iRRN(RtBzrBadParameterContainsNewline(RRRR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt_check_lines_are_liness
cC@st|jdS(sXGet a text description of the data encoding in this file.

        :since: 0.90
        N(Rjtget_format_signature(R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRscC@syt}|j||j|}xI|D]A}y|j||Wq,tk
rltj||q,Xq,Wt|j|j}tt||j	|}g}x|D]}||}y1g||D]}||kr||^q}	Wn#tk
rtj||nXt
|	dkrL|j||	d|}
nd}
|j
tjj||	|
qW|S(s0Create multiparent diffs for specified versions.iN(R<RCR=tKeyErrorRR?R;tdicttzipt_get_lf_split_line_listRLRMRRYRNRORP(Rtversion_idst
knit_versionsR8RiRRR7ttargetRJRRS((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytmake_mpdiffss4	


	


	cC@sdS(N(R(RRitsourceR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRMsc@s,i}tjg}x:|D]2\}}}}|j|j|||qWt}x7|D]/\}}}}|jfd|DqeWt|j|j}	x9t|	|j	|	D]\}
}j
||
gqWxt|j|D]\\}}}}}t|dkr`t
|jdj|dj}nd}y+|j||||d|\}
}
}Wn8tk
r|j||||d|\}
}
}nX|||<qW|j|}x<|D]4\}}}}|||krtj|qqWdS(sAdd mpdiffs to this VersionedFile.

        Records should be iterables of version, parents, expected_sha1,
        mpdiff. mpdiff should be a MultiParent instance.
        c3@s$|]}j|s|VqdS(N(Rq(t.0RJ(tmpvf(s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pys	<genexpr>siiRwN(RNtMultiMemoryVersionedFileRYtadd_diffR<RCR=R;RRtadd_versiont
get_line_listRLR@tget_matching_blockstget_difft	num_linesRR}RjR{t	get_sha1sRtVersionedFileInvalidChecksum(Rtrecordst
vf_parentsRntversiont
parent_idst
expected_sha1tmpdifftneeded_parentsREt	parent_idRRRwt_tversion_texttsha1s((Rs8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytadd_mpdiffss@
	!	."	
	cC@sdj|j|S(sReturn version contents as a text string.

        Raises RevisionNotPresent if version is not present in
        file history.
        R(Rt	get_lines(RRi((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytget_text1scC@s)g|D]}dj|j|^qS(sReturn the texts of listed versions as a list of strings.

        Raises RevisionNotPresent if version is not present in
        file history.
        R(RR(RRtv((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt	get_texts:scC@st|jdS(sReturn version contents as a sequence of lines.

        Raises RevisionNotPresent if version is not present in
        file history.
        N(RjR(RRi((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRBscC@s,g|j|D]}t|j^qS(N(RRt	readlines(RRtt((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRJscC@s.t|tr|g}nt|jdS(s-Return a list of all ancestors of given version(s). This
        will not include the null revision.

        This list will not be topologically sorted if topo_sorted=False is
        passed.

        Must raise RevisionNotPresent if any of the given versions are
        not present in file history.N(t
isinstancet
basestringRjtget_ancestry(RRttopo_sorted((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRMs	cC@st|jdS(sIReturn a list of all ancestors of given version(s). This
        will not include the null revision.

        Must raise RevisionNotPresent if any of the given versions are
        not present in file history.

        Ghosts that are known about will be included in ancestry list,
        but are not explicitly marked.
        N(Rjtget_ancestry_with_ghosts(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRZs
cC@st|jdS(sGet a map of the parents of version_ids.

        :param version_ids: The version ids to look up parents for.
        :return: A mapping from version id to parents.
        N(RjR=(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR=fscC@sHyt|j|g|SWn#tk
rCtj||nXdS(sReturn version names for parents of version_id.

        Will raise RevisionNotPresent if version_id is not present
        in the history.

        Ghosts that are known about will be included in the parent list,
        but are not explicitly marked.
        N(R@R=RRR?(RRi((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytget_parents_with_ghostsns	
cC@st|jdS(sReturn a list of (version-id, line) tuples for version_id.

        :raise RevisionNotPresent: If the given version is
        not present in file history.
        N(Rjtannotate(RRi((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR|scC@st|jdS(sIterate over the lines in the versioned file from version_ids.

        This may return lines from other versions. Each item the returned
        iterator yields is a tuple of a line and a text version that that line
        is present in (not introduced in).

        Ordering of results is in whatever order is most suitable for the
        underlying storage format.

        If a progress bar is supplied, it may be used to indicate progress.
        The caller is responsible for cleaning up progress bars (because this
        is an iterator).

        NOTES: Lines are normalised: they will all have 
 terminators.
               Lines are returned in arbitrary order.

        :return: An iterator over (line, version_id).
        N(Rjt'iter_lines_added_or_present_in_versions(RRtpb((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRscC@sttjdS(sReturn pseudo-annotation indicating how the two versions merge.

        This is computed between versions a and b and their common
        base.

        Weave lines present in none of them are skipped entirely.

        Legend:
        killed-base Dead in base revision
        killed-both Killed in each revision
        killed-a    Killed in a
        killed-b    Killed in b
        unchanged   Alive in both a and b (possibly created in both)
        new-a       Created in a
        new-b       Created in b
        ghost-a     Killed in a, unborn in b
        ghost-b     Killed in b, unborn in a
        irrelevant  Not in either revision
        N(RjRft
plan_merge(Rtver_atver_b((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRscC@st|||jdS(Ni(tPlanWeaveMergetmerge_lines(Rtplanta_markertb_marker((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytweave_mergesN('RRRtstaticmethodRhRkR`RqRsRtFalseRaR{RuR}R|R~RRRRRMRRt
get_stringRRRRRR=RRRRRtA_MARKERtB_MARKERR(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRfOsF						*								'		,				
					t RecordingVersionedFilesDecoratorcB@sheZdZdZd	d	d	eedZdZdZ	dZ
dZd	dZdZ
RS(
sA minimal versioned files that records calls made on it.

    Only enough methods have been added to support tests using it to date.

    :ivar calls: A list of the calls made; can be reset at any time by
        assigning [] to it.
    cC@s||_g|_dS(sCreate a RecordingVersionedFilesDecorator decorating backing_vf.

        :param backing_vf: The versioned file to answer all methods.
        N(t_backing_vftcalls(Rt
backing_vf((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs	c		
C@sP|jjd||||||||f	|jj||||||||S(NR{(RRYRR{(	RRRRRRvRwRxRyRz((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR{scC@s|jjdS(N(RR~(R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR~scC@s,|jjdt|f|jj|S(NR=(RRYRRR=(RR;((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR=scC@s8|jjdt|||f|jj|||S(NR`(RRYR@RR`(RR;t
sort_orderRp((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR`s
cC@s,|jjdt|f|jj|S(NR(RRYRRR(RR;((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRscC@s2|jjdt|f|jj|d|S(Nt#iter_lines_added_or_present_in_keysR(RRYRRR(RR;R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRscC@s|jjd|jjS(NR;(skeys(RRYRR;(R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR;sN(RRRRRRRaR{R~R=R`RRR;(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs						tOrderingVersionedFilesDecoratorcB@s eZdZdZdZRS(sA VF that records calls, and returns keys in specific order.

    :ivar calls: A list of the calls made; can be reset at any time by
        assigning [] to it.
    cC@stj||||_dS(sCreate a RecordingVersionedFilesDecorator decorating backing_vf.

        :param backing_vf: The versioned file to answer all methods.
        :param key_priority: A dictionary defining what order keys should be
            returned from an 'unordered' get_record_stream request.
            Keys with lower priority are returned first, keys not present in
            the map get an implicit priority of 0, and are returned in
            lexicographical order.
        N(RRt
_key_priority(RRtkey_priority((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs
c#@sjjdt|||f|dkrfd}xpt|d|D]1}x(jj|gd|D]}|VqrWqPWn(x%jj|||D]}|VqWdS(NR`t	unorderedc@sjj|d|fS(Ni(Rtget(R(R(s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytsort_keysR(RRYR@tsortedRR`(RR;RRpRRR0((Rs8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR`s

(RRRRR`(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs	
t	KeyMappercB@s eZdZdZdZRS(s?KeyMappers map between keys and underlying partitioned storage.cC@st|jdS(sMap key to an underlying storage identifier.

        :param key: A key tuple e.g. ('file-id', 'revision-id').
        :return: An underlying storage identifier, specific to the partitioning
            mechanism.
        N(Rjtmap(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRscC@st|jdS(sMap a partitioned storage id back to a key prefix.

        :param partition_id: The underlying partition id.
        :return: As much of a key (or prefix) as is derivable from the partition
            id.
        N(Rjtunmap(Rtpartition_id((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs(RRRRR(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs		tConstantMappercB@s eZdZdZdZRS(s,A key mapper that maps to a constant result.cC@s
||_dS(s>Create a ConstantMapper which will return result for all maps.N(t_result(Rtresult((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR'scC@s|jS(sSee KeyMapper.map().(R(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR+s(RRRRR(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR$s	tURLEscapeMappercB@s eZdZdZdZRS(sBase class for use with transport backed storage.

    This provides a map and unmap wrapper that respectively url escape and
    unescape their outputs and inputs.
    cC@stj|j|S(sSee KeyMapper.map().(turlutilstquotet_map(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR7scC@s|jtj|S(sSee KeyMapper.unmap().(t_unmapRtunquote(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR;s(RRRRR(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR0s	tPrefixMappercB@s eZdZdZdZRS(syA key mapper that extracts the first component of a key.

    This mapper is for use with a transport based backend.
    cC@s|dS(sSee KeyMapper.map().i((RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRFscC@s|fS(sSee KeyMapper.unmap().((RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRJs(RRRRR(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR@s	tHashPrefixMappercB@s2eZdZdZdZdZdZRS(sA key mapper that combines the first component of a key with a hash.

    This mapper is for use with a transport based backend.
    cC@s+|j|d}dt|d@|fS(sSee KeyMapper.map().is%02x/%si(t_escapeR(RRtprefix((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRUscC@s|S(sNo escaping needed here.((RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRZscC@s|jtj|fS(sSee KeyMapper.unmap().(t	_unescapeRWtbasename(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR^scC@s|S(s*No unescaping needed for HashPrefixMapper.((RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRbs(RRRRRRR(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyROs
			tHashEscapedPrefixMappercB@s&eZdZdZdZdZRS(s{Combines the escaped first component of a key with a hash.

    This mapper is for use with a transport based backend.
    s)abcdefghijklmnopqrstuvwxyz0123456789-_@,.cC@sEg|D]+}||jkr"|p/dt|^q}dj|S(sTurn a key element into a filesystem safe string.

        This is similar to a plain urlutils.quote, except
        it uses specific safe characters, so that it doesn't
        have to translate a lot of valid file ids.
        s%%%02xR(t_safetordR(RRtctr((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRos
5cC@s
tj|S(s/Escaped names are easily unescaped by urlutils.(RR(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR}s(RRRRRR(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRgs	c@sfd}|S(sCreate a ThunkedVersionedFiles factory.

    This will create a callable which when called creates a
    ThunkedVersionedFiles on a transport, using mapper to access individual
    versioned files, and versioned_file_factory to create each individual file.
    c@st|dS(NcS@stS(N(Ra(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt<lambda>s(tThunkedVersionedFiles(Rm(tmappertversioned_file_factory(s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytfactorys((RRR((RRs8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytmake_versioned_files_factorystVersionedFilescB@seZdZdddeedZdedZdZdZ	ddZ
edZdZ
dZd	Zd
ZdZdZd
ZejZdZdZddZdZdZdZejZdZdZ RS(sStorage for many versioned files.

    This object allows a single keyspace for accessing the history graph and
    contents of named bytestrings.

    Currently no implementation allows the graph of different key prefixes to
    intersect, but the API does allow such implementations in the future.

    The keyspace is expressed via simple tuples. Any instance of VersionedFiles
    may have a different length key-size, but that size will be constant for
    all texts added to or retrieved from it. For instance, bzrlib uses
    instances with a key-size of 2 for storing user files in a repository, with
    the first element the fileid, and the second the version of that file.

    The use of tuples allows a single code base to support several different
    uses with only the mapping logic changing from instance to instance.

    :ivar _immediate_fallback_vfs: For subclasses that support stacking,
        this is a list of other VersionedFiles immediately underneath this
        one.  They may in turn each have further fallbacks.
    c		C@st|jdS(sAdd a text to the store.

        :param key: The key tuple of the text to add. If the last element is
            None, a CHK string will be generated during the addition.
        :param parents: The parents key tuples of the text to add.
        :param lines: A list of lines. Each line must be a bytestring. And all
            of them except the last must be terminated with 
 and contain no
            other 
's. The last line may either contain no 
's or a single
            terminating 
. If the lines list does meet this constraint the add
            routine may error or may succeed - but you will be unable to read
            the data back accurately. (Checking the lines have been split
            correctly is expensive and extremely unlikely to catch bugs so it
            is not done at runtime unless check_content is True.)
        :param parent_texts: An optional dictionary containing the opaque
            representations of some or all of the parents of version_id to
            allow delta optimisations.  VERY IMPORTANT: the texts must be those
            returned by add_lines or data corruption can be caused.
        :param left_matching_blocks: a hint about which areas are common
            between the text and its left-hand-parent.  The format is
            the SequenceMatcher.get_matching_blocks format.
        :param nostore_sha: Raise ExistingContent and do not add the lines to
            the versioned file if the digest of the lines matches this.
        :param random_id: If True a random id has been selected rather than
            an id determined by some deterministic process such as a converter
            from a foreign VCS. When True the backend may choose not to check
            for uniqueness of the resulting key within the versioned file, so
            this should only be done when the result is expected to be unique
            anyway.
        :param check_content: If True, the lines supplied are verified to be
            bytestrings that are correctly formed lines.
        :return: The text sha1, the number of bytes in the text, and an opaque
                 representation of the inserted version which can be provided
                 back to future add_lines calls in the parent_texts dictionary.
        N(RjR{(	RRRRRRvRwRxRyRz((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR{s%c
C@s.|j||tj|d|d|dtS(s(Add a text to the store.

        This is a private function for use by VersionedFileCommitBuilder.

        :param key: The key tuple of the text to add. If the last element is
            None, a CHK string will be generated during the addition.
        :param parents: The parents key tuples of the text to add.
        :param text: A string containing the text to be committed.
        :param nostore_sha: Raise ExistingContent and do not add the lines to
            the versioned file if the digest of the lines matches this.
        :param random_id: If True a random id has been selected rather than
            an id determined by some deterministic process such as a converter
            from a foreign VCS. When True the backend may choose not to check
            for uniqueness of the resulting key within the versioned file, so
            this should only be done when the result is expected to be unique
            anyway.
        :param check_content: If True, the lines supplied are verified to be
            bytestrings that are correctly formed lines.
        :return: The text sha1, the number of bytes in the text, and an opaque
                 representation of the inserted version which can be provided
                 back to future _add_text calls in the parent_texts dictionary.
        RxRyRz(R{RWtsplit_linesRa(RRRR$RxRy((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt	_add_textsc@si}tjg}x:|D]2\}}}}|j|j|||qWt}x7|D]/\}}}}|jfd|DqeWtj}	xW|j|dt	D]@}
|
j
dkrqnj|	|
jd|
j
gqWxt|j|D]\\}}}}}
t|dkrlt|jdj|dj}nd}|j|||
|d|\}}}||krtj|n|||<qWdS(	sAdd mpdiffs to this VersionedFile.

        Records should be iterables of version, parents, expected_sha1,
        mpdiff. mpdiff should be a MultiParent instance.
        c3@s$|]}j|s|VqdS(N(Rq(RRJ(R(s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pys	<genexpr>sRR&RiiRwN(RNRRYRR<RCRWRXR`RaRRR!RRRRLR@RRRRR{RR(RRRRnRRRRRRXR0RRIRRRwtversion_sha1RR((Rs8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs8
	!	
."	cC@st|jdS(sReturn a list of (version-key, line) tuples for the text of key.

        :raise RevisionNotPresent: If the key is not present.
        N(RjR(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRscC@st|jdS(sCheck this object for integrity.
        
        :param progress_bar: A progress bar to output as the check progresses.
        :param keys: Specific keys within the VersionedFiles to check. When
            this parameter is not None, check() becomes a generator as per
            get_record_stream. The difference to get_record_stream is that
            more or deeper checks will be performed.
        :return: None, or if keys was supplied a generator as per
            get_record_stream.
        N(RjR~(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR~scC@stj|dS(N(RgRh(Ri((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRh&scC@sdS(sClear whatever caches this VersionedFile holds.

        This is generally called after an operation has been performed, when we
        don't expect to be using this versioned file again soon.
        N((R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytclear_cache*scC@s6x/|D]'}|jtk	rtjdqqWdS(sACheck that lines being added to a versioned file are not unicode.RRN(RRRR(RRRR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR1s
cC@s7x0|D](}d|d krtjdqqWdS(s>Check that the lines really are full lines without inline EOL.s
iRRN(RR(RRRR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR7s
cC@s|t|}i}xT|rh|j|}|j|t}t|j|j|j|}qWtj|}|S(s4Get a KnownGraph instance with the ancestry of keys.(R<R=RCRt
itervaluesR>t
_mod_grapht
KnownGraph(RR;tpendingR8tthis_parent_maptkg((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytget_known_graph_ancestry=s	
	cC@st|jdS(sGet a map of the parents of keys.

        :param keys: The keys to look up parents for.
        :return: A mapping from keys to parents. Absent keys are absent from
            the mapping.
        N(RjR=(RR;((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR=KscC@st|jdS(sGet a stream of records for keys.

        :param keys: The keys to include.
        :param ordering: Either 'unordered' or 'topological'. A topologically
            sorted stream has compression parents strictly before their
            children.
        :param include_delta_closure: If True then the closure across any
            compression parents will be included (in the opaque data).
        :return: An iterator of ContentFactory objects, each of which is only
            valid until the iterator is advanced.
        N(RjR`(RR;RoRp((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR`TscC@st|jdS(sGet the sha1's of the texts for the given keys.

        :param keys: The names of the keys to lookup
        :return: a dict from key to sha1 digest. Keys of texts which are not
            present in the store are not present in the returned
            dictionary.
        N(RjR(RR;((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRbscC@st|jdS(sReturn an iterable of keys of missing compression parents.

        Check this after calling insert_record_stream to find out if there are
        any missing compression parents.  If there are, the records that
        depend on them are not able to be inserted safely. The precise
        behaviour depends on the concrete VersionedFiles class in use.

        Classes that do not support this will raise NotImplementedError.
        N(Rjt#get_missing_compression_parent_keys(R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRns
cC@s
tdS(sInsert a record stream into this container.

        :param stream: A stream of records to insert.
        :return: None
        :seealso VersionedFile.get_record_stream:
        N(Rj(RRr((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRszscC@st|jdS(sIterate over the lines in the versioned files from keys.

        This may return lines from other keys. Each item the returned
        iterator yields is a tuple of a line and a text version that that line
        is present in (not introduced in).

        Ordering of results is in whatever order is most suitable for the
        underlying storage format.

        If a progress bar is supplied, it may be used to indicate progress.
        The caller is responsible for cleaning up progress bars (because this
        is an iterator).

        NOTES:
         * Lines are normalised by the underlying store: they will all have 

           terminators.
         * Lines are returned in arbitrary order.

        :return: An iterator over (line, key).
        N(RjR(RR;R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRscC@st|jdS(s:Return a iterable of the keys for all the contained texts.N(RjR;(R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR;scC@st||}|jS(s,Create multiparent diffs for specified keys.(R2Re(RR;t	generator((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRscC@s
tj|S(N(Rt	Annotator(R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt
get_annotatorscC@sdS(N(R(RRiRR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRMscC@s>g}x1|jD]&}|j||j|jqW|S(sReturn the whole stack of fallback versionedfiles.

        This VersionedFiles may have a list of fallbacks, but it doesn't
        necessarily know about the whole stack going down, and it can't know
        at open time because they may change after the objects are opened.
        (t_immediate_fallback_vfsRYtextendt_transitive_fallbacks(Rt
all_fallbacksta_vfs((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs

N(!RRRRRRaR{RRRR~RRhRRRRR=R`Rtindext_has_key_from_parent_mapthas_keyRRsRR;RRt_missing_keys_from_parent_mapRFRMR(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs4	%	'	
								
									RcB@seZdZdZdddeedZdZdddZ	dZ
dZdZdZ
d	Zd
ZdZdZdd
ZdZdZRS(sUStorage for many versioned files thunked onto a 'VersionedFile' class.

    This object allows a single keyspace for accessing the history graph and
    contents of named bytestrings.

    Currently no implementation allows the graph of different key prefixes to
    intersect, but the API does allow such implementations in the future.
    cC@s(||_||_||_||_dS(sCreate a ThunkedVersionedFiles.N(t
_transportt
_file_factoryt_mappert
_is_locked(RRmtfile_factoryRt	is_locked((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs			c	
C@sn|jj|}	|d}
g|D]}|d^q#}|j|	}y{y5|j|
||d|d|d|d|d|SWn?tk
r|j|
||d|d|d|d|d|SXWntjk
ri|jj	t
j|	y5|j|
||d|d|d|d|d|SWqjtk
re|j|
||d|d|d|d|d|SXnXdS(sSee VersionedFiles.add_lines().iRvRwRxRyRzN(RRt_get_vfR}RjR{Rt
NoSuchFileR	tmkdirRWtdirname(
RRRRRRvRwRxRyRztpathRitparentR3((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR{s>


c	C@sy|d }|jj|}|j|}|j|d}g}x.|D]&\}}|j||f|fqKW|S(sReturn a list of (version-key, line) tuples for the text of key.

        :raise RevisionNotPresent: If the key is not present.
        i(RRRRRY(	RRRRR3toriginsRtoriginR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs
cC@sJx$|jD]\}}|jq
W|dk	rF|j|dtSdS(sSee VersionedFiles.check().RN(t_iter_all_componentsR~RR`Ra(RRR;RR3((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR~sc
@s|j|}i}x|jD]\}|jj}|j|}|j|}xA|jD]3\}}	tfd|	D||f<qkWq"W|S(sGet a map of the parents of keys.

        :param keys: The keys to look up parents for.
        :return: A mapping from keys to parents. Absent keys are absent from
            the mapping.
        c3@s|]}|fVqdS(N((RR(R(s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pys	<genexpr>s(t_partition_keystitemsRRRR=R4(
RR;tprefixesRtsuffixesRR3R8RR((Rs8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR=s,cC@s@|jstj|n|j||jdtddS(Ntcreatet	get_scopecS@sdS(N(R(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs(RRtObjectNotLockedR
R	Ra(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRscC@sBi}x5|D]-}|j|d g}|j|dq
W|S(s,Turn keys into a dict of prefix:suffix_list.i(RARY(RR;RRtprefix_keys((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs

cC@st|jtkr6|jjdg}dg}nyt}x<|jjD]+}tjj	|\}}|j
|qOWt|}g|D]}|jj|^q}t
||S(N(((ttypeRRRR<R	titer_files_recursivetosRtsplitexttaddR@RR(RtpathsRtrelpathstquoted_relpathRtext((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt_get_all_prefixes's	%c#@st|}x|j|D]\}}g|D]}|f^q2}xf|j|||D]O}|jdk	rtfd|jD|_n|j|_|Vq]WqWdS(s'See VersionedFiles.get_record_stream().c3@s|]}|VqdS(N((RR(R(s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pys	<genexpr>AsN(Rt
_iter_keys_vfR`RRR4R(RR;RoRpRR3tsuffixR0((Rs8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR`6s
"cc@se|j|}i}xI|jD];\}}|jj|}|j|}|||fVq"WdS(N(RRRRR(RR;RRRRRR3((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR*Esc	C@sji}x]|j|D]L\}}}|j|}x+|jD]\}}||||f<qAWqW|S(sSee VersionedFiles.get_sha1s().(R*RRB(	RR;RRRR3tvf_sha1sR+R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRMsc
C@sx|D]}|jd }|jd}|jdk	rYg|jD]}|d^q@}nd}t|||}|jj|}|j|}	|	j|gqWdS(sInsert a record stream into this container.

        :param stream: A stream of records to insert.
        :return: None
        :seealso VersionedFile.get_record_stream:
        iN(RRRR(RRRRs(
RRrR0RRRRtthunk_recordRR3((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRsVs


#cc@sYxR|j|D]A\}}}x/|j|D]\}}|||ffVq/WqWdS(sIterate over the lines in the versioned files from keys.

        This may return lines from other keys. Each item the returned
        iterator yields is a tuple of a line and a text version that that line
        is present in (not introduced in).

        Ordering of results is in whatever order is most suitable for the
        underlying storage format.

        If a progress bar is supplied, it may be used to indicate progress.
        The caller is responsible for cleaning up progress bars (because this
        is an iterator).

        NOTES:
         * Lines are normalised by the underlying store: they will all have 

           terminators.
         * Lines are returned in arbitrary order.

        :return: An iterator over (line, key).
        N(R*R(RR;RRRR3RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRlscc@s5x.|jD] \}}||j|fVq
WdS(N(R)R(RRR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRscC@sUt}xE|jD]7\}}x(|jD]}|j||fq/WqW|S(sSee VersionedFiles.keys().(R<RRnR$(RRRR3R+((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR;s
	N(RRRRRRRaR{RR~R=RRR)R`R*RRsRRR;(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs$		#	
										tVersionedFilesWithFallbackscB@s#eZdZdZdZRS(cC@st|jdS(s?Return a clone of this object without any fallbacks configured.N(Rjtwithout_fallbacks(R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR/scC@st|jdS(s~Add a source of texts for texts not present in this knit.

        :param a_versioned_files: A VersionedFiles object.
        N(Rjtadd_fallback_versioned_files(Rta_versioned_files((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR0scC@sw|jj|\}}xI|jD];}|s5Pn|jj|\}}|j||}q%Wtj|}|S(s4Get a KnownGraph instance with the ancestry of keys.(t_indext
find_ancestryRRCRR(RR;R8RFtfallbacktf_parent_maptf_missing_keysR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs	

(RRR/R0R(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR.s		t_PlanMergeVersionedFilecB@sJeZdZdZddZddZdZdZdZ	RS(sA VersionedFile for uncommitted and committed texts.

    It is intended to allow merges to be planned with working tree texts.
    It implements only the small part of the VersionedFiles interface used by
    PlanMerge.  It falls back to multiple versionedfiles for data not stored in
    _PlanMergeVersionedFile itself.

    :ivar: fallback_versionedfiles a list of VersionedFiles objects that can be
        queried for missing texts.
    cC@s@||_g|_i|_i|_tj|jg|_dS(sCreate a _PlanMergeVersionedFile.

        :param file_id: Used with _PlanMerge code which is not yet fully
            tuple-keyspace aware.
        N(t_file_idtfallback_versionedfilest_parentst_linesRtDictParentsProvidert
_providers(Rtfile_id((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs
				cC@sddlm}|dkr;|||||jfjSt|||||jfj}t|||||jfj}|j||S(sSee VersionedFile.plan_mergei(t
_PlanMergeN(tbzrlib.mergeR?RR8RR@t_subtract_plans(RRRtbaseR?told_plantnew_plan((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs''cC@sddlm}tj|}|||||jf|j}|dkrS|S|||||jf|j}|jt|t|S(Ni(t
_PlanLCAMerge(	R@RERtGraphR8RRRAR@(RRRRBREtgraphRDRC((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytplan_lca_merges$$cC@st|tk	r!t|ntj|dsCtdn|dkr^tdn|dkrytdnt||j|<||j|<dS(sSee VersionedFiles.add_lines

        Lines are added locally, not to fallback versionedfiles.  Also, ghosts
        are permitted.  Only reserved ids are permitted.
        isOnly reserved ids may be usedsParents may not be NonesLines may not be NoneN(	R R4t	TypeErrorRgtis_reserved_idR'RR:R;(RRRRR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR{sc
c@st|}x[|D]S}||jkr|j|}|j|}|j|t||d|VqqWxe|jD]Z}xG|j|dtD]0}	|	j	dkrqq|j|	j
|	VqW|stdSqtWx|D]}t|VqWdS(NRR&(R<R;R:tremoveRRR9R`RaRRR%(
RR;RoRpRRRRRt
versionedfileR0((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR`s$



		
cC@st|}i}tj|krA|jtjd|tj<n|jd |j|_|jtj|jj	|x9|j
D]+\}}|dkrtjf||<qqW|S(s!See VersionedFiles.get_parent_mapi(((R<Rgt
NULL_REVISIONRKR=R9RCRtStackedParentsProviderR=RB(RR;RRR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR=sN(
RRRRRRRHR{R`R=(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR7s
					RcB@s5eZdZejejdZdZdZRS(sWeave merge that takes a plan as its input.

    This exists so that VersionedFile.plan_merge is implementable.
    Most callers will want to use WeaveMerge instead.
    cC@s&tj|||t||_dS(N(RRR@R(RRRR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRsc#@sggtfd}x|jD]u\}}|dkrx|D]}|VqZWggtn|dkr|r|gfVqq8|dkrtj|q8|dkrtj|q8|dkrtj|q8|dkr-tj|q8|dkrStj|q8|dkrytj|q8|d	krtq8|dkr8t|q8q8Wx|D]}|VqWdS(Nc3@shrrdSr*r*fVn:rBrBfVn"krYfVnfVdS(N(((tch_atch_btlines_atlines_b(s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytoutstanding_struct's

t	unchangedskilled-askilled-bsnew-asnew-bsconflicted-asconflicted-bskilled-botht
irrelevantsghost-asghost-bskilled-base(RUsghost-asghost-bskilled-base(RRRaRYtAssertionError(RRStstateRtstruct((RORPRQRRs8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt
_merge_struct"sN
	



	c
C@sbg}xU|jD]J\}}|dkr8|j|q|dkrtd
|fqqW|S(s)Construct a BASE file from the plan text.skilled-askilled-bskilled-bothRTskilled-baseRUsghost-asghost-bsnew-asnew-bsconflicted-asconflicted-bsUnknown state: %s(skilled-askilled-bskilled-boths	unchanged(skilled-bases
irrelevantsghost-asghost-bsnew-asnew-bsconflicted-asconflicted-b(RRYRV(Rt
base_linesRWR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytbase_from_plan`s	'(	RRRRRRRRYR[(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs
	>t
WeaveMergecB@s#eZdZejejdZRS(sEWeave merge that takes a VersionedFile and two versions as its input.cC@s,|j||}tj||||dS(N(RRR(RRLRRRRR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs(RRRRRRR(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR\stVirtualVersionedFilescB@sSeZdZdZddZdZdZdZdZ	ddZ
RS(	sDummy implementation for VersionedFiles that uses other functions for
    obtaining fulltexts and parent maps.

    This is always on the bottom of the stack and uses string keys
    (rather than tuples) internally.
    cC@s)tt|j||_||_dS(sCreate a VirtualVersionedFiles.

        :param get_parent_map: Same signature as Repository.get_parent_map.
        :param get_lines: Should return lines for specified key or None if
                          not available.
        N(tsuperR]Rt_get_parent_mapt
_get_lines(RR=R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs	cC@stS(saSee VersionedFiles.check.

        :note: Always returns True for VirtualVersionedFiles.
        (Ra(Rtprogressbar((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR~scC@st|jdS(s_See VersionedFiles.mpdiffs.

        :note: Not implemented for VirtualVersionedFiles.
        N(RjR(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRscC@smtg|jg|D]\}|^qjD]7\}}|ftg|D]}|f^qKf^q/S(s"See VersionedFiles.get_parent_map.(RR_RBR4(RR;RdRRJ((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR=scC@sji}x]|D]U\}|j|}|dk	r
t|tsItntj|||f<q
q
W|S(sSee VersionedFiles.get_sha1s.N(R`RRR@RVRWtsha_strings(RR;tretRdRR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs	cc@sxt|D]s\}|j|}|dk	rrt|tsItnt|fddtj|d|Vq
t|fVq
WdS(s%See VersionedFiles.get_record_stream.RRN(	R@R`RRRVRRWRbR%(RR;RoRpRdRR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR`s	cc@sqxjt|D]\\}\}|dk	rD|jd|t|nx"|j|D]}||fVqTWq
WdS(s<See VersionedFile.iter_lines_added_or_present_in_versions().sFinding changed linesN(t	enumerateRRCRLR`(RR;RtiRtl((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs
N(RRRRRR~RR=RR`R(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR]s					
tNoDupeAddLinesDecoratorcB@s8eZdZdZdddeedZdZRS(sdDecorator for a VersionedFiles that skips doing an add_lines if the key
    is already present.
    cC@s
||_dS(N(t_store(Rtstore((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRsc	
C@s|rtdn|dd	krDtj|}	d|	f}nd	}	||jj|gkr|	d	krtj|}	n|	ttt|d	fS|jj	|||d|d|d|d|d|S(
sSee VersionedFiles.add_lines.
        
        This implementation may return None as the third element of the return
        value when the original store wouldn't.
        sONoDupeAddLinesDecorator.add_lines does not implement the nostore_sha behaviour.issha1:RvRwRxRyRzN(
RjRRWRbRhR=tsumRRLR{(
RRRRRRvRwRxRyRzR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR{s cC@st|j|S(N(R,Rh(RRl((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR.sN(	RRRRRRRaR{R.(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRgs		cC@s'|jd}|| }||dfS(sStrip of a record kind from the front of network_bytes.

    :param network_bytes: The bytes of a record.
    :return: A tuple (storage_kind, offset_of_remaining_bytes)
    s
i(tfind(t
network_bytestline_endR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt network_bytes_to_kind_and_offsets
tNetworkRecordStreamcB@s eZdZdZdZRS(s8A record_stream which reconstitures a serialised stream.cC@sY||_itd6tjd6tjd6tjd6tjd6tjd6tjd6|_dS(	sCreate a NetworkRecordStream.

        :param bytes_iterator: An iterator of bytes. Each item in this
            iterator should have been obtained from a record_streams'
            record.get_bytes_as(record.storage_kind) call.
        Rsgroupcompress-blocks
knit-ft-gzs
knit-delta-gzsknit-annotated-ft-gzsknit-annotated-delta-gzsknit-delta-closureN(t_bytes_iteratortfulltext_network_to_recordt
groupcompresstnetwork_block_to_recordstknittknit_network_to_recordtknit_delta_closure_to_recordst
_kind_factory(Rtbytes_iterator((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs	




cc@sSxL|jD]A}t|\}}x&|j||||D]}|Vq<Wq
WdS(sbRead the stream.

        :return: An iterator as per VersionedFiles.get_record_stream().
        N(RpRnRw(RtbytesRRmR0((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytread/s

(RRRRRz(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRos	cC@stjd|||d!\}||d|d|!}tj|\}}|dkrcd}n||d|}t||d|gS(s,Convert a network fulltext record to record.s!LitnilN(RXtunpacktbencodetbdecode_as_tupleRR"(tkindRyRmtmeta_lentrecord_metaRRR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRq;s 	cC@stjdt|S(Ns!L(RXtpackRL(Ry((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt_length_prefixFscC@s_|jdkrd}n	|j}tj|j|f}|jd}dt|||fS(NR{Rsfulltext
%s%s%s(RRR}RR!R(R0RRtrecord_content((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytrecord_to_fulltext_bytesJs		cC@si}x|jD]z}|d}t|tsDt|dkrMd}n
|d}y||j|Wqtk
r|g||<qXqWg}x4t|D]&}|jtt	j
||qW|S(sSort and group the keys in parent_map into groupcompress order.

    groupcompress is defined (currently) as reverse-topological order, grouped
    by the key prefix.

    :return: A sorted-list of keys
    iiR(RBRRRLRYRRRtreversedttsortt	topo_sort(R8tper_prefix_maptitemRRtpresent_keys((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytsort_groupcompressUs

!	

$t_KeyRefscB@s\eZedZdZdZdZdZdZdZ	dZ
dZRS(	cC@s+i|_|rt|_n	d|_dS(N(trefsR<tnew_keysR(Rttrack_new_keys((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRss	cC@s6|jr|jjn|jr2|jjndS(N(RtclearR(R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyR|s		cC@shxT|D]L}y|j|}Wn%tk
rEt}|j|<nX|j|qW|j|dS(N(RRR<R$tadd_key(RRRt
referencedt	needed_by((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytadd_referencess

cC@s|jS(N(R(R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytget_new_keysscC@s
|jjS(N(Rtiterkeys(R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytget_unsatisfied_refsscC@s&y|j|=Wntk
r!nXdS(N(RR(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt_satisfy_refs_for_keys
cC@s3|j||jdk	r/|jj|ndS(N(RRRR$(RR((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRs
cC@s"x|D]}|j|qWdS(N(R(RR;R((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pytsatisfy_refs_for_keyss
cC@s4t}x$|jjD]}|j|qW|S(N(R<RRRC(RRt	referrers((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt
get_referrerss	(RRRRRRRRRRRR(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyRqs								(4Rt
__future__RRt	cStringIORR"RXtzlibRtbzrlib.lazy_importRtglobalstbzrlib.registryRtbzrlib.textmergeRtadapter_registryt
register_lazytobjectRRR"R%R(R1R2RfRRRRRRRRRRRR.R7RR\R]RgRnRoRqRRRR(((s8/usr/lib/python2.7/dist-packages/bzrlib/versionedfile.pyt<module>st		



"!	g3&	
+i	G(	!				

Copyright © 2017 || Recoded By Mr.Bumblebee