o ]Lb/@sddlmZddlZddlmZddlmZmZmZm Z m Z m Z m Z m Z mZmZddlmZmZmZiZe eZejfddZd d d ed ed fdddedfdddedfdddedfdddedfdddedfdddedfd d!ded"fd#d$ded%fd#d&ded'fd#d(ded)fd#d*ded+fd#d,ded-fg ejejejed.d/d0Zd1d2ZeZ d3d4ed5ej!DZ"d6d7Z#d8d9Z$d:d;Z%edd?d@Z&dS)A)absolute_importN)_) commandsencodingerror extensions logcmdutilpatchpycompat registrarscmutilutil)contextr formatterc #sjdd}|rFtjjtjt}|dkr d}tfddt j Dr/d}nfdd |D}tfd d|DrFd}|rW|D] }tj ||VqJdSd d } t |} tj| || d } | | D]}|VqodS)z&generate paths matching given patterns fastannotatesperfhack.c3s|] }|dVqdS)rNget).0oopts=/usr/lib/python3/dist-packages/hgext/fastannotate/commands.py 2sz_matchpaths..Fcs*g|]}tj|rtj|n|qSr)ospathisabsrelpath)rp)reporootrr 5sz_matchpaths..c3s2|]}d|vptjt|j VqdS)s..N)rrisfile facontext pathhelper linelogpath)rf)aoptsreporrr:s cSstd||f)Ns%s: %s)rAbort)xyrrrbadLsz_matchpaths..bad)badfnN)ui configboolrrdirnamer rgetcwdanyrwalkoptsjoinr revsingler matchwalk) r*revpatsrr)perfhackreldirrelpatsr!r.ctxmr)r)rr*r"r _matchpaths$s4   rArrevrsannotate the specified revisionREVuuserslist the author (long with -v)ffileslist the filenameddateslist the date (short with -q)nnumbers"list the revision number (default)c changesetslist the changesetls line-numbers(show line number at the first appearanceedeleteds(show deleted lines (slow) (EXPERIMENTAL)rs no-contents'do not show file content (EXPERIMENTAL)s no-followsdon't follow copies and renameslinearsEenforce linear history, ignore second parent of merges (EXPERIMENTAL)s long-hashs'show long changeset hash (EXPERIMENTAL)rebuilds.rebuild cache even if it exists (EXPERIMENTAL)s3[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...T)optionssynopsis inferrepoc s$|s ttd|ddr|}tdd}dd}tj |dd d }t j |d d d d d }t fdddDsY| dddgD]}d |<qR|dd} | dkrot||} nt||} dd} td } dd} |ddp|}tt||||}t|dr|||D]b}d}}} z7t ||||%}|j||| | o| d}| rdd|D}|j|| | d}Wdn1swYWntjtjfy|rd }Yqw| r|\}}| j|||dq| dS) ashow changeset information by line for each file List changes in files, showing the revision id responsible for each line. This command is useful for discovering when a change was made and by whom. By default this command prints revision numbers. If you include --file, --user, or --date, the revision number is suppressed unless you also include --number. The default format can also be customized by setting fastannotate.defaultformat. Returns 0 on success. .. container:: verbose This command uses an implementation different from the vanilla annotate command, which may produce slightly different (while still reasonable) outputs for some cases. Unlike the vanilla anootate, fastannotate follows rename regardless of the existence of --file. For the best performance when running on a full repo, use -c, -l, avoid -u, -d, -n. Use --linear and --no-content to make it even faster. For the best performance when running on a shallow (remotefilelog) repo, avoid --linear, --no-follow, or any diff options. As the server won't be able to populate annotate cache when non-default options affecting results are used. s,at least one filename or pattern is requiredrunfilteredreporCrrSFannotateT)section whitespacerRs no_follow)diffopts followmerge followrenamec3s|]}|VqdS)Nr)rsrrrrs  zfastannotate..)rFrJrHrLrNs defaultformatrLstemplatesjsonrQs no_contentrH mainbranchprefetchfastannotateN)mastershowpath showlinescSsh|] }|d|dfqS)rrr)rlrrr szfastannotate..)rbrc) existinglines)!rr+rr1 unfilteredr byteskwargsrr difffeatureoptsr% annotateoptsr4 configlistpager faformatter jsonformatterdefaultformatterboolconfiglistrAr safehasattrr`annotatecontextannotateannotatealllinesfaerrorCannotReuseErrorCorruptedFileErrorwriteend)r0r*r;rr:rebuildr[r)nametemplater showdeletedrcrbrapathsrresultlinesrfarrr fastannotates~                  rcCsh|] }|dddqS)r-_)replace)roptrrrresrerTcOs|ddr |}|ddrd|d<|d}t|dr4|dur4tt|||t|}| ||||g|Ri|S) zused by wrapdefaultrrWs forcetextTtextr:r`N) r1rgrr rsrrrAr rhr`)origr0r*r;rr:rrrr_annotatewrapper s    rcCs d}t|fddittdS)z!register the fastannotate commandsfastannotate|fastblame|fa helpbasicTN)commandfastannotatecommandargsr)r}rrrregistercommandsrcCsttjdtdS)z>wrap the default annotate command, to be aware of the protocolrXN)r wrapcommandrtablerrrrr wrapdefault"srsdebugbuildannotatecaches!build up to the specific revisions[-r REV] FILE...c Ost|}|dp|dd}|stjtdtdd|ddr'|}t ||}t |||}t ||}t|drT|drMttd ||d S|jtd t|d }t|D]s\} } || t|| \} z| |rWWd qc| ||Wn>tjtjfy|d | | z| ||Wnty} z| td| | fWYd } ~ nd } ~ wwYnwWd n1swYqc|!d S)aincrementally build fastannotate cache up to REV for specified files If REV is not specified, use the config 'fastannotate.mainbranch'. If fastannotate.client is True, download the annotate cache from the server. Otherwise, build the annotate cache locally. The annotate cache will be built using the default diff and follow options and lives in '.hg/fastannotate/default'. rDrr_syou need to provide a revisions(set fastannotate.mainbranch or use --rev)hintrWr`s--rev cannot be used for clientsbuilding)totalNs*fastannotate: %s: rebuilding broken cache s,fastannotate: %s: failed to build cache: %r )"r rhrrqrr+rr1rgrr7r r8rrr9r rsr` makeprogresslen enumerateupdater%rt isuptodaterurwrxrydebugr| Exceptionwarncomplete) r0r*r;rr:r?r@rprogressiractxexrrrdebugbuildannotatecache's`        r)' __future__rrmercurial.i18nr mercurialrrrrrr r r r r rr%rwrrmcmdtabler defaultoptsrA diffwsoptsr5 formatteroptsrrset_newopts globalopts _knownoptsrrrrrrrrs  0  3 01239t