-=[ Mr. Bumblebee ]=-
_Indonesia_

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


F6Pc@@s'ddlmZddlZddlmZeedejZde	fdYZ
dZdZe
d	Zdd
ZdZdefd
YZdZdZdZdZdZdZddZdZddZdefdYZdddZdS(i(tabsolute_importN(tlazy_importsv
from fnmatch import fnmatch
import re
from cStringIO import StringIO

from bzrlib._termcolor import color_string, re_color_string, FG

from bzrlib.revisionspec import (
    RevisionSpec,
    RevisionSpec_revid,
    RevisionSpec_revno,
    )
from bzrlib import (
    bzrdir,
    diff,
    errors,
    lazy_regex,
    osutils,
    revision as _mod_revision,
    trace,
    )
t_RevisionNotLinearcB@seZdZRS(s3Raised when a revision is not on left-hand history.(t__name__t
__module__t__doc__(((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyR0scC@s4t|dkrtS|ddko3|ddkS(s(returns True is rev tuple is on mainlineiii(tlentTrue(t	rev_tuple((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyt_rev_on_mainline4scc@s|j}|j}xt|j|tjfD]Z}|j|}djd|D}||krz||dfVPn||dfVq.WdS(Nt.cs@s|]}t|VqdS(N(tstr(t.0tn((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pys	<genexpr>Esi(t
repositoryt	get_graphtiter_lefthand_ancestryt
_mod_revisiont
NULL_REVISIONtrevision_id_to_dotted_revnotjoin(tbranchtstart_rev_idt
end_rev_idtrepotgraphtrevision_idtrevnot	revno_str((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyt_linear_view_revisions>s		c
c@s|jd|d|dd}|sdx|D]2\}}}}|djtt||fVq+Wnd}	xw|D]o\}}}}|	dkr|}	n|	r||	kr|}	n||	8}n|djtt||fVqqWdS(spCalculate revisions to view including merges, newest to oldest.

    :param branch: the branch
    :param start_rev_id: the lower revision-id
    :param end_rev_id: the upper revision-id
    :param rebase_initial_depth: should depths be rebased until a mainline
      revision is found?
    :return: An iterator of (revision_id, dotted_revno, merge_depth) tuples.
    tstart_revision_idtstop_revision_idt	stop_ruleswith-mergesR
N(titer_merge_sorted_revisionsRtmapRtNone(
RRRtrebase_initial_depthstview_revisionstrev_idtmerge_depthRtend_of_mergetdepth_adjustment((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyt_graph_view_revisionsOs"		'		
cC@sVd}y tjtj||}Wn)tjk
rQ}tjd|nX|S(NsInvalid pattern: '%s'(R#t
lazy_regext
reset_compiletretcompileterrorterrorstBzrError(tpatterntflagstpatterncte((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pytcompile_patternws
cC@stjd|rtStS(Ns^([A-Za-z0-9_]|\s)*$(R-tmatchRtFalse(ts((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pytis_fixed_stringst_GrepDiffOutputtercB@sDeZdZdZdZdZdZdZdZRS(sBPrecalculate formatting based on options given for diff grep.
    cC@s||_|j|_|jr|jjtd}|jri||_t|t	j
|_|j|_
q|jj}tj|jd|j|_tdt	j
|_|j|_
n|j|_
dS(Ntreplaces((?:s)+)s\1(s((?:s)+)(toptstoutft
show_colorR2tencodet_user_encodingtfixed_stringt_oldtcolor_stringtFGtBOLD_REDt_newt_get_writer_fixed_highlightedt
get_writerR4R3R-R.Rtsubt_subt
_highlightt_get_writer_regexp_highlightedt_get_writer_plain(tselfR=tpatR3((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyt__init__s				!c@sT|jj|jjfd}fd}|jjrL|S|S|S(s%Get function for writing file headersc@s|dS(N((tline(t
eol_markertwrite(s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyt_line_writersc@s tj|tjdS(N(REtBOLD_MAGENTAtNONE(RR(RSRT(s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyt_line_writer_colors(R>RTR=RSR?(RORURX((RSRTs</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pytget_file_header_writersc@sT|jj|jjfd}fd}|jjrL|S|S|S(s$Get function for writing revno linesc@s|dS(N((RR(RSRT(s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRUsc@s tj|tjdS(N(REt	BOLD_BLUERW(RR(RSRT(s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRXs(R>RTR=RSR?(RORURX((RSRTs</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pytget_revision_header_writersc@s.|jj|jjfd}|S(s*Get function for writing uncoloured outputc@s|dS(N((RR(RSRT(s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRUs(R>RTR=RS(RORU((RSRTs</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRNsc@s8|j|j|jfd}|S(s=Get function for writing output with regexp match highlightedc@sd|S(s5Write formatted line with matched pattern highlightedRR((RR(RUt	highlightRJ(s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyt_line_writer_regexp_highlighteds(RNRKRL(ROR]((RUR\RJs</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRMsc@s8|j|j|jfd}|S(s>Get function for writing output with search string highlightedc@sd|jS(s9Write formatted line with string searched for highlightedRR(R<(RR(RUtnewtold(s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyt_line_writer_fixed_highlighteds(RNRCRG(ROR`((RUR^R_s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRHs(	RRRRQRYR[RNRMRH(((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyR;s						c%	C@stjjd\}}}|jz|jrA|jd}n.tjdtjdg|_|jd}|j|}|dkrdS|j|}t	|jdkr~|jd}|j|}|dkr|j\}	}n|j|}
t|ot|
}||
kr?|
|}}
||}}n|j
dkri|rit|||}qt|||}n0djtt|}
||
df}|g}|j}tjd|jd	}tjd
tj}t|}|j}|j}|j}t}x|D]\}}}|j
dkrS|dkrSq#ntjd|}|j|}|j|}t	|j dkrt!j"}n
|j d}|j#|}t$}t%j&|||dd
dd
t'} t(}!d}"|j)}#x|#j*D]}$|j+|$r8|$}"t'}!q|j+|$r| rg|d|ft(} n|!r|d|"ft(}!n|$j,|d}$|d|$fqqWq#WWd|j-XdS(NR
isrevno:1slast:1snull:iis	^[+\-].*(t)s&=== (modified|added|removed) file '.*'srevid:t	old_labeltt	new_labels=== revno:%s ===s  %sR<s    %s(.tbzrdirtBzrDirtopen_containing_tree_or_brancht	lock_readtrevisiontRevisionSpectfrom_stringtas_revision_idRRR#tlast_revision_infoR	tlevelsRR*RR"RRR-R.R2tUNICODER;RIR[RYRAtRevisionSpec_revidtget_revisiontas_treet
parent_idsRRt
revision_treetStringIOtdifftshow_diff_treesRR8tgetvaluet
splitlinestsearchtdecodetunlock(%R=twtRtrelpatht	start_revtstart_revidtsrevno_tupletend_revt	end_revidt	end_revnoterevno_tuplet
grep_mainlinet
given_revststart_revnotstart_rev_tupleRtdiff_patterntfile_patternt	outputtert	writelinet
writerevnotwritefileheadert
file_encodingtrevidRR'trev_spectnew_revtnew_treetancestor_idtold_treeR9t
display_revnotdisplay_filetfile_headerttextRR((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyt	grep_diffs
	


		
	
			 c	C@stjjd\}}}|jz{|jd}|j|}|dkrqtjd}|j|}n|j	|}t
|jdkra|jd}|j|}|dkr|j\}	}n|j	|}
t|ot|
}||
kr"|
|}}
||}}n|j
dkrL|rLt|||}qt|||}n0djtt|}
||
df}|g}t|dt|_x|D]\}}}|j
dkr|dkrqntjd|}|j|}x|jD]}tj||}|j|}|sMtjd|q	ntj|r~|}t||||||q	t ||d|||q	WqWWd|j!XdS(	NR
isrevno:1iit	use_cachesrevid:sSkipped unknown file '%s'.("ReRfRgRhRiRlR#tRevisionSpec_revnoRkRRRmR	RnRR*RR"Rt
_OutputterRRRpRrt	path_listtosutilstpathjointpath2idttracetwarningtisdirtdir_greptversioned_file_grepR|(R=R}RR~RRRRRRRRRRRRRR'trevttreetpathtpath_for_idtidtpath_prefix((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pytversioned_grep0sV



	%cC@sd}|_tjjd\}}}|sFd}tj|nt||_|j	zhxa|j
D]V}tj|r|}t
||||||qltt|j|||qlWWd|jXdS(NR
sqCannot search working tree. Working tree not found.
To search for specific revision in history use the -r option.(R#tprint_revnoReRfRgR0tBzrCommandErrorRRRhRRRRt
_file_greptopentreadR|(R=RRRR~tmsgRR((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pytworkingtree_grepvs

'cC@s7|rt||rtS|r3t||r3tStS(N(t_path_in_glob_listRR8(tincludetexcludeR((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyt
_skip_files
c
C@s3|}|r!tjd|}ntj||}|jrKd}t}ng}	|	j}
|j}x\|jdtd|d|j	D]9\}}
}}}t
|j|j|rqn|
dkr|dkr|dkr&|j
|}||jkr
|j||q|
|||ffq|dkr;d}ntj|j||}|jse|jrt|dd	d
}t||||qt|dj}t|||||qqW|dkr/x^|j|	D]J\\}}}t||}t|d|||||j
||qWndS(Ns..tinclude_roottfrom_dirt	recursivetVtfileR
trt	bufferingii(RRt	from_rootR#RtappendRt
list_filesR8RRRRtget_file_revisiontcachetwrite_cached_linestbasedirtfiles_with_matchestfiles_without_matchRt_file_grep_list_only_wtreeRRtiter_files_bytest_make_display_path(RRR~R=RRtrpathRRtto_greptto_grep_appendRtfptfctfkindtfidtentrytcache_idt
path_for_fileRt	file_texttchunks((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRsB				%	"cC@sS|rOtjtj||}|jdd}|j|ddd}n|S(sReturn path string relative to user cwd.

    Take tree's 'relpath' and user supplied 'path', and return path
    that can be displayed to the user.
    s\t/Rci(RtnormpathRR<(R~R((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRs
cC@s8t||}|j|}t|||||dS(sLCreate a file object for the specified id and pass it on to _file_grep.
    N(Rt
get_file_textR(RRR~RR=RRR((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRscC@s(x!|D]}t||rtSqWtS(N(tfnmatchRR8(Rt	glob_listtglob((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRs
cC@s$d|jdkr6|jr2tjd|ndS|jdt}|jr|jjt	d}xT|D]}||krnt
}PqnqnWn-x*|D]"}|jj|rt
}PqqW|j
r|s|jr |r |r|dkrtj||}n|jj|ddndS(NtisBinary file '%s' skipped.iR<R
(RtverboseRRtseekR8RBR2R@RARR4RzRRRRRRIR#(RRR=RtfoundR2RR((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRs*	
	

RcB@s>eZdZedZdZdZdZdZRS(sPrecalculate formatting based on options given

    The idea here is to do this work only once per run, and finally return a
    function that will do the minimum amount possible for each match.
    cC@s|j|_|ri|_n	d|_|jp6|j}|jr)|jjtd}|rl|j	|_
n|jr||_t
|tj|_|j|_
nN|jj}tj|jd|j|_t
dtj|_|j|_
tj}tj}t
dtj}t
dtj}	n"|j	|_
d}}d}d}	|dg}
|jrv|
j |	d	gndj|
|_!g}
|r|js|
j"|qn2|j#r|
j |d
gn|
j |dg|
j"|j$dj|
|_%dS(
NR<s((?:s)+)s\1t:t~Rcs%(path)ss	%(revno)ss
%(lineno)ss%(line)s(s((?:s)+)(&R>RR#RRR?R2R@RARNRIRBRCRDRERFRGRHR4R3R-R.RRJRKRLRMtMAGENTARWt	BOLD_CYANtBOLD_YELLOWRtextendt_format_initialRtline_numberRSt_format_perline(ROR=Rtno_lineRPR3t
path_starttpath_endtseptrev_septparts((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRQsL				!		
			c@s|j|ji|d6|d6|jj|jdk	r|dk	rg}||f|j|<|jfd}|Sfd}|S(s*Get function for writing uncoloured outputRRc@s&|}||dS(s(Write formatted line and cache argumentsN((tkwargstend(tadd_to_cachetper_linetstartRT(s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyt_line_cache_and_writerQs

c@s|dS(s<Write formatted line from arguments given by underlying optsN((R(RRRT(s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRUWsN(RRR>RTRR#R(RORRRtresult_listRRU((RRRRTs</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRNHs		cC@s]|j|\}}|ji|d6|d6}|jj}x|D]}|||qAWdS(s/Write cached results out again for new revisionRRN(RRR>RT(RORRtcached_pathtcached_matchesRRTR((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyR\s

c@sA|j||||j|jfd}|S(s=Get function for writing output with regexp match highlightedc@sd||S(s5Write formatted line with matched pattern highlightedRR((RRR(RUR\RJ(s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyR]hs(RNRKRL(RORRRR]((RUR\RJs</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRMdsc@sA|j||||j|jfd}|S(s>Get function for writing output with search string highlightedc@sd|j|S(s9Write formatted line with string searched for highlightedRR(R<(RRR(RUR^R_(s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyR`qs(RNRCRG(RORRRR`((RUR^R_s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRHms(	RRRR8RQRNRRMRH(((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRs3				cC@sd|d kr1|jr-tjd|ndS|rX|dkrXtj||}nt}|jjtd}|jj	|||}|j
s|jr|jrt
jdkr||k}	qZx|jD]}
||
krt}	PqqWt}	n`|jj}d|kr'||dk	}	n3x0|jD]}
||
r4t}	Pq4q4Wt}	|j
ri|	sy|jr|	r|qnn|jrt
jdkr|j|}|d	krdS|jd
d|d}
|jr|jd
d|
d}n||
}nd}|jruxt|jD]D\}}
||
kr*|
j|d}
|d
||d|
q*q*Wqx||jD]4}
||
kr|
j|d}
|d|
qqWn7|jj}d|krB||}|dkrdS|jd
d|jd}
|jr5|jd
d|
d}n||
}nd}|jrxt|jD]D\}}
||
rd|
j|d}
|d
||d|
qdqdWnExB|jD]4}
||
r|
j|d}
|d|
qqWdS(NRisBinary file '%s' skipped.R
R<iit$is
iitlinenoRR(ii(ii(RRRRRRAR2R@RRIRRRBtsystplatformRyRR8R4RzR#tversion_infotfindtrfindRtcountt	enumerateR{R(RRR=RRRRR2RRRRRztitbRtindextm((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyRws			
		
	!	
	!(t
__future__RRtbzrlib.lazy_importRtglobalsRtget_user_encodingRAt	ExceptionRR	RRR*R6R:tobjectR;RRRRRRR#RRRRR(((s</usr/lib/python2.7/dist-packages/bzrlib/plugins/grep/grep.pyt<module>s.		
	'	L	\	F			;			h

Copyright © 2017 || Recoded By Mr.Bumblebee