�t�c@sAddlZddlZddlmZd�Zed�ZdS(i�N(t_c
Csg}d|kr<|jd�}||d}|| }ntj|||�\}}g}x�|r�jd�}|r�|ddkr�t|�dkr�|jd|�tj|||�\}} ||}| }q`|j|�q`W|j|�||fS(s�Parse options mostly like getopt.gnu_getopt.
This is different from getopt.gnu_getopt in that an argument of - will
become an argument of - instead of vanishing completely.
s--iit-(tindextgetopttpoptlentinserttappendtextend(
targstoptionstlongoptionst extraargst stopindextoptst parseargstargttoptstnewparseargs((s7/sys/lib/python2.7/site-packages/mercurial/fancyopts.pyt gnugetopts"
(
cCs�g}d}i}i}xB|D]:}t|�dkrO|\} }
}}}
n|\} }
}}|
}|
jdd�}
|
|d| <|d|<|||
<t|t�r�|||
<n)t|dt�r�d||
<n
|||
<|dkp|tkp|tks0| r| d7} n|r0|d7}q0n| rC|| 7}n|
r|j|�qqW|rlt }n t
j
}||||�\}}x)|D]!\}}||}
t||
�}|tt�kr�|
|�||
<q�|td �kr?yt
|�||
<Wq�tk
r;tjtd
�||f��q�Xq�|td�kr^|||
<q�|tg�kr�||
j|�q�|td�ks�|tt�kr�t||
<q�q�W|S(s
read args, parse options, and store options in state
each option is a tuple of:
short option or ''
long option
default value
description
option value label(optional)
option types include:
boolean or none - option sets variable in state to true
string - parameter string is stored in state
list - parameter string is added to a list
integer - parameter strings is stored as int
function - call function with parameter
non-option args are returned
tiRRs--t__call__t:t=is,invalid value %r for option %s, expected intN(Rtreplacet
isinstancetlisttgetattrtFalsetNonetTrueRRRttypet fancyoptstintt
ValueErrortutiltAbortR(R R
tstatetgnutnamelistt shortlisttargmaptdefmaptoptiontshorttnametdefaulttcommenttdummytonametparseRtopttvaltt((s7/sys/lib/python2.7/site-packages/mercurial/fancyopts.pyR %s`
$
$(RR#ti18nRRRR (((s7/sys/lib/python2.7/site-packages/mercurial/fancyopts.pyt<module>s
|