�8�c
@s�ddlZddlZddlZddlZddlZejjZejjZ ejj
ZejZ
ejZejZejZejZejZZejZeZed�jZdZdZdZej ej�ej ej�krejZ!ejZ"n9ej ej#�ej ej�kr<ej$Z!ej#Z"ndej%fd��YZ&dej%fd��YZ'd Z(d
Z)dZ*dZ+d
Z,dZ-dZ.dZ/dZ0dej%fd��YZ1dej%fd��YZ2dZ3dZ4dej%fd��YZ5dej%fd��YZ6dej%fd��YZ7ed�jZ8eeeejeeegej9_:eej9_;eejgej<_:e
ej<_;egej=_:e
ej=_;y(eeejgej>_:e
ej>_;Wne?k
r�nXeegej@_:e
ej@_;ee
egejA_:eejA_;eejgejB_:e
ejB_;gejC_:eejC_;eejegejD_:eejD_;eeejeje
eejeejejg
ejE_:e
ejE_;egejF_:dejF_;gejH_:eejH_;ejIe
e�ZJeJe
gejK_:e
ejK_;egejL_:eejL_;eejgejM_:e
ejM_;ejejge jN_:e
e jN_;eejgejO_:eejO_;eejPgejQ_:e
ejQ_;ejIe
ee"�ZReRe"gejS_:e
ejS_;d�ZTd�ZUd �ZVd!�ZWd"�ZXd#�ZYd$�ZZd%�Z[d&�Z\gZ]d'�Z^d(�Z_d)�Z`d*�Zad+�Zbd,�ZcdS(-i�NiiWizt _FILETIMEcBs eZdefdefgZRS(t
dwLowDateTimetdwHighDateTime(t__name__t
__module__t_DWORDt_fields_(((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyR's t_BY_HANDLE_FILE_INFORMATIONcBsheZdefdefdefdefdefdefdefdefdefd efg
ZRS(
tdwFileAttributestftCreationTimetftLastAccessTimetftLastWriteTimetdwVolumeSerialNumbert
nFileSizeHightnFileSizeLowtnNumberOfLinkstnFileIndexHight
nFileIndexLow(RRRRR(((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyR+s iiiiii�i iit_STARTUPINFOcBs�eZdefdefdefdefdefdefdefdefdefd efd
efdefdefd
efdejfdefdefdefgZRS(tcbt
lpReservedt lpDesktoptlpTitletdwXtdwYtdwXSizetdwYSizet
dwXCountCharst
dwYCountCharstdwFillAttributetdwFlagstwShowWindowtcbReserved2tlpReserved2t hStdInputt
hStdOutputt hStdError( RRRt_LPSTRt_WORDtctypestc_char_pt_HANDLER(((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyRJs$ t_PROCESS_INFORMATIONcBs2eZdefdefdefdefgZRS(thProcessthThreadtdwProcessIdt
dwThreadId(RRR)RR(((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyR*^s it_COORDcBs&eZdejfdejfgZRS(tXtY(RRR'tc_shortR(((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyR/gst_SMALL_RECTcBs>eZdejfdejfdejfdejfgZRS(tLefttToptRighttBottom(RRR'R2R(((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyR3kst_CONSOLE_SCREEN_BUFFER_INFOcBs;eZdefdefdefdefdefgZRS(tdwSizetdwCursorPositiontwAttributestsrWindowtdwMaximumWindowSize(RRR/R&R3R(((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyR8qs
i�cCs/tj�}t|jd||jf��dS(Ns%s: %s(R'tWinErrortOSErrorterrnotstrerror(tnameterr((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyt
_raiseoserror�scCs�tj|dttBtBdttd�}|tkrBt |�nz9t
�}tj|tj
|��svt |�n|SWdtj|�XdS(Ni(t _kernel32tCreateFileAt_FILE_SHARE_READt_FILE_SHARE_WRITEt_FILE_SHARE_DELETEtNonet_OPEN_EXISTINGt_FILE_FLAG_BACKUP_SEMANTICSt_INVALID_HANDLE_VALUERDRtGetFileInformationByHandleR'tbyreftCloseHandle(RBtfhtfi((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyt_getfileinfo�s
cCsHy&tj||d�s%t|�nWntk
rCt|�nXdS(N(REtCreateHardLinkARJRDtAttributeError(tsrctdst((s3/sys/lib/python2.7/site-packages/mercurial/win32.pytoslink�s
cCs
t|�jS(s-return number of hardlinks for the given file(RSR(RB((s3/sys/lib/python2.7/site-packages/mercurial/win32.pytnlinks�scCsLt|�}t|�}|j|jkoK|j|jkoK|j|jkS(sDReturns whether path1 and path2 refer to the same file or directory.(RSRRR(tpath1tpath2tres1tres2((s3/sys/lib/python2.7/site-packages/mercurial/win32.pytsamefile�s
cCs(t|�}t|�}|j|jkS(s7Returns whether path1 and path2 are on the same device.(RSR(RZR[R\R]((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyt
samedevice�scCsttjtt|�}|rdz5t�}tj|tj|��rO|jt kSWdtj
|�Xntj�tkS(sOreturn True if pid is still running or unable to
determine, False otherwiseN(
REtOpenProcesst_PROCESS_QUERY_INFORMATIONtFalseRtGetExitCodeProcessR'ROtvaluet
_STILL_ACTIVERPtGetLastErrort_ERROR_INVALID_PARAMETER(tpidthtstatus((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyttestpid�s cCstd}tj|d�}tjdtj|�|�}|dkrOtj�n||krmtjt��n|jS(sreturn full path of hg.exeiXiiN( R'tcreate_string_bufferREtGetModuleFileNameARJROR>t_ERROR_INSUFFICIENT_BUFFERRd(tsizetbuftlen((s3/sys/lib/python2.7/site-packages/mercurial/win32.pytexecutablepath�scCsYtd�}tj|jd�}tjtj|�tj|��sRtj�n|jS(sreturn name of current useri,i(RR'RlRdt _advapi32tGetUserNameAROR>(RoRp((s3/sys/lib/python2.7/site-packages/mercurial/win32.pytgetusers
$cCsNd�}trdSt|�}tj|�tj|t�sJtj�ndS(s�Register a termination handler for console events including
CTRL+C. python signal handlers do not work well with socket
operations.
cSstjd�dS(Ni(REtExitProcess(tevent((s3/sys/lib/python2.7/site-packages/mercurial/win32.pythandlersN(t_signalhandlert_SIGNAL_HANDLERtappendREtSetConsoleCtrlHandlertTrueR'R>(RxRi((s3/sys/lib/python2.7/site-packages/mercurial/win32.pytsetsignalhandler
s
cCs/d�}tj�}tjt|�|�dS(NcSsIt�}tj|tj|��||jkrEtj|t�tSt S(N(
Rt_user32tGetWindowThreadProcessIdR'RORdt
ShowWindowt_SW_HIDERbR}(thwndRhtwpid((s3/sys/lib/python2.7/site-packages/mercurial/win32.pytcallbacks (REtGetCurrentProcessIdRtEnumWindowst_WNDENUMPROC(R�Rh((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyt
hidewindows cCssd}tjt�}|dks-|tkr1|St�}tj|tj|��sY|S|j j
|j j}|S(NiO(REtGetStdHandlet_STD_ERROR_HANDLERJRMR8tGetConsoleScreenBufferInfoR'ROR<R6R4(twidtht screenbuftcsbi((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyt termwidth&s cCs�t�}tjt�|_t�}d}x,tjD]!}|d|tj|f7}q4W|shd}n|d7}tj|�}tjj dd�}|d|}t
jd|ddt
t|tj�tj|�tj|��}|s�j�n|jS(Nts%s=%sttCOMSPECscmd.exes /c (RR'tsizeofRR*tostenviront
subprocesstlist2cmdlinetgetREtCreateProcessARJRbt_CREATE_NO_WINDOWtgetcwdROR>R-(targstsitpitenvtktcomspectres((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyt
spawndetached8s$
*cCstjj|�r+ttjd|��nx�td�D]e}d|tjdd�f}ytj ||�PWq8t
k
r�}|jtjkr��q�q8Xq8Wttjd��ytj|�WnFt
k
rt
j|t�ytj|�Wq
t
k
rq
XnXdS(s3try to implement POSIX' unlink semantics on Windowss'Unlinking directory not permitted: '%s'i
s%s-%08xil�s"No usable temporary filename foundN(R�tpathtisdirtIOErrorR@tEPERMtxrangetrandomtrandinttrenameR?tEEXISTtunlinkREtSetFileAttributesAt_FILE_ATTRIBUTE_NORMAL(tfttriesttempte((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyR�Xs(
cCs*tj|�|r&tj|t�ndS(N(R�tmkdirRER�t#_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED(R�t
notindexed((s3/sys/lib/python2.7/site-packages/mercurial/win32.pytmakedir�s
(dR'R@R�R�R�twindlltkernel32REtadvapi32Rstuser32Rtc_longt_BOOLtc_ushortR&tc_ulongRtc_uintt_UINTt_LONGR(t_LPCSTRR%tc_void_pR)t_HWNDRdRMt_ERROR_SUCCESSRgRnR�t_WPARAMt_LPARAMt
c_longlongtc_ulonglongt StructureRRRGRHRIRKRLR�R�RaReRR*R�R�R/R3R8R�RFtargtypestrestypeRNRPRTRUR�R`RcRfRmR�RvRJR�tWINFUNCTYPERzR|R�R�RtR�tc_intR�R�R�RDRSRXRYR^R_RkRrRuRyR~R�R�R�R�R�(((s3/sys/lib/python2.7/site-packages/mercurial/win32.pyt<module>s�<
$ $
4
|