-=[ Mr. Bumblebee ]=-
_Indonesia_

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


6u0Oc@@sddlmZddlmZddlZddlmZejeddefdYZde	j
fd	YZd
efdYZdefd
YZ
defdYZdejfdYZeZeje
ejeejeddS(i(tabsolute_import(tStringION(tlazy_imports
from bzrlib import (
    branch as _mod_branch,
    diff,
    email_message,
    errors,
    gpg,
    hooks,
    registry,
    revision as _mod_revision,
    rio,
    testament,
    timestamp,
    trace,
    )
from bzrlib.bundle import (
    serializer as bundle_serializer,
    )
tMergeRequestBodyParamscB@seZdZddZRS(s1Parameter object for the merge_request_body hook.c		C@sL||_||_||_||_||_||_||_||_dS(N(tbodyt	orig_bodyt	directivetbranchttreettotbasenametsubject(	tselfRRRR	R
RRR((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyt__init__/s							N(t__name__t
__module__t__doc__tNoneR
(((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR,stMergeDirectiveHookscB@seZdZdZRS(s!Hooks for MergeDirective classes.cC@s-tjj|dd|jddddS(	Nsbzrlib.merge_directivesBaseMergeDirective.hookstmerge_request_bodysCalled with a MergeRequestBodyParams when a body is needed for a merge request.  Callbacks must return a body.  If more than one callback is registered, the output of one callback is provided to the next.iii(iii(thookstHooksR
tadd_hook(R((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR
>s	(RRRR
(((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR;stBaseMergeDirectivecB@seZdZeZeZdddddZdZ	dZ
dZedZdZ
edddddZd	Zed
ZedZdZed
ZdZddZRS(s
A request to perform a merge into a branch.

    This is the base class that all merge directive implementations 
    should derive from.

    :cvar multiple_output_files: Whether or not this merge directive 
        stores a set of revisions in more than one file
    c

C@sL||_||_||_||_||_||_||_||_dS(sConstructor.

        :param revision_id: The revision to merge
        :param testament_sha1: The sha1 of the testament of the revision to
            merge.
        :param time: The current POSIX timestamp time
        :param timezone: The timezone offset
        :param target_branch: Location of branch to apply the merge to
        :param patch: The text of a diff or bundle
        :param source_branch: A public location to merge the revision from
        :param message: The message to use when committing this merge
        N(trevision_idttestament_sha1ttimettimezonet
target_branchtpatcht
source_branchtmessage(
RRRRRRRRRtbundle((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR
Us							cC@st|jdS(sGSerialize as a list of lines

        :return: a list of lines
        N(tNotImplementedErrortto_lines(R((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR"mscC@st|jdS(sjSerialize as a set of files.

        :return: List of tuples with filename and contents as lines
        N(R!tto_files(R((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR#tscC@sdS(spReturn the bundle for this merge directive.

        :return: bundle text or None if there is no bundle
        N(R(R((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pytget_raw_bundle{sc	C@stj|j|j}tjd|jd|d|jd|j}x;dD]3}|j	|dk	rL|j||j	|qLqLW|r|jd|jnd|j
d	g}|jtj||jd
|S(
sGSerialize as a list of lines

        :return: a list of lines
        Rt	timestampRRRRtbase_revision_ids# s
s# 
(s
source_branchsmessageN(R%tformat_patch_dateRRtriotStanzaRRRt__dict__RtaddR&t_format_stringtextendtto_patch_linestappend(Rt
base_revisionttime_strtstanzatkeytlines((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyt	_to_liness	

cC@st|jdS(szWrite this merge directive to a series of files in a directory.

        :param path: Filesystem path to write to
        N(R!twrite_to_directory(Rtpath((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR6sR c

C@s|}
|tjkrd}
ntjj||
}|dkrTtjj|}n|}|j	dk	r{|j	}n|dkrd}
n|j
}tj|}|j|j
||j}|j||}i|jd6|jd6dd6}|||||}
|dk	rj|dkrjtjj|}|j
j|sjtj||qjn|||j||||
|||		S(sGenerate a merge directive from various objects

        :param repository: The repository containing the revision
        :param revision_id: The revision to merge
        :param time: The POSIX timestamp of the date the request was issued.
        :param timezone: The timezone of the request
        :param target_branch: The url of the branch to merge into
        :param patch_type: 'bundle', 'diff' or None, depending on the type of
            patch desired.
        :param local_target_branch: the submit branch, either itself or a local copy
        :param public_branch: location of a public branch containing
            the target revision.
        :param message: Message to use when committing the merge
        :return: The merge directive

        The public branch is always used if supplied.  If the patch_type is
        not 'bundle', the public branch must be supplied, and will be verified.

        If the message is not supplied, the message from revision_id will be
        used for the commit.
        R tdiffcS@sdS(N(R(txtytz((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyt<lambda>sN(t
_mod_revisiont
NULL_REVISIONRt	testamenttStrictTestament3t
from_revisiont_mod_branchtBranchtopentget_public_brancht
last_revisiontensure_nulltfetcht
repositoryt	get_graphtfind_unique_lcat_generate_bundlet_generate_diffthas_revisionterrorstPublicBranchOutOfDatetas_sha1(tklassRIRRRRt
patch_typetlocal_target_brancht
public_branchRt
t_revision_idttt
submit_branchRtsubmit_revision_idtgraphtancestor_idttype_handlertpublic_branch_obj((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pytfrom_objectss:				



		cC@s|j\}}|j|kr-|g}n|jj|jdg}tjdd|jjd}d|djd|DfS(sGenerate a suitable basename for storing this directive on disk

        :param branch: The Branch this merge directive was generated fro
        :return: A string
        tmerges(\W+)t-s%s-%st.cs@s|]}t|VqdS(N(tstr(t.0tn((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pys	<genexpr>s(	tlast_revision_infoRtget_revision_id_to_revno_maptgettretsubtnicktstriptjoin(RRtrevnoRRj((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyt
get_disk_names!cC@sP|j|}|j|}t}tj|||dddd|jS(Nt	old_labeltt	new_label(t
revision_treeRR8tshow_diff_treestgetvalue(RIRR[ttree_1ttree_2ts((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyRMs
	cC@s)t}tj|||||jS(N(Rtbundle_serializertwrite_bundleRt(RIRR[Rw((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyRLs	
cC@s1tj|j}|jdj|jS(sSerialize as a signed string.

        :param branch: The source branch, to get the signing strategy
        :return: a string
        Rp(tgpgtGPGStrategytget_config_stacktsignRlR"(RRtmy_gpg((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyt	to_signedsc	C@s|jjd}|jdk	r0|j}n|jj|j}|j}|rf|j|}ndj|j	}t
j||||}|S(s!Serialize as an email message.

        :param mail_to: The address to mail the message to
        :param branch: The source branch, to get the signing strategy and
            source email address
        :param sign: If True, gpg-sign the email
        :return: an email message
        temailRpN(R|RgRRRItget_revisionRRRlR"t
email_messagetEmailMessage(	Rtmail_toRR}t	mail_fromRtrevisionRR((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pytto_emails			cC@s|j|js|jdkrtjt|j}y|j|dtWqt	j
k
rytjj
|j}Wn&t	jk
rt	j|jnXg}td|jD}xQ|jD]F}x=|jD]2}||kr|j|r|j|qqWqWg}t}	x@t|D]2}||	krOq7n|j||	j|q7Wx!|D]}
|j|j|
qtW|j|dtqXqtjj
|j}|j|j|jn|jS(s0Install revisions and return the target revisionR tstream_inputcs@s|]}|jVqdS(N(R(Rctr((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pys	<genexpr>(s(RNRRSRxtread_bundleRR$tinstall_revisionstFalseROtRevisionNotPresentRBRCRDRtNotBranchErrortTargetNotBranchtsettreal_revisionst
parent_idsR/treversedR+RHRIR(Rttarget_repotinfoRXtmissing_revisionstbundle_revisionsRt	parent_idtunique_missingtunique_missing_settmissing_revisionR((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyRsB		

c
C@s|j|}d}|jdk	r4||j7}n%|jj|j}||j7}t|dtr|}	xw|j	dD]3}
t
||	||||||}|
|}qWn2t|j	ddkrtj
d|jjn|j||dj|j||dS(sjCompose a request to merge this directive.

        :param mail_client: The mail client to use for composing this request.
        :param to: The address to compose the request to.
        :param branch: The Branch that was used to produce this directive.
        :param tree: The Tree (if any) for the Branch used to produce this
            directive.
        s[MERGE] t
supports_bodyRis[Cannot run merge_request_body hooks because mail client %s does not support message bodies.RpN(RnRRRIRRtget_summarytgetattrRRRtlenttracetwarningt	__class__Rtcompose_merge_requestRlR"(Rtmail_clientR	RRRR
RRRthooktparams((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR@s&			N(RRRRRRtmultiple_output_filesRR
R"R#R$R5R6tclassmethodR^RntstaticmethodRMRLRRRR(((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyRGs(					8				+tMergeDirectivecB@seZdZdZddddddZdZdZdZe	eZ
edZedZ
dZed	Zd
ZRS(s%A request to perform a merge into a branch.

    Designed to be serialized and mailed.  It provides all the information
    needed to perform a merge automatically, by providing at minimum a revision
    bundle or the location of a branch.

    The serialization format is robust against certain common forms of
    deterioration caused by mailing.

    The format is also designed to be patch-compatible.  If the directive
    includes a diff or revision bundle, it should be possible to apply it
    directly using the standard patch program.
    sBazaar merge directive format 1c
C@stj|||||||||		|dkr@t|n|dkrg|dkrgtjn|dk	r|dkrtj|n||_dS(s}Constructor.

        :param revision_id: The revision to merge
        :param testament_sha1: The sha1 of the testament of the revision to
            merge.
        :param time: The current POSIX timestamp time
        :param timezone: The timezone offset
        :param target_branch: Location of the branch to apply the merge to
        :param patch: The text of a diff or bundle
        :param patch_type: None, "diff" or "bundle", depending on the contents
            of patch
        :param source_branch: A public location to merge the revision from
        :param message: The message to use when committing this merge
        R8R N(Nsdiffsbundle(RR
Rt
ValueErrorROt
NoMergeSourcetPatchMissingRS(RRRRRRRRSRRR ((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR
rscC@sd|_d|_dS(N(RRRS(R((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyt
clear_payloads	cC@s|jS(N(R (R((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR$scC@s|jdkr|jSdSdS(NR (RSRR(R((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyt_bundlescC@swt|}d}xO|D]G}|jdrNtj|djj|S|p]|j}qWtj|dS(sDeserialize a MergeRequest from an iterable of lines

        :param lines: An iterable of lines
        :return: a MergeRequest
        Rps # Bazaar merge directive format iN(	titert
startswitht_format_registryRgtrstript_from_linesRkROtNotAMergeDirective(RRR4t	line_itert	firstlinetline((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyt
from_liness
c

C@s-tj|}t|}t|dkr<d}d}nXdj|}ytjt|Wn)t	j
t	jt	jfk
rd}nXd}t
j|jd\}}i}x9dD]1}	y|j|	||	<Wqtk
rqXqW|djd|d<td|d
|d|d||S(NiRpR8R R%RRRRRsutf-8RRRSR(srevision_idstestament_sha1s
target_branchs
source_branchsmessage(R(tread_patch_stanzatlistRRRlRxRRROt
NotABundletBundleNotSupportedt	BadBundleR%tparse_patch_dateRgtKeyErrortencodeR(
RRRR2tpatch_linesRRSRRtkwargsR3((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyRs.	



cC@s;|j}|jdk	r7|j|jjtn|S(N(R5RRR-t
splitlinestTrue(RR4((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR"scC@s,t}tj||||d|jS(Ns0.9(RRxRyRt(RIRR[Rw((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyRLs	
cC@sd|jdfS(s}Provide data for performing a merge

        Returns suggested base, suggested target, and patch verification status
        tinapplicableN(RR(RRI((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pytget_merge_requestsN(RRRR,RR
RR$RtpropertyR RRRR"RRLR(((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR`s				tMergeDirective2cB@seZdZddddddZdZeeZdZdZ	e
dZdZe
e
e
dddddZdZd	Zd
ZRS(s-Bazaar merge directive format 2 (Bazaar 0.90)c
C@sb|dkr'|	dkr'tjntj|||||||||	|	|_|
|_dS(N(RRORRR
R R&(RRRRRRRRRR R&((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR
s	cC@s.|jdk	rdS|jdk	r&dSdSdS(NR R8(R RR(R((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyt_patch_types
cC@sd|_d|_dS(N(RRR (R((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyRs	cC@s'|jdkrdS|jjdSdS(Nsbase-64(R Rtdecode(R((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR$sc
C@stj|}d}d}y|j}Wntk
r>nX|jdrg}x:|D],}|jdrz|}Pn|j|q[Wd}dj|}n|dk	r|jdrdj|}qtj	|nt
j|jd\}}	i}
x9dD]1}y|j||
|<Wq
t
k
r=q
Xq
W|
djd|
d<|
d
jd|
d
<|d|d
|	d|d||
S(Ns
# Begin patchs# Begin bundleRpR%RRRRRR&sutf-8RRRR (srevision_idstestament_sha1s
target_branchs
source_branchsmessagesbase_revision_id(R(RRtnextt
StopIterationRR/RlROtIllegalMergeDirectivePayloadR%RRgRR(RRRR2RR tstartRRRRRR3((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyRs@



cC@s|jdt}|jdk	rJ|jd|j|jjtn|jdk	r|jd|j|jjtn|S(NR0s# Begin patch
s# Begin bundle
(R5RRRR/R-RR (RR4((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR"&s

cC@s?g}z|j|j||}
|dkr;d}
ntjj||
}|dkrqtjj|}n|}|j	|j||j
dk	r|j
}n|j}tj
|}|j|j}|j||}|dkr|}n||fttfkr1|j|j|n|rO|j|||}nd}|r||j|||jd}nd}|	dk	r|rtjj|	}|j	|j||jj|stj|	|qn|j}Wdxt|D]}|jqWX||||||||	|
||
S(s	Generate a merge directive from various objects

        :param repository: The repository containing the revision
        :param revision_id: The revision to merge
        :param time: The POSIX timestamp of the date the request was issued.
        :param timezone: The timezone of the request
        :param target_branch: The url of the branch to merge into
        :param include_patch: If true, include a preview patch
        :param include_bundle: If true, include a bundle
        :param local_target_branch: the target branch, either itself or a local copy
        :param public_branch: location of a public branch containing
            the target revision.
        :param message: Message to use when committing the merge
        :return: The merge directive

        The public branch is always used if supplied.  If no bundle is
        included, the public branch must be supplied, and will be verified.

        If the message is not supplied, the message from revision_id will be
        used for the commit.
        snull:sbase-64N(t
lock_writeR/RR?R@RARBRCRDt	lock_readRERFR=RGRJRIRKRRHRMRLRRNRORPRQRtunlock(RRRIRRRRt
include_patchtinclude_bundleRTRURR&tlockedRVRWRXRYRZR[RR R]Rtentry((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyR^0s^

		

			

			cC@s||j||j|j}tjdd|j}tjdd|}tjdd|}tjdd|}||kS(Ns
?s
s *
(RMRR&RhRiR(RRItcalculated_patchtstored_patch((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyt
_verify_patchscC@s"|j|}|j|j|fS(s}Provide data for performing a merge

        Returns suggested base, suggested target, and patch verification status
        (t
_maybe_verifyR&R(RRItverified((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyRscC@s1|jdk	r)|j|r"dSdSndSdS(NRtfailedR(RRR(RRI((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyRs
N(RRR,RR
RRRSRR$RRR"RR^RRR(((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyRs 				'	
	L		tMergeDirectiveFormatRegistrycB@seZddZRS(cC@s2|dkr|j}ntjj|||dS(N(RR,tregistrytRegistrytregister(RRt
format_string((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyRsN(RRRR(((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyRss-Bazaar merge directive format 2 (Bazaar 0.19)(t
__future__RRRhtbzrlibRtglobalstobjectRRRRRRRRRRRR(((s:/usr/lib/python2.7/dist-packages/bzrlib/merge_directive.pyt<module>s"}	

	

Copyright © 2017 || Recoded By Mr.Bumblebee