\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sddlmZddlZddlZddlmZddlmZmZdddhZ d Z e e d Z d e fd YZd efdYZdefdYZdefdYZdefdYZdZe e ddZdS(i(tabsolute_importNi(t_(terrortpycompattnoninteractivethelptversioncC@s|jdrz|jd\}}}|d|krM|t||tfS|dd|kr|t||tfSn|jdr|dkr|jd r|d |d}}|j|d}|dkr|t|||jd|dfSnd td tfS( sCheck if the given arg is a valid unabbreviated option Returns (flag_str, has_embedded_value?, embedded_value, takes_value?) >>> def opt(arg): ... return _earlyoptarg(arg, b'R:q', [b'cwd=', b'debugger']) long form: >>> opt(b'--cwd') ('--cwd', False, '', True) >>> opt(b'--cwd=') ('--cwd', True, '', True) >>> opt(b'--cwd=foo') ('--cwd', True, 'foo', True) >>> opt(b'--debugger') ('--debugger', False, '', False) >>> opt(b'--debugger=') # invalid but parsable ('--debugger', True, '', False) short form: >>> opt(b'-R') ('-R', False, '', True) >>> opt(b'-Rfoo') ('-R', True, 'foo', True) >>> opt(b'-q') ('-q', False, '', False) >>> opt(b'-qfoo') # invalid but parsable ('-q', True, 'foo', False) unknown or invalid: >>> opt(b'--unknown') ('', False, '', False) >>> opt(b'-u') ('', False, '', False) >>> opt(b'-ufoo') ('', False, '', False) >>> opt(b'--') ('', False, '', False) >>> opt(b'-') ('', False, '', False) >>> opt(b'-:') ('', False, '', False) >>> opt(b'-:foo') ('', False, '', False) s--t=it-s-:iit:t(t startswitht partitiontbooltFalsetTruetfind(targt shortlisttnamelisttflagteqtvalti((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyt _earlyoptargs1+ )c C@s9g}g}d}x |t|kr||}|dkrL|| 7}Pnt|||\} } } } | r| r|dt|krPn| s| r| r|r|j||d7}qPq| | kr|j| | f|d7}q|j| ||df|d7}qW|j||||fS(ss Parse options like getopt, but ignores unknown options and abbreviated forms If gnu=False, this stops processing options as soon as a non/unknown-option argument is encountered. Otherwise, option and non-option arguments may be intermixed, and unknown-option arguments are taken as non-option. If keepsep=True, '--' won't be removed from the list of arguments left. This is useful for stripping early options from a full command arguments. >>> def get(args, gnu=False, keepsep=False): ... return earlygetopt(args, b'R:q', [b'cwd=', b'debugger'], ... gnu=gnu, keepsep=keepsep) default parsing rules for early options: >>> get([b'x', b'--cwd', b'foo', b'-Rbar', b'-q', b'y'], gnu=True) ([('--cwd', 'foo'), ('-R', 'bar'), ('-q', '')], ['x', 'y']) >>> get([b'x', b'--cwd=foo', b'y', b'-R', b'bar', b'--debugger'], gnu=True) ([('--cwd', 'foo'), ('-R', 'bar'), ('--debugger', '')], ['x', 'y']) >>> get([b'--unknown', b'--cwd=foo', b'--', '--debugger'], gnu=True) ([('--cwd', 'foo')], ['--unknown', '--debugger']) restricted parsing rules (early options must come first): >>> get([b'--cwd', b'foo', b'-Rbar', b'x', b'-q', b'y'], gnu=False) ([('--cwd', 'foo'), ('-R', 'bar')], ['x', '-q', 'y']) >>> get([b'--cwd=foo', b'x', b'y', b'-R', b'bar', b'--debugger'], gnu=False) ([('--cwd', 'foo')], ['x', 'y', '-R', 'bar', '--debugger']) >>> get([b'--unknown', b'--cwd=foo', b'--', '--debugger'], gnu=False) ([], ['--unknown', '--cwd=foo', '--', '--debugger']) stripping early options (without loosing '--'): >>> get([b'x', b'-Rbar', b'--', '--debugger'], gnu=True, keepsep=True)[1] ['x', '--', '--debugger'] last argument: >>> get([b'--cwd']) ([], ['--cwd']) >>> get([b'--cwd=foo']) ([('--cwd', 'foo')], []) >>> get([b'-R']) ([], ['-R']) >>> get([b'-Rbar']) ([('-R', 'bar')], []) >>> get([b'-q']) ([('-q', '')], []) >>> get([b'-q', b'--']) ([('-q', '')], []) '--' may be a value: >>> get([b'-R', b'--', b'x']) ([('-R', '--')], ['x']) >>> get([b'--cwd', b'--', b'x']) ([('--cwd', '--')], ['x']) value passed to bool options: >>> get([b'--debugger=foo', b'x']) ([], ['--debugger=foo', 'x']) >>> get([b'-qfoo', b'x']) ([], ['-qfoo', 'x']) short option isn't separated with '=': >>> get([b'-R=bar']) ([('-R', '=bar')], []) ':' may be in shortlist, but shouldn't be taken as an option letter: >>> get([b'-:', b'y']) ([], ['-:', 'y']) '-' is a valid non-option argument: >>> get([b'-', b'y']) ([], ['-', 'y']) is--ii(tlenRtappendtextend( targsRRtgnutkeepsept parsedoptst parsedargstposRRthasvalRttakeval((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyt earlygetopt\s.R   #    t customoptcB@sDeZdZejZdZdZdZej dZ RS(s2Manage defaults and mutations for any type of opt.cC@s ||_dS(N(t _defaultvalue(tselft defaultvalue((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyt__init__scC@stS(N(R(R'((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyt _isbooloptscC@s|jS(sReturns the default value for this opt. Subclasses should override this to return a new value if the value type is mutable.(R&(R'((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pytgetdefaultvaluescC@sdS(szAdds newparam to oldstate and returns the new state. On failure, abort can be called with a string error message.N((R'toldstatetnewparamtabort((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pytnewstates( t__name__t __module__t__doc__tabctABCMetat __metaclass__R)R*R+tabstractmethodR/(((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyR%s     t _simpleoptcB@seZdZdZRS(cC@st|jttdfS(N(t isinstanceR&R ttypetNone(R'((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyR*scC@s|S(N((R'R,R-R.((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyR/s(R0R1R*R/(((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyR7s t _callableoptcB@seZdZdZRS(cC@s#||_tt|jddS(N(t callablefntsuperR;R)R:(R'R<((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyR)s cC@s |j|S(N(R<(R'R,R-R.((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyR/s(R0R1R)R/(((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyR;s t_listoptcB@seZdZdZRS(cC@s|jS(N(R&(R'((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyR+scC@s|j||S(N(R(R'R,R-R.((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyR/s (R0R1R+R/(((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyR>s t_intoptcB@seZdZRS(cC@s6yt|SWn!tk r1|tdnXdS(Ns expected int(tintt ValueErrorR(R'R,R-R.((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyR/s (R0R1R/(((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyR?scC@sst|tr|St|r)t|St|trCt|St|tdkret|St|SdS(s<Returns a default opt implementation, given a default value.iN( R8R%tcallableR;tlistR>R9R?R7(tdefault((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyt _defaultopts    c@s|d kri}ng}d}i}i} i} td|D} x|D]} t| dkr| \} }}}}n| \} }}}|g}|j|j|g|jdd}||d| 4siRRs--R Rsno-iRc@s/tjtdtj|fdS(Ns"invalid value %r for option %s, %s(RtAbortRRt maybebytestr(ts(toptR(s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyR.tsN(R:tsetRRtgettreplaceRER+R*t nevernegateR Rt functoolstpartialR$Rt gnugetoptbtgetoptbRRR/(RtoptionststateRtearlyt optaliasesRRtargmaptdefmapt negationstalllongtoptiontshorttnameRDtcommenttdummytonamestntinserttparsetoptstboolvaltnegationtobjR.((RKRs9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyt fancyoptssn                    %(t __future__RR3RPti18nRR RRRORRR$tobjectR%R7R;R>R?RER:Ri(((s9/usr/lib64/python2.7/site-packages/mercurial/fancyopts.pyts     >q