o ]LbG@sdZddlmZddlZddlmZejr'ddlmZm Z m Z m Z m Z m Z mZddZGd d d eZGd d d eeZGd ddeZGdddeZGdddeZGdddeZGdddeZGdddeeZGdddeZGdddeZGdddeZGdd d eZGd!d"d"eZ Gd#d$d$eZ!Gd%d&d&eZ"Gd'd(d(eZ#Gd)d*d*e#Z$Gd+d,d,eZ%Gd-d.d.eZ&Gd/d0d0eZ'Gd1d2d2eZ(Gd3d4d4eZ)Gd5d6d6eZ*Gd7d8d8eZ+Gd9d:d:eZ,Gd;d<dd>e-Z.Gd?d@d@e-Z/GdAdBdBeZ0GdCdDdDeZ1GdEdFdFe1Z2GdGdHdHeZ3GdIdJdJeZ4GdKdLdLe4Z5GdMdNdNe4Z6dOdPZ7dQdRZ8GdSdTdTe3Z9GdUdVdVeeZ:GdWdXdXe:Z;GdYdZdZe;ZGd_d`d`e?Z@GdadbdbeZAGdcddddeZBGdedfdfe?ZCGdgdhdheCZDGdidjdjeCZEGdkdldleFZGGdmdndneZHGdodpdpeIZJGdqdrdreZKGdsdtdteFZLGdudvdveeFZMGdwdxdxeZNGdydzdzeOZPGd{d|d|ePZQGd}d~d~eFZRGdddeZSGdddeZTGdddeZUGdddeZVGdddeZWGdddeZXGdddeZYGdddeZZGdddeZ[dS)zdMercurial exceptions. This allows us to catch exceptions at higher levels without forcing imports. )absolute_importN)pycompat)AnyAnyStrIterableListOptionalSequenceUnioncCsB|jsdSt|jdkrt|jdSdddd|jDS)z?Byte-stringify exception in the same way as BaseException_str()rrs(%s), css|] }dt|VqdS)s'%s'N)rbytestr).0ar1/usr/lib/python3/dist-packages/mercurial/error.py (sz_tobytes..)argslenrrjoin)excrrr_tobytes!s rcs eZdZdZfddZZS)HintzMix-in to provide a hint of an error This should come first in the inheritance list to consume a hint and pass remaining arguments to the exception class. cs(|dd|_tt|j|i|dS)Nhint)poprsuperr__init__)selfrkw __class__rrr2sz Hint.__init____name__ __module__ __qualname____doc__r __classcell__rrr rr+src@s@eZdZdZdZdZd ddZddZej rddZ d d Z dS) Errorz Base class for Mercurial errors.NcCs||_||_t||dSN)messager Exceptionr)rr*rrrrr=szError.__init__cCs|jSr))r*rrrr __bytes__EszError.__bytes__cCst|Sr))rsysstrr-r,rrr__str__Jsz Error.__str__cC6ddlm}|d|j}|jr||d|j7}|S)Nr_s abort: %s (%s) i18nr2r*rrr2r*rrrformatQ z Error.formatr)) r#r$r%r&coarse_exit_codedetailed_exit_coderr-rispy3r/r7rrrrr(7s  r(c@eZdZdZdS)Abortz5Raised if a command needs to print an error and exit.Nr#r$r%r&rrrrr=[r=c@eZdZdZdZdS) StorageErrorzmRaised when an error occurs in a storage layer. Usually subclassed by a storage-specific exception. 2Nr#r$r%r&r:rrrrrA_rAc@ eZdZdS) RevlogErrorNr#r$r%rrrrrFhrFc@eZdZddZdS)SidedataHashErrorcCsd|_||_||_||_dSr))r sidedatakeyexpecteddigest actualdigest)rkeyexpectedgotrrrrms zSidedataHashError.__init__Nr#r$r%rrrrrrJl rJc@eZdZeZdS)FilteredIndexErrorNr#r$r%rr-rrrrrTur?rTc@s$eZdZddZddZddZdS) LookupErrorcCs\||_||_||_t|trt|dkrddlm}||}t |d|t ||fdS)Nr)hexs %s@%s: %s) nameindex lookupmessage isinstancebytesrnoderXrFrrr)rrYrZr*rXrrrrzs zLookupError.__init__cC t|Sr))rFr-r,rrrr- zLookupError.__bytes__cCr_r))rFr/r,rrrr/r`zLookupError.__str__N)r#r$r%rr-r/rrrrrVys rVc@rE)AmbiguousPrefixLookupErrorNrGrrrrrarHrac@rE)FilteredLookupErrorNrGrrrrrbrHrbc@rE)ManifestLookupErrorNrGrrrrrcrHrcc$eZdZdZfddZeZZS) CommandErrorz7Exception raised on errors in parsing the command line.c||_||_tt|dSr))commandr*rrer)rrgr*r rrrzCommandError.__init__r#r$r%r&rrr-r'rrr rre  recs&eZdZdZdfdd ZeZZS)UnknownCommandz8Exception raised if command is not in the command table.Ncrfr))rg all_commandsrrkr)rrgrlr rrrrhzUnknownCommand.__init__r)rirrr rrks rkcrd)AmbiguousCommandzCException raised if command shortcut matches more than one command.crfr))prefixmatchesrrmr)rrnror rrrrhzAmbiguousCommand.__init__rirrr rrmrjrmcrd) WorkerErrorz,Exception raised when a worker process dies.cs||_tt||dSr)) status_coderrpr)rrqr rrrszWorkerError.__init__rirrr rrprjrpc@s eZdZdZdZdZddZdS)InterventionRequiredzrrrrrr?rc@r@) HookAbortzjraised when a validation hook fails, aborting an operation Exists to allow more specialized catching.(NrCrrrrrsrc.eZdZdZdZdfdd ZddZZS) ConfigErrorz*Exception raised when parsing config filesNctt|j||d||_dSNr)rrrlocationrr*rrr rrr& zConfigError.__init__cC\ddlm}|jdur|dt|j|jf}n|d|j}|jr,||d|j7}|S)Nrr1sconfig error at %s: %s sconfig error: %s r3r5r2rrrr*rr6rrrr7+   zConfigError.formatNNr#r$r%r&r:rr7r'rrr rr! rc@r<) UpdateAbortz6Raised when an update is aborted for destination issueNr>rrrrr;r?rc@r<)MergeDestAbortz7Raised when an update is aborted for destination issuesNr>rrrrr?r?rc@r<)NoMergeDestAbortzBRaised when an update is aborted because there is nothing to mergeNr>rrrrrCr?rc@r<)ManyMergeDestAbortzARaised when an update is aborted because destination is ambiguousNr>rrrrrGr?rc@rt)ResponseExpectedz+Raised when an EOF is received for a promptcCs ddlm}t||ddS)Nrr1sresponse expected)r5r2r=r)rr2rrrrNs zResponseExpected.__init__NrwrrrrrKrxrc@r@) RemoteErrorz:Exception raised when interacting with a remote repo failsdNrCrrrrrTrc"eZdZdZdfdd ZZS)OutOfBandErrorz3Exception raised when a remote repo reports failureNcsDddlm}|r|d|d}n|d}tt|j||ddS)Nrr1sremote error: %s s remote errorr)r5r2rstriprrr)rr*rr2r rrr]s zOutOfBandError.__init__rr"rrr rrZrcr) ParseErrorz@Raised when parsing config files and {rev,file}sets (msg[, pos])rzNcrr)rrrrrr rrrnrzParseError.__init__cCr)Nrr1shg: parse error at %s: %s shg: parse error: %s r3rr6rrrr7srzParseError.formatrrrrr rrirrc@rS) PatchErrorNrUrrrrrr?rc@rS)PatchParseErrorNrUrrrrrr?rc@rS)PatchApplicationErrorNrUrrrrrr?rcsfddfdd|DS)Ncstd|Sr))difflibSequenceMatcherratio)x)valuerrszgetsimilar..csg|] }|dkr|qS)g333333?r)rs)simrr szgetsimilar..r)symbolsrr)rrr getsimilars rcCsJddlm}t|dkr|d|dS|r#dt|}|d|SdS)Nrr1sdid you mean %s?rr sdid you mean one of %s?)r5r2rrsorted)similarr2ssrrrsimilarity_hints   rc@rt)UnknownIdentifierzFException raised when a {rev,file}set references an unknown identifiercCs:ddlm}t||}t|}tj||d||ddS)Nrr1sunknown identifier: %sr)r5r2rrrr)rfunctionrr2rrrrrrs   zUnknownIdentifier.__init__Nrwrrrrrrxrc@rS) RepoErrorNrUrrrrrr?rc@rE)RepoLookupErrorNrGrrrrrrHrc@rE)FilteredRepoLookupErrorNrGrrrrrrHrc@rE)CapabilityErrorNrGrrrrrrHrc@r<)RequirementErrorz6Exception raised if .hg/requires has an unknown entry.Nr>rrrrrr?rc@rt) StdioErrorz'Raised if I/O to stdout or stderr failscCst||j|jdSr))IOErrorrerrnostrerror)rerrrrrrszStdioError.__init__Nrwrrrrrrxrc@rI)UnsupportedMergeRecordscCsBddlm}t||_d|j}tj||d||dddS)Nrr1 s#unsupported merge state records: %ssIsee https://mercurial-scm.org/wiki/MergeStateRecords for more informationr)r5r2r recordtypesrr=r)rrr2rrrrrs     z UnsupportedMergeRecords.__init__NrQrrrrrrRrcr)UnknownVersionzHgeneric exception for aborting from an encounter with an unknown versionNcs||_tt|j||ddSr)versionrrr)rmsgrrr rrrszUnknownVersion.__init__rr"rrr rrrrc@rI) LockErrorcCst||||||_dSr))rrdesc)rrrfilenamerrrrrs zLockError.__init__NrQrrrrrrRrc@rI)LockHeldcCst||d||||_dS)Ns Lock held)rrlocker)rrrrrrrrrs zLockHeld.__init__NrQrrrrrrRrc@rE)LockUnavailableNrGrrrrrrHrc@rS) LockInheritanceContractViolationNrUrrrrrr?rc@eZdZdZeZdS) ResponseErrorz6Raised to print an error with part of output and exit.Nr#r$r%r&rr-rrrrrrrc@r<)SignalInterruptz'Exception raised on SIGTERM and SIGHUP.Nr>rrrrr r?rc@rS)SignatureErrorNrUrrrrrr?rc@r) PushRacedz?An exception raised during unbundling that indicate a push raceNrrrrrrrrcrd)ProgrammingErrorzBRaised if a mercurial (core or extension) developer made a mistakecs,t|}tt|j|g|Ri|dSr))rr.rrr)rrrkwargsr rrrs "zProgrammingError.__init__rirrr rrs  rc@r)WdirUnsupportedz;An exception which is raised when 'wdir()' is not supportedNrrrrrr'rrc@r)BundleValueErrorz-error raised when bundle2 cannot be processedNrrrrrr.rrc@seZdZdddZdS)BundleUnknownFeatureErrorNrc Cs||_||_||_|jdurd}n|}|j}|jrO|jrOt|jt|jks(Jg}t|jD]\}}|j|}|durB||q/|d|t|fq/|rZd|d|f}t ||dS)NsStream Parameters%s=%rs%s - %sr ) parttypeparamsvaluesr enumerateappendr maybebytestrr ValueErrorr) rrrrrentriesidxparvalrrrr5s$    z"BundleUnknownFeatureError.__init__)NrrrQrrrrr4src@r)ReadOnlyPartErrorzrrrrrrr?rc@r)InvalidBundleSpecificationz{error raised when a bundle specification is invalid. This is used for syntax errors as opposed to support errors. Nrrrrrr{rDrc@r)UnsupportedBundleSpecificationz:error raised when a bundle specification is not supported.Nrrrrrrrrc@r)CorruptedStatezCerror raised when a command is not able to read its state from fileNrrrrrrrrc@r<)PeerTransportErrorz>Transport-level I/O error when communicating with a peer repo.Nr>rrrrrr?rc@r)InMemoryMergeConflictsErrorzFException raised when merge conflicts arose during an in-memory merge.Nrrrrrrrrc@seZdZdZdddZdS)WireprotoCommandErrorzRepresents an error during execution of a wire protocol command. Should only be thrown by wire protocol version 2 commands. The error is a formatter string and an optional iterable of arguments. NcCs||_||_dSr))r* messageargs)rr*rrrrrs zWireprotoCommandError.__init__r)rwrrrrrsr)\r& __future__rrr TYPE_CHECKINGtypingrrrrr r r robjectrr+r(r=rArFrJ IndexErrorrTKeyErrorrVrarbrcrerkrmrprrruryr{r|r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrr RuntimeErrorrrKeyboardInterruptrrrrrrrrrrrrrrrrrrrrrrs  $   $