\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@siddlmZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z mZmZmZyddlZejWnek rddlZnXejdZejZejZejZejZejZejZejZejZej Z ej!Z!ej"Z"ej#j$Z$ej%Z%ej&Z&dZ'de(fd YZ)d e(fd YZ*d d dZ+ej,Z,de(fdYZ-dZ.dZ/dZ0dZ1dZ2ddZ4dZ5dZ6dZ7dZ8dZ9dZ:dZ;e j<j=Z>e j?Z@dZAdZBdaCdaDd ZEd!ZFd"ZGd#ZHd$ZId%ZJejKejLhZMd&ZNdd'ZOdd(ZPd)ZQd*ZRd+ZSd,ZTd-ZUd.ZVd/e(fd0YZWddd1ZXeYZZd2Z[d3Z\d4Z]d5Z^d6Z_dS(7i(tabsolute_importNi(t_(tencodingterrortpolicytpycompattwin32tosutilitmixedfilemodewrappercB@seZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZRS(s)Wraps a file handle when it is opened in read/write mode. fopen() and fdopen() on Windows have a specific-to-Windows requirement that files opened with mode r+, w+, or a+ make a call to a file positioning function when switching between reads and writes. Without this extra call, Python will raise a not very intuitive "IOError: [Errno 0] Error." This class wraps posixfile instances when the file is opened in read/write mode and automatically adds checks or inserts appropriate file positioning calls when necessary. iiicC@s*tj|d|tj|dddS(Nt_fpt_lastopi(tobjectt __setattr__(tselftfp((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt__init__DscC@s|jj|S(N(R t __enter__(R ((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyRHs cC@s|jj|||dS(N(R t__exit__(R texc_typetexc_valtexc_tb((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyRLscC@st|j|S(N(tgetattrR (R tname((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt __getattr__OscC@s|jj||S(N(R R (R Rtvalue((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR RscC@s|jjdtjdS(Ni(R tseektostSEEK_CUR(R ((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt _noopseekUscO@s)tj|d|j|jj||S(NR (R R tOPNONER R(R targstkwargs((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyRXscC@sE|j|jkr|jntj|d|j|jj|S(NR (R tOPREADRR R tOPWRITER twrite(R td((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR"\s cO@sH|j|jkr|jntj|d|j|jj||S(NR (R R t _noopeseekR R R!R t writelines(R RR((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR%cs cO@sH|j|jkr|jntj|d|j|jj||S(NR (R R!RR R R R tread(R RR((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR&js cO@sH|j|jkr|jntj|d|j|jj||S(NR (R R!RR R R R treadline(R RR((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR'qs cO@sH|j|jkr|jntj|d|j|jj||S(NR (R R!RR R R R t readlines(R RR((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR(xs (t__name__t __module__t__doc__RR R!RRRRR RRR"R%R&R'R((((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR4s             tfdproxycB@s;eZdZdZdZdZdZdZRS(seWraps osutil.posixfile() to override the name attribute to reflect the underlying file name. cC@s||_||_dS(N(RR (R RR((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyRs cC@s|jj|S(N(R R(R ((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyRs cC@s|jj|||dS(N(R R(R Rt exc_valuet traceback((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyRscC@s t|jS(N(titerR (R ((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt__iter__scC@st|j|S(N(RR (R R((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyRs(R)R*R+RRRR0R(((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR,s     tricC@syptj|||}tjr3t||}nd|krU|jdtjnd|krkt|S|SWn;t k r}t |j dt j ||jfnXdS(s/Open a file with even more POSIX-like semanticstait+s%s: %sN(Rt posixfileRtispy3R,RRtSEEK_ENDRt WindowsErrortIOErrorterrnoRt strfromlocaltstrerror(Rtmodet bufferingRterr((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR4s     t winstdoutcB@s;eZdZdZdZdZdZdZRS(s3stdout on windows misbehaves if sent through a pipecC@s ||_dS(N(R(R R((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyRscC@st|j|S(N(RR(R tkey((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyRscC@s)y|jjWntk r$nXdS(N(RtcloseR8(R ((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyRAs cC@sy_d}t|}d}d|_x7||kr]||}|jj|||!|}q'WWnTtk r}|jdkrtj| rn|jttj dnXdS(Ni>is Broken pipe( tlent softspaceRR"R8R9RtlasterrorwaspipeerrorRAtEPIPE(R tstlimittltstarttendtinst((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR"s    cC@sRy|jjSWn:tk rM}tj|s8nttjdnXdS(Ns Broken pipe(RtflushR8RRDR9RE(R RK((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyRLs (R)R*R+RRRAR"RL(((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR?s     cC@sFytjddkSWn'tk rAdtjjddkSXdS(s+return true if run on windows 95, 98 or me.iitcommandtcomspectN(tsystgetwindowsversiontAttributeErrorRtenvirontget(((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt _is_win_9xs cC@st S(N(RU(((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt openhardlinksscC@s.|d}|ddkr*|dd!}n|S(s<parses the output produced by patch and returns the filenameiit`ii((t output_linetpf((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytparsepatchoutputs cC@sd|jkrdpd}|r4d||fp7|}|jdsX|jdrttjtd|nt|}|rd|t||f}n|S( s$Build argument list for ssh or Plinktplinks-Ps-ps%s@%st-t/s9illegal ssh hostname or username starting with - or /: %ss%s %s %s(tlowert startswithRtAbortRt shellquote(tsshcmdthosttusertporttpflagR((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytsshargss   cC@sdS(N((tfRHtx((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytsetflagsscC@sdS(N((tsrctdstR<((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytcopymodescC@stS(N(tFalse(tpath((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt checkexecscC@stS(N(Rn(Ro((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt checklinkscC@sJt|dd}|dk rF|dkrFtj|tjndS(Ntfilenoi(RtNonetmsvcrttsetmodeRtO_BINARY(tfdtfno((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt setbinaryscC@s|jtjdS(NR](treplaceRtossep(Ro((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytpconvert scC@s|jddS(NR]s\(Rz(Ro((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt localpathscC@sttjj|S(N(R|RRotnormpath(Ro((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR~scC@s tj|S(N(Rtupper(Ro((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytnormcasescC@stS(N(Rn(ts1ts2((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytsamestatsc@stfddDs Stjtjtjd}d}d}t}x`||kr||d!}|dkr|dt}y)jd}|d| d7}Wqtk r||7}|d}qXn|d krw|dt}yjd }Wn)tk rW|d 7}|d}qX| }|d |d 7}n3|d kr|d|d !d krC|d t}y\jd }| }|j |ddkr|d |d 7}n|d|d 7}Wqtk r?|d7}|d}qXqd}|d7}||d!}xA|dkr||kr||7}|d7}||d!}qgW|j |ddkr|d |d 7}n|d |7}|dkr|d8}qn|dkrC|d|krC|d|d !dkrC|d7}ng|dkr|d|kr|d|d !dkr||d|d !7}|d7}n ||7}|d7}qXW|S(sConvert shell variables in the form $var and ${var} inside ``path`` to %var% form. Existing Windows style variables are left unchanged. The variables are limited to the given environment. Unknown variables are left unchanged. >>> e = {b'var1': b'v1', b'var2': b'v2', b'var3': b'v3'} >>> # Only valid values are expanded >>> shelltocmdexe(b'cmd $var1 ${var2} %var3% $missing ${missing} %missing%', ... e) 'cmd %var1% %var2% %var3% $missing ${missing} %missing%' >>> # Single quote prevents expansion, as does \$ escaping >>> shelltocmdexe(b"cmd '$var1 ${var2} %var3%' \$var1 \${var2} \\", e) 'cmd "$var1 ${var2} %var3%" $var1 ${var2} \\' >>> # $$ is not special. %% is not special either, but can be the end and >>> # start of consecutive variables >>> shelltocmdexe(b"cmd $$ %% %var1%%var2%", e) 'cmd $$ %% %var1%%var2%' >>> # No double substitution >>> shelltocmdexe(b"$var1 %var1%", {b'var1': b'%var2%', b'var2': b'boom'}) '%var1% %var1%' >>> # Tilde expansion >>> shelltocmdexe(b"~/dir ~\dir2 ~tmpfile \~/", {}) '%USERPROFILE%/dir %USERPROFILE%\\dir2 ~tmpfile ~/' c3@s|]}|kVqdS(N((t.0tc(Ro(s7/usr/lib64/python2.7/site-packages/mercurial/windows.pys 8ss$'~s_-ROiis't"t%t$it{t}s${t~s\R]s %USERPROFILE%(s\R](RR( tanyRtsysbyteststringt ascii_letterstdigitsRBtindext ValueErrorRT(RotenvtvarcharstresRtpathlenRtvar((Ros7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt shelltocmdexes|                   cC@sztdkrtjdantdkr?tjdjan|rft| rftj| rf|Sdtjd|S(s >>> shellquote(br'C:\Users\xyz') '"C:\\Users\\xyz"' >>> shellquote(br'C:\Users\xyz/mixed') '"C:\\Users\\xyz/mixed"' >>> # Would be safe not to quote too, since it is all double backslashes >>> shellquote(br'C:\\Users\\xyz') '"C:\\\\Users\\\\xyz"' >>> # But this must be quoted >>> shellquote(br'C:\\Users\\xyz/abc') '"C:\\\\Users\\\\xyz/abc"' s (\\*)("|\\$)s[^a-zA-Z0-9._:/-]s"%s"s\1\1\\\2N(t_quotereRstretcompilet_needsshellquotetsearchtsub(RF((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyRas  #cC@s-|jdr)|jdr)|dd!S|S(NRii(R_tendswith(RF((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt_unquotes cC@stjttj|dtS(s3Parse a command string in cmd.exe way (best-effort)tposix(RtmaplistRt shlexsplitRn(RF((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt shellsplitscC@stjdkrd|dS|S(s4Build a command string suitable for os.popen* calls.iiiR(iii(RPt version_info(tcmd((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt quotecommands cC@stS(N(tTrue(tst((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytisownersc@stjjdd}g|jjtjD] }|^q.tjj |djkrndgnfd}tj |kr||SxTtjjddjtjD]1}|tjj ||}|dk r|SqW|tjj tjj|S(s*Find executable for command searching like cmd.exe does. If command is a basename then PATH is searched for command. PATH isn't searched if command is an absolute or relative path. An extension from PATHEXT is found and added if not present. If command isn't found None is returned.tPATHEXTs.COM;.EXE;.BAT;.CMDiROc@s5x.D]&}||}tjj|r|SqWdS(s:Will append extension (if needed) and return existing fileN(RRotexistsRs(t pathcommandtextt executable(tpathexts(s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt findexistings   tPATHN(RRSRTR^tsplitRt ospathsepRRotsplitextR{tjoinRst expandusert expandvars(RMtpathextRRRoR((Rs7/usr/lib64/python2.7/site-packages/mercurial/windows.pytfindexes+"  ( c c@s4i}tj}x|D]}t|}tjj|\}}|sOd}n|j|d}|dkryVtgt |t D]6\}}} || j t krt|| f^q} Wn@t k r} | jtjtjtjfkrni} nX|j|| }n|j|dVqWdS(sStat each file in files. Yield each stat, or None if a file does not exist or has a type we don't care about. Cluster and cache stat per directory to minimize number of OS stat calls.t.N(tstattS_IFMTRRRoRRTRstdicttlistdirRtst_modet _wantedkindstOSErrorR9tENOENTtEINVALtENOTDIRt setdefault( tfilestdircachetgetkindtnftdirtbasetcachetntkRFtdmapR>((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt statfiless(     4 cC@sdS(siReturn the name of the user with the given uid. If uid is None, return the name of the current user.N(Rs(tuid((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytusernamescC@sdS(skReturn the name of the group with the given gid. If gid is None, return the name of the current group.N(Rs(tgid((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt groupnamescC@stjtjtj|S(N(RtfsencodeRtreadlinktfsdecode(tpathname((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyRscC@st|rdStj|tjj|\}}|sVtjj|\}}nxd|r|ry!t|rxdStj|Wnttfk rPnXtjj|\}}qYWdS(sspecial version of os.removedirs that does not remove symlinked directories or junction points if they actually contain filesN(RRtrmdirRoRRR(Rtheadttail((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt removedirss   cC@s`ytj||WnEtk r[}|jtjkr>nt|tj||nXdS(s=atomically rename file src to dst, replacing dst if it existsN(RtrenameRR9tEEXISTtunlink(RkRlte((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR#s cC@s1gtjgtjd D]}tj|^qS(Ni(RPRtargvRt strtolocal(targ((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytgethgcmd-scC@s tdS(N(tKeyError(R((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt groupmembers0scC@stS(N(Rn(Rh((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytisexec4st cachestatcB@seZdZdZRS(cC@sdS(N((R Ro((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR8scC@stS(N(Rn(R ((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt cacheable;s(R)R*RR(((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyR7s cC@s|dkr!tjtjf}n!t|ttfsB|f}nx|D]}yftj|tj |E}|rtj |p|}tj ||d}tj |SWdQXWqIt k rqIXqIWdS(s* Look up a key/value name in the Windows registry. valname: value name. If unspecified, the default value for the key is used. scope: optionally specify scope for registry lookup, this can be a sequence of scopes to look up in order. Default (CURRENT_USER, LOCAL_MACHINE). iN( RstwinregtHKEY_CURRENT_USERtHKEY_LOCAL_MACHINEt isinstancetlistttupletOpenKeyRR:t QueryValueExt unitolocaltEnvironmentError(R@tvalnametscopeRFthkeyRtval((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt lookupreg>s    cC@stS(s(check whether a stat result is a symlink(Rn(R((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt statislinkWscC@stS(s1check whether a stat result is an executable file(Rn(R((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyt statisexec[scC@s tdS(N(tNotImplementedError(tfds((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytpoll_scC@s_g}xItrQtj|}|s(Pn|j|}|sAPn|j|q Wdj|S(s$Read all available data from a pipe.RO(RRtpeekpipeR&tappendR(tpipetchunkstsizeRF((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytreadpipecs cC@stddS(Nsunsupported platform(R(tsockRo((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pytbindunixsocketrs(`t __future__RR9RtRRRRRPti18nRRORRRRRt_winregRtCloseKeyt ImportErrort importmodRt getvolumenametgetfsmountpointt getfstypetgetusert hidewindowtmakedirtnlinkstoslinkt samedevicetsamefiletsetsignalhandlert spawndetachedRoRttestpidRtumaskR RR,R4RR?RURVRZRgRjRsRmRpRqRyR|R}R~Rt normcasespecsRt normcasespect upperfallbacktnormcasefallbackRRRRRaRRRRRtS_IFREGtS_IFLNKRRRRRRRRRRRRRt expandglobsRRRRR(((s7/usr/lib64/python2.7/site-packages/mercurial/windows.pyts       (                 K )                v