-=[ Mr. Bumblebee ]=-
_Indonesia_

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

ó
¦îNc@@srddlmZddlmZmZmZmZmZmZddl	Z	dZ
d„Zd„Zd„Z
dd"d	„ƒYZd
efd„ƒYZdefd
„ƒYZdefd„ƒYZdZdZd„ZdZdd#d„ƒYZed„Zdefd„ƒYZdefd„ƒYZed„Zed„Zd„Zed„Zd„Zd „Z d!„Z!dS($i(tabsolute_import(tBinaryFilestMalformedHunkHeadert
MalformedLinetMalformedPatchHeadert
PatchConflicttPatchSyntaxNs"Binary files (.*) and (.*) differ
cC@sy†|jƒ}tjt|ƒ}|dk	rQt|jdƒ|jdƒƒ‚n|jdƒsrtd|ƒ‚n|dj	dƒ}Wn t
k
r¨tddƒ‚nXyA|jƒ}|jd	ƒsÖtd
ƒ‚n|dj	dƒ}Wn t
k
rtddƒ‚nX||fS(Niis--- sNo orig nameis
sNo orig linets+++ sNo mod namesNo mod line(tnexttretmatchtbinary_files_retNoneRtgroupt
startswithRtrstript
StopIterationR(t
iter_linestlineR
t	orig_nametmod_name((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pytget_patch_names"s$$

cC@sb|jdƒ}t|ƒdkr4|d}d}n|\}}t|ƒ}t|ƒ}||fS(sÀParse a patch range, handling the "1" special-case

    :param textrange: The text to parse
    :type textrange: str
    :return: the position and range, as a tuple
    :rtype: (int, int)
    t,iit1(tsplittlentint(t	textrangettmptpostrange((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pytparse_range9s
	cC@sqddl}|jd|ƒ}|dkr<td|ƒ‚ny"|jdƒjdƒ\}}Wn.ttfk
rŽ}tt|ƒ|ƒ‚nX|j	dƒs¯|j	dƒrÁtd|ƒ‚ny0t
|dƒ\}}t
|dƒ\}}	Wn.ttfk
r!}tt|ƒ|ƒ‚nX|	dks:|dkrLtd	|ƒ‚n|jd
ƒ}
t||||	|
ƒS(Nis\@\@ ([^@]*) \@\@( (.*))?\nsDoes not match format.it t-t+s"Positions don't start with + or -.sHunk range is negativei(R	R
RRR
Rt
ValueErrort
IndexErrortstrRRtHunk(RR	tmatchestorigtmodtetorig_post
orig_rangetmod_post	mod_rangettail((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pythunk_from_headerLs&" tHunkLinecB@seZd„Zd„ZRS(cC@s
||_dS(N(tcontents(tselfR2((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyt__init__cscC@sY|jdkr%|dkr%tr%dS|jjdƒsDdt}nd}||j|S(Ns
R R(R2tFalsetendswithtNO_NL(R3tleadchart
terminator((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pytget_strfs!
(t__name__t
__module__R4R:(((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR1bs	tContextLinecB@seZd„Zd„ZRS(cC@stj||ƒdS(N(R1R4(R3R2((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR4qscC@s
|jdƒS(NR (R:(R3((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyt__str__ts(R;R<R4R>(((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR=ps	t
InsertLinecB@seZd„Zd„ZRS(cC@stj||ƒdS(N(R1R4(R3R2((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR4yscC@s
|jdƒS(NR"(R:(R3((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR>|s(R;R<R4R>(((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR?xs	t
RemoveLinecB@seZd„Zd„ZRS(cC@stj||ƒdS(N(R1R4(R3R2((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR4scC@s
|jdƒS(NR!(R:(R3((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR>„s(R;R<R4R>(((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR@€s	s\ No newline at end of file
sno-returnvaluescC@sƒ|jdƒrt|ƒS|jdƒr6t|dƒS|jdƒrSt|dƒS|jdƒrpt|dƒStd|ƒ‚dS(Ns
R iR"R!sUnknown line type(RR=R?R@R(R((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyt
parse_lineŠs
RR&cB@sAeZdd„Zd„Zd„Zd„Zd„Zd„ZRS(cC@s:||_||_||_||_||_g|_dS(N(R+R,R-R.R/tlines(R3R+R,R-R.R/((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR4™s					cC@sZ|jdkrd}n
d|j}d|j|j|jƒ|j|j|jƒ|fS(NRR s@@ -%s +%s @@%s
(R/Rt	range_strR+R,R-R.(R3ttail_str((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyt
get_header¡s	
		cC@s&|dkrd|Sd||fSdS(sReturn a file range, special-casing for 1-line files.

        :param pos: The position in the file
        :type pos: int
        :range: The range in the file
        :type range: int
        :return: a string in the format 1,4 except when range == pos == 1
        is%is%i,%iN((R3RR((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyRC¬s	cC@sC|jƒg}x$|jD]}|jt|ƒƒqWdj|ƒS(NR(RERBtappendR%tjoin(R3RBR((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR>ºscC@sL||jdkrdS||j|jkr;|j|jS|j|ƒSdS(Nii(R+R,R.tshift_to_mod_lines(R3R((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pytshift_to_modÀs
cC@s©|jd}d}x|jD]„}t|tƒr?|d7}nRt|tƒru||kr^dS|d8}|d7}nt|tƒr‘|d7}n||krPqqW|S(Nii(R+RBt
isinstanceR?R@RR=(R3RtpositiontshiftR((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyRHÈs




N(	R;R<RR4RERCR>RIRH(((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR&˜s				cc@s7d}x|D]}|dkr?|dk	r
|Vd}q
q
n|dk	rS|Vnyt|ƒ}Wntk
rƒ|r}dS‚nXd}d}xˆ||jks±||jkrt|jƒƒ}|jj|ƒt	|t
tfƒrõ|d7}nt	|ttfƒr“|d7}q“q“Wq
W|dk	r3|VndS(s"
    :arg iter_lines: iterable of lines to parse for hunks
    :kwarg allow_dirty: If True, when we encounter something that is not
        a hunk header when we're looking for one, assume the rest of the lines
        are not part of the patch (comments or other junk).  Default False
    s
Nii(
RR0RR,R.RARRBRFRJR@R=R?(Rtallow_dirtythunkRt	orig_sizetmod_sizet	hunk_line((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyt
iter_hunksÚs4
	
!
tBinaryPatchcB@seZd„Zd„ZRS(cC@s||_||_dS(N(toldnametnewname(R3RTRU((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR4s	cC@sd|j|jfS(NsBinary files %s and %s differ
(RTRU(R3((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR>s(R;R<R4R>(((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyRSs	tPatchcB@sGeZd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cC@s tj|||ƒg|_dS(N(RSR4thunks(R3RTRU((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR4scC@s?|jƒ}|djg|jD]}t|ƒ^qƒ7}|S(NR(RERGRWR%(R3tretth((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyR>s/cC@sd|j|jfS(Ns--- %s
+++ %s
(RTRU(R3((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyREscC@s‚d}d}x]|jD]R}xI|jD]>}t|tƒrH|d7}q&t|tƒr&|d7}q&q&WqW||t|jƒfS(s,Calculate the number of inserts and removes.ii(RWRBRJR?R@R(R3tremovestinsertsRNR((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pytstats_valuess
cC@sd|jƒS(s#Return a string of patch statisticss"%i inserts, %i removes in %i hunks(R\(R3((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyt	stats_str#scC@sG|}x:|jD]/}|j|ƒ}|dkr5dS||7}qW|S(N(RWRIR(R3RKtnewposRNRL((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyt
pos_in_mod(scc@s|xu|jD]j}|jd}xT|jD]I}t|tƒrT||fV|d7}nt|tƒr'|d7}q'q'Wq
WdS(sƒIteraties through inserted lines

        :return: Pair of line number, line
        :rtype: iterator of (int, InsertLine)
        iN(RWR-RBRJR?R=(R3RNRR((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyt
iter_inserted1s

(	R;R<R4R>RER\R]R_R`(((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyRV	s							cC@s‰t|ƒ}yt|ƒ\}}Wn#tk
rG}t|j|jƒSXt||ƒ}x't||ƒD]}|jj	|ƒqgW|SdS(s“
    :arg iter_lines: iterable of lines to parse
    :kwarg allow_dirty: If True, allow the patch to have trailing junk.
        Default False
    N(
titer_lines_handle_nlRRRSRRRVRRRWRF(RRMRRR*tpatchRN((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pytparse_patchAscc@sMtjtƒ}g}d}t}x|D]}|jdƒs(|jdƒrRq(n|jdƒrgq(n·|dkr¡|jdƒs‘|jdƒr|d8}qn}|jdƒs¿|j|ƒr÷|rÔ|rÔt}nt|ƒdkrî|Vng}n'|jd	ƒrt|ƒ}|j	}n|j
|ƒq(Wt|ƒdkrI|Vnd
S(s•
    :arg iter_lines: iterable of lines to parse for patches
    :kwarg allow_dirty: If True, allow comments and other non-patch text
        before the first patch.  Note that the algorithm here can only find
        such text before any patches have been found.  Comments after the
        first patch are stripped away in iter_hunks() if it is also passed
        allow_dirty=True.  Default False.
    is=== s*** t#R!R is--- s@@N(R	tcompileRtTrueRR
R5RR0R,RF(RRMtregextsaved_linesR,t	beginningRRN((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pytiter_file_patchSs0
		cc@sƒd}xb|D]Z}|tkrM|jdƒs:tƒ‚n|d }d}n|dk	ra|Vn|}q
W|dk	r|VndS(sî
    Iterates through lines, ensuring that lines that originally had no
    terminating 
 are produced without one.  This transformation may be
    applied at any point up until hunk line parsing, and is safe to apply
    repeatedly.
    s
iÿÿÿÿN(RR7R6tAssertionError(Rt	last_lineR((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyRa~s

	
cC@s/gt||ƒD]}t|jƒ|ƒ^qS(sý
    :arg iter_lines: iterable of lines to parse for patches
    :kwarg allow_dirty: If True, allow text that's not part of the patch at
        selected places.  This includes comments before and after a patch
        for instance.  Default False.
    (RjRct__iter__(RRMtf((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyt
parse_patches“scC@s`t|ƒ}t|ƒ|kr-t|ƒ}nx,t|ƒD]}||||kr:|Sq:WdS(sFind the indext of the first character that differs between two texts

    :param atext: The first text
    :type atext: str
    :param btext: The second text
    :type str: str
    :return: The index, or None if there are no differences within the range
    :rtype: int or NoneType
    N(RRR(tatexttbtexttlengthti((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pytdifference_indexžs
cC@s/tt|ƒƒ}t|ƒt|t|ƒƒS(s€Iterate through a series of lines with a patch applied.
    This handles a single file, and does exact, not fuzzy patching.
    (RatiterRtiter_patched_from_hunksRR(t
orig_linestpatch_lines((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pytiter_patched±s
cc@scg}d}|dk	r't|ƒ}nx|D]}x.||jkrd|jƒ}|V|d7}q7WxÎ|jD]Ã}|jt|ƒƒt|tƒr¢|j	Vqot|t
tfƒro|jƒ}||j	krðt||dj
|ƒƒ‚nt|t
ƒr|Vnt|tƒs%t|ƒ‚n|d7}qoqoWq.W|dk	r_x|D]}|VqMWndS(sÞIterate through a series of lines with a patch applied.
    This handles a single file, and does exact, not fuzzy patching.

    :param orig_lines: The unpatched lines.
    :param hunks: An iterable of Hunk instances.
    iRN(RRuR+RRBRFR%RJR?R2R=R@RRGRk(RwRWt
seen_patchtline_noRNt	orig_lineRQR((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyRvºs2

((("t
__future__Rt
bzrlib.errorsRRRRRRR	RRRR0R1R=R?R@R7t
__pychecker__RAR&R5RRtobjectRSRVRcRjRaRoRtRyRv(((s2/usr/lib/python2.7/dist-packages/bzrlib/patches.pyt<module>s2.					B&	8+				

Copyright © 2017 || Recoded By Mr.Bumblebee