��c@spddlmZddlZddlZddlZddlZdefd��YZdefd��YZ dS(i�(t_NtsortdictcBskeZdZdd�Zd�Zd�Zd�Zd�Zd�Z d�Z
d�Zd �Zd
�Z
RS(sa simple sorted dictionarycCs#g|_|r|j|�ndS(N(t_listtupdate(tselftdata((s4/sys/lib/python2.7/site-packages/mercurial/config.pyt__init__s cCs
t|�S(N(R(R((s4/sys/lib/python2.7/site-packages/mercurial/config.pytcopyscCsF||kr|jj|�n|jj|�tj|||�dS(N(Rtremovetappendtdictt__setitem__(Rtkeytval((s4/sys/lib/python2.7/site-packages/mercurial/config.pyRscCs
|jj�S(N(Rt__iter__(R((s4/sys/lib/python2.7/site-packages/mercurial/config.pyRscCs#x|D]}||||<qWdS(N((Rtsrctk((s4/sys/lib/python2.7/site-packages/mercurial/config.pyRs
cCstj|�g|_dS(N(R
tclearR(R((s4/sys/lib/python2.7/site-packages/mercurial/config.pyRs
cCs$g|jD]}|||f^q
S(N(R(RR((s4/sys/lib/python2.7/site-packages/mercurial/config.pytitems!scCs$tj||�|jj|�dS(N(R
t__delitem__RR(RR((s4/sys/lib/python2.7/site-packages/mercurial/config.pyR#scCs|jS(N(R(R((s4/sys/lib/python2.7/site-packages/mercurial/config.pytkeys&scCs
|jj�S(N(RR(R((s4/sys/lib/python2.7/site-packages/mercurial/config.pytiterkeys(sN(t__name__t
__module__t__doc__tNoneRRRRRRRRRR(((s4/sys/lib/python2.7/site-packages/mercurial/config.pyRs tconfigcBs�eZdd�Zd�Zd�Zd�Zd�Zd�Zdd�Z d�Z
d�Zd �Zd
�Z
dd�Zd
�Zdddd�Zdddd�ZRS(cCsei|_i|_g|_|rax(|jD]}||j�|j|<q+W|jj�|_ndS(N(t_datat_sourcet_unsetR(RRR((s4/sys/lib/python2.7/site-packages/mercurial/config.pyR,s cCs
t|�S(N(R(R((s4/sys/lib/python2.7/site-packages/mercurial/config.pyR4scCs
||jkS(N(R(Rtsection((s4/sys/lib/python2.7/site-packages/mercurial/config.pyt__contains__6scCs|jj|i�S(N(Rtget(RR((s4/sys/lib/python2.7/site-packages/mercurial/config.pyt__getitem__8sccs x|j�D]}|Vq
WdS(N(tsections(Rtd((s4/sys/lib/python2.7/site-packages/mercurial/config.pyR:scCs�xW|jD]L\}}||kr
||j|kr
|j||=|j||f=q
q
WxH|D]@}||kr�t�|j|<n|j|j|j|�qaW|jj|j�dS(N(RRRRR(RRtstn((s4/sys/lib/python2.7/site-packages/mercurial/config.pyR=s
cCs|jj|i�j||�S(N(RR (RRtitemtdefault((s4/sys/lib/python2.7/site-packages/mercurial/config.pyR GscCsVy7|j||}|j||�}||||fSWntk
rQ||fSXdS(s�return a tuple allowing restore to reinstall a previous value
The main reason we need it is because it handles the "no data" case.
N(RtsourcetKeyError(RRR&tvalueR(((s4/sys/lib/python2.7/site-packages/mercurial/config.pytbackupJs
cCs|jj||fd�S(Nt(RR (RRR&((s4/sys/lib/python2.7/site-packages/mercurial/config.pyR(VscCst|jj��S(N(tsortedRR(R((s4/sys/lib/python2.7/site-packages/mercurial/config.pyR"XscCs|jj|i�j�S(N(RR R(RR((s4/sys/lib/python2.7/site-packages/mercurial/config.pyRZsR,cCsG||krt�|j|<n||j||<||j||f<dS(N(RRR(RRR&R*R(((s4/sys/lib/python2.7/site-packages/mercurial/config.pytset\scCs�t|�dkrK|\}}}}||j||<||j||f<nE|\}}||jkrw|j||=n|jj||fd�dS(s$restore data returned by self.backupiN(tlenRRtpopR(RRRR&R*R(((s4/sys/lib/python2.7/site-packages/mercurial/config.pytrestorebsc
Cs�tjd�}tjd�}tjd�}tjd�} tjd�}
tjd�}tjd�}d}
d}d }t}xY|jt�D]H}|d
7}|d
kr�|jd�r�|d}n|ri|
j|�r��n|j|�}|rZ|r|
|krq�n|j|
|�d
|j d
�}|j
|
||d||f�q�nd}t}n|j|�}|rLtj|j d
��}tj
j|�}tj
jtj
j||��}|r�y||d|d|�WqFtk
rB}|jtjkrCtjtd�||jfd||f��qCqFXq�q�n| j|�raq�n|j|�}|r�|j d
�}
|r�|j|
|
�}
n|
|kr�t�|j|
<q�q�n|j|�}|r6|j d
�}t}|r|
|krq�n|j
|
||j d�d||f�q�n|j|�}|r�|j d
�}|rr|
|krrq�n|j|
|�dk r�|j|
|=n|jj|
|f�q�ntj|j�d||f��q�WdS(Ns\[([^\[]+)\]s([^=\s][^=]*?)\s*=\s*(.*\S|)s\s+(\S|\S.*\S)\s*$s
(;|#|\s*$)s(;|#)s%unset\s+(\S+)s%include\s+(\S|\S.*\S)\s*$R,iisis
s%s:%dtremapR"scannot include %s (%s)s%s:%si(tutilt compilereRtFalset
splitlinestTruet
startswithtmatchR tgroupR.t
expandpathtostpathtdirnametnormpathtjointIOErrorterrnotENOENTterrort
ParseErrorRtstrerrorRRRR trstrip(RRRR"R2tincludet sectionretitemretcontretemptyret commentretunsetret includereRR&tlinetconttltmtvtinctbasetinsttname((s4/sys/lib/python2.7/site-packages/mercurial/config.pytparseps�
# !
)cCs>|stj|�}n|j||j�|||j�dS(N(R3t posixfileRYtread(RR=tfpR"R2((s4/sys/lib/python2.7/site-packages/mercurial/config.pyR[�sN(RRRRRRR!RRR R+R(R"RR.R1RYR[(((s4/sys/lib/python2.7/site-packages/mercurial/config.pyR+s
J(
ti18nRRDR3R<RBR
RtobjectR(((s4/sys/lib/python2.7/site-packages/mercurial/config.pyt<module>s
|