o ]Lb @sddlmZddlZddlZddlZddlZddlmZddl m Z m Z m Z ddl mZmZmZddlmZddlmZmZmZmZmZmZmZmZmZmZm Z!m"Z#m$Z$m%Z%m&Z&m'Z'm(Z(m Z m)Z)m*Z*m+Z+m,Z,m-Z.m/Z/m0Z0m1Z1m2Z2m3Z4dd l5m6Z6m7Z7dd l8m9Z:e j;rdd lZ>e=e>fD]Z?e?sJqe2j@Z@d d dedfgZAdddedfgZBdddededfdddededfdddedfgZCddgededfddged edfgZDd!d"ded#ed$fd%d&ded'ed(fgZEd)d*ded+ed,fd-d.ded/ed0fgZFd1d2ded3fd4d5ded6fgZGd7d8ded9ed:fgZHdd;ded<ed=fd7d8ded9ed:fgZId>d?ded@fdAdBdedCfd%dDdedEedFfdGdHdedIfddJdedKfdLdMdedNfgeIZJdOdPdedQfdAdBdedRfddSdedTfddUdedVfgZKdWdXdedYfdZd[ded\fd]d^ded_fd`dadedbfgZLddcdeddfd>dededffddgdedhfgeLd4didedjedFfddJdedKfddkdedledmfgZMdndodedpedqfgZNdrdsdedtedufgZOdvdwdedxfgZPdydzd{ed|fd!d}d{ed~fdddedfgZQdZRddZSddZTddZUddZVddZWddZXddZYddZZddZ[dddZ\dddZ]ddZ^Gddde_Z`ddZaddZbejcddGddde_ZdddZedddZfdddZgddZhddZidddZjddZkddZl d ddZmddZnddZodddZpd!ddZqd"ddZrddZsddÄZtGddńde_Zud#ddȄZvdddʄZwdd̄Zxddd΄ZgZygZziZ{iZ|ddЄZ}gZ~iZdd҄ZddԄZddքZdd؄Z {  d$ddۄZd%dd݄Zddd߄ZddZddZddZddZddZ dddZddZddZddZddZddZddZd&ddZ    {d'ddZddZddZddZd(ddZddZddZ { d)dd Ze2Ze2Ze2Zd*d d Zd d ZddZddZddZddZddZddZddZdS(+)absolute_importN)_)hexnullrevshort)getattropensetattr)attr) bookmarks changelogcopiescrecord dirstateguardencodingerror formatter logcmdutilmatchmerge mergestate mergeutilobsoletepatchpathutilphasespycompatrepairrevlog rewriteutilscmutilstate subrepoutil templatekw templaterutilvfs)dateutil stringutil) constants)AnyDictnsdry-runs)do not perform actions, just print outputsconfirmsask before applying actionsessshsspecify ssh command to usesCMDs remotecmds,specify hg command to run on the remote sidesinsecures>do not verify server certificate (ignoring web.cacerts config)Isincludes)include names matching the given patternssPATTERNXsexcludes)exclude names matching the given patternsmmessagesuse text as commit messagesTEXTllogfilesread commit message from filesFILEddates(record the specified date as commit datesDATEuusers&record the specified user as committersUSERDs currentdates&record the current date as commit dateUs currentusers$record the current user as committerTstemplatesdisplay with templatesTEMPLATEsstyles,display using template map file (DEPRECATED)sSTYLEpspatchs show patchgsgitsuse git extended diff formatslimits!limit number of changes displayedsNUMMs no-mergessdo not show mergessstats(output diffstat-style summary of changesGsgraphsshow the revision DAGastextstreat all files as texts0use git extended diff format (DEFAULT: diff.git)sbinarys+generate binary diffs in git mode (default)snodatessomit dates from diff headerswsignore-all-spaces'ignore white space when comparing linesbsignore-space-changes+ignore changes in the amount of white spaceBsignore-blank-liness(ignore changes whose lines are all blankZsignore-space-at-eols#ignore changes in whitespace at EOLsnoprefixs&omit a/ and b/ prefixes from filenamess show-functions>show which function each change is in (DEFAULT: diff.showfunc)sreverses&produce a diff that undoes the changessunifieds"number of lines of context to showsroots&produce diffs relative to subdirectorysDIRtstoolsspecify merge toolsTOOLs similaritys-guess renamed files by similarity (0<=s<=100)s SIMILARITYSsubrepossrecurse into subrepositoriesc changelogFsopen changelogmanifests open manifestdirsopen directory manifests:^HG: ------------------------ >8 ------------------------$cGsJdd}d}|D]}||r"|r ttd||||f|}q|S)zabort if more than one of the arguments are in opts Returns the unique argument or None if none of them were specified. cSst|ddS)N_-)rsysbytesreplacenamerU3/usr/lib/python3/dist-packages/mercurial/cmdutil.py to_displayz)check_at_most_one_arg..to_displayNs!cannot specify both --%s and --%s)getr InputErrorr)optsargsrWpreviousxrUrUrVcheck_at_most_one_args r_cCs|D]}t|||qdS)zabort if the first argument is given along with any of the others Unlike check_at_most_one_arg(), `others` are not mutually exclusive among themselves, and they're passed as a single collection. N)r_)r[firstothersotherrUrUrVcheck_incompatible_arguments&srccCst|ddt|ddd}|drdt|d<n|ds8|ddr8|dd ur8dt|d<d }|drC||d<|S) zmodify commit options dict to handle related options The return value indicates that ``rewrite.update-timestamp`` is the reason the ``date`` option is set. date currentdateuser currentuserFs%d %drewritesupdate-timestampNT)r_rYr(makedate configboolusername)uir[ datemaydifferrUrUrVresolve_commit_options0s      rncCsF|d}|s dSt|dkrttdd|vr!ttddS)z!make sure note is of valid formatnoteNs*cannot store a note of more than 255 bytes snote cannot contain a newline)rYlenrrZr)r[rorUrUrVcheck_note_sizeKs  rscCtjtjf}t||SN) crecordmoduihunkr recordhunk isinstance)r^ hunkclassesrUrUrVishunkX  r{cCrtru)rvuiheaderrheaderry)r^ headerclassesrUrUrVisheader]r|rcCsXt}t}|D]}t|r'|r'|||t||hq||fSru)setr isnewfileaddfilenameupdatefiles)chunksnewlyaddedandmodifiedfiles alsorestorechunkrUrUrVnewandmodifiedbsrcCs^|d}t|}g}|D]}d|vr'|dd}||vr'||||q |||S)N|rPr.)splitrrRrappendextend)cmd base_aliases all_aliases extra_aliasesalias folded_aliasrUrUrV parsealiasesls     rcs,dd|jfdd}t|d|S)Ncs<|dd}tfddD] \}}||||dqdS)Nlabelr.cSrurUrUr\rUrV~z8setupwrapcolorwrite..wrapwrite..r)popr difflabel)origr\kwrrlrUrrV wrapwrite|s z&setupwrapcolorwrite..wrapwritecsg|Ri|SrurU)r\kwargsoldwriterrUrVwrapz!setupwrapcolorwrite..wrapwrite)rr )rlrrUrrVsetupwrapcolorwritezs  rc Csz|r|r t|tj}ntj}t||||WSWn!tjy;}z|d||tdWYd}~nd}~wwt||||S)N%s sfalling back to text mode ) rv testdecoratortestchunkselector chunkselector filterpatch fallbackerrorwarnrr)rl originalhunks usecursestestfiler operationrecordfnerUrUrV filterchunkss" rc CsNt|}|dd}t|}zt||||||\}}W||_||fS||_w)aPrompts the user to filter the originalhunks and return a list of selected hunks. *operation* is used for to build ui messages to indicate the user what kind of filtering they are doing: reverting, committing, shelving, etc. (see patch.filterpatch). experimentals crecordtest)rv checkcursesconfigrrr) rlrrrrrr newchunksnewoptsrUrUrV recordfilters    rc svt|}|s|rtd|}ntd}t||ds$|fddfdd} t||| |S)Ns)running non-interactively, use %s insteadsrunning non-interactivelyr9c*s|ds tddd}t|dk}|r ttddd}|d }|s1t||}j |d } d di} j | d St t | jt | jt | jt | jt | jt | jt | j} tjj || |dd \} } }| D]}|| vr||d}t|qzWdn1swY|s||| |tj||dddd}d|_d|_d|_ tj!| |d}t"|}t #d}z |||\}}Wn,tj$y}z ttd|d}~wtj%y}z t&td|d}~ww|'|t(|\}t)|D]}t*|r&'t)|+q| j| j| j}fdd|D}|sF| tddSt)| jrQ|}n fdd|D}i}|rj,-d}zt./|Wnt0y}z|j1t1j2kr~WYd}~nd}~wwz`|D]/}t3j4t.j56|d|d\}} t.7||8d|| ft9j:;|| dd| ||<qt<}!|D]}"|"=}#|#|vr|">|!q|!?}$|!@d|ddrtAjBtAjC|!D}%|jE|%d d!j5d"}&|!Fd|!>|&|!@dfd#dD|r(t Gt)|H|B}'tIjJd|'d$|$roz|8d%|8|!KtjL||!ddd&Wn+tj$yY}ztt3M|d}~wtj%yn}zt&t3M|d}~ww~!fd'd|D}|g|Rit3N|WzXjO}(t3P|D]C\})} |8d(| |)f|(Q|)jRr|(S|(jT|)dddd)Wdn 1swYt9j:| ;|)ddt.U| q|rt.V|WSWSt0yYSwzXjO}(t3P|D]C\})} |8d(| |)f|(Q|)jRr&|(S|(jT|)dddd)Wdn 1s!wYt9j:| ;|)ddt.U| q|rBt.V|WwWwt0yMYww)*a%This is generic record driver. Its job is to interactively filter local changes, and accordingly prepare working directory into a state in which the job can be delegated to a non-interactive commit command such as 'commit' or 'qrefresh'. After the actual job is done by non-interactive command, the working directory is restored to its original state. In the end we'll record interesting changes, and everything else will be left in place, so the user can continue working. sinteractive-unshelveT)commitNrs9cannot partially commit a merge (use "hg commit" instead)cSstd||f)Ns%s: %s)rrZ)fmsgrUrUrVfailrXz*dorecord..recordfunc..failforcer)uiscommitsubrepossrecord)forcecommandsscommit.interactive.)r[ whitespacesection configprefix)changesr[error parsing patch: %serror applying patch: %scsg|]}|vr|qSrUrU.0r) contendersrUrV z0dorecord..recordfunc..sno changes to record rcs g|] }|vs |vr|qSrUrUr)modifiedrrUrVr+s srecord-backups.)prefixdirsbackup %r as %r copystatsreviewFr.sdiff)actionrepopathcsg|] }t|qSrU)osunlinkwjoinrcreporUrVrYmatchersapplying patch eolmodecsg|]}|qSrU)r)rnfrrUrVrpsrestoring %r to %r  p1_tracked wc_trackedpossibly_dirty)WrYcheckunfinishedrrparentsrrZrmatchmodbadmatchstatusrlconfigoverrider!copymodcopyraddedremoveddeletedunknownignoredcleanr# precommitsub dirtyreasonAbortcheckcommitpatternsrdifffeatureoptsnodatesgitshowfuncdiff parsepatchrPatchParseErrorPatchApplicationError StateErrorrrrrrr'joinrmkdirOSErrorerrnoEEXISTrmkstemppathbasenameclosedebugr&copyfilerstringiorrtellseekrv diffhelptext patchhelptextreadedittruncate matchfileskeysmergemod revert_togetvalue internalpatchbytestr strkwargsdirstate iteritems get_entry maybe_clean parentchange update_filerrmdir)*rlrmessagerr[wctxrrrr overrides tmpstatussubs commitsubsnewstatesrdiffopts originaldifforiginal_headersrrerrrhchangednewfilestobackupbackups backupdirrfdtmpnamefprfnamedopatch patchtext reviewedpatchmr#realname) backupall commitfuncfilterfnpats)rrrrrV recordfuncsh                                     zdorecord..recordfunccs<||||||WdS1swYdSru)wlock)rlrr*rr[)rIrUrV recordinwlocks $zdorecord..recordinwlock) r byteskwargs interactiverrrZrYrkr) rlrrF cmdsuggestrErGrHr[rrKrU)rErFrGrHrIrVdorecords    XrOc@s8eZdZdZddZddZddZdd Zd d Zd S) dirnodea Represent a directory in user working copy with information required for the purpose of tersing its status. path is the path to the directory, without a trailing '/' statuses is a set of statuses of all files in this directory (this includes all the files in all the subdirectories too) files is a list of files which are direct child of this directory subdirs is a dictionary of sub-directory name as the key and it's own dirnode object as the value cCs||_t|_g|_i|_dSru)rrstatusesrsubdirs)selfdirpathrUrUrV__init__s zdirnode.__init__cCs|j||fdS)z/Add a file in this directory as a direct child.N)rr)rSrrrUrUrV _addfileindirszdirnode._addfileindircCs|d|vr)|dd\}}||jvrt|j|}t||j|<|j|||n|||||jvr<|j |dSdS)z Add a file to this directory or to its direct parent directory. If the file is not direct child of this directory, we traverse to the directory of which this file is a direct child of and add the file there. /rN) rrRrrrrPaddfilerVrQr)rSrrsubdirfilep subdirpathrUrUrVrXs    zdirnode.addfileccs*|jD]\}}|t|j|fVqdS)z=Yield (status, path) for files directly under this directory.N)rrrr)rSrstrUrUrV iterfilepathsszdirnode.iterfilepathsccst|jdkr|j}||vr||jdfVdS|D] \}}||fVq|jD]}||D] \}}||fVq5q.dS)a  Yield (status, path) obtained by processing the status of this dirnode. terseargs is the string of arguments passed by the user with `--terse` flag. Following are the cases which can happen: 1) All the files in the directory (including all the files in its subdirectories) share the same status and the user has asked us to terse that status. -> yield (status, dirpath). dirpath will end in '/'. 2) Otherwise, we do following: a) Yield (status, filepath) for all the files which are in this directory (only the ones in this directory, not the subdirs) b) Recurse the function on all the subdirectories of this directory rrWN)rrrQrrr]rRvalues tersewalk)rS terseargsonlystr\fpathdirobjrUrUrVr_s   zdirnode.tersewalkN) __name__ __module__ __qualname____doc__rUrVrXr]r_rUrUrUrVrPs rPcCsd}t|D]}||vrttd|qtd}d}i}|D]}|dd}t||D]} || |q.g||<q!|D] \} } ||  | q@|j D]} | |D] \} } ||  | qXqQg} |D]} ||  | || qitj| S)a Terse the status if all the files in a directory shares the same status. statuslist is scmutil.status() object which contains a list of files for each status. terseargs is string which is passed by the user as the argument to `--terse` flag. The function makes a tree of objects of dirnode class, and at each node it stores the information required to know whether we can terse a certain directory or not. )r2rArr6r8irKs'%s' not recognizedr.)smodifiedsaddedsdeletedscleanunknownsignoredsremovedrr)rr!rrZrrPrrXr]rrRr^r_sortr!r) statuslistr`allstr1rootobjpstatus tersedictattrname statuscharrr\rbrY tersedlistrUrUrVtersedirs0     rtcCs$|}dd|D}d|dS)z0Surround lineswith a comment char and a new linecSsg|]}d|qS)s# %srU)rlinerUrUrVr?z!_commentlines..rq) splitlinesr)rawlinescommentedlinesrUrUrV _commentlines<sr{T)frozenc@s`eZdZeZeZeZeZeZ ejde dZ dZ ddZ ddZdd Zd S) morestatusF)initdefaultsstatus.morestatuscCs4|j||jr||jvr|jdddSdSdS)NT) unresolved)_formattedpathsr activemergeunresolvedpathsdata)rSrfmrUrUrV formatfileMs zmorestatus.formatfilecCs|js|jr||jdd|jr-|j|jdtd|j}|jdt||jd|jr7|j|jd|||jrN|jdt|j|jddSdS)Ns morestatus)itemtype) unfinisheds.The repository is in an unfinished *%s* state.rr) unfinishedmsg) unfinishedopr startitemrrplainr{_label_formatconflicts)rSrstatemsgrUrUrV formatfooterRs$    zmorestatus.formatfootercsjsdSjr4dfddjD}td|}jD]}|jvr&q||jd|ddqntd}|jd t|j d dS) Nrqcs$g|]}dtjt|qS)s %s)r&pathtoreporootrgetcwd)rrrSrUrVros z/morestatus._formatconflicts..sSUnresolved merge conflicts: %s To mark files as resolved: hg resolve --mark FILEsfileT)rrrsNo unresolved merge conflicts.rr) rrrrrrrrr{r)rSr mergeliststrrrrUrrVris,   zmorestatus._formatconflictsN)rdrerfr ibrrrrrrrrrrrrUrUrUrVr}Cs r}cCsdt|}tj|}|}|s|sdSd}}}|r!|\}}|r)t|}t|j ||||S)z=Returns a morestatus object if the repo has unfinished state.N) statemod getrepostate mergestatemodrractivesortedrr}root)r statetuplerrrrrrUrUrVreadmorestatuss     rc Csi}i}||vr |g}n|}g}|D]E}t|}||d} ||vr(|} n|s8|D] } | |r7| } nq,| durY|ddsH| drQ|||f|| <q|||f|| <q|s`|r`|}||fS)z Return cmd -> (aliases, command table entry) for each matching command. Return debug commands (or their aliases) only if no normal command matches. Nrsdebug)rrr startswith) rtablestrictchoice debugchoicerallcmdsraliasesfoundarUrUrV findpossibles4  rcCs`t|||\}}||vr||St|dkr t|}t|||r*t|dSt||)z9Return (aliases, command table entry) for command string.rr)rrrrrAmbiguousCommandlistr^UnknownCommand)rrrrrclistrUrUrVfindcmds   rcs|a|B|d+t|t||}|s$td|d|}t |dkr7tt dt ||d|| }dd|D}|d sc||vrc||vrctt d |d |rptt d i}dd lm} |D]|} || } | |krqzfdd} |dt| |f} t| d<}}||vr||d}||vr||d}| j|||f| | |d }||}|f|<|dt|qzt j!||ddd|d}t |dkr+||}|dur+ddlm"}|j#||ddd|$t dt |Wdn 1sAwYWdn1sQwYWddSWddS1sjwYdS)z-Change the branch name of given revs to labelsbranchessempty revision set roots(%ld)rs,cannot change branch of non-linear revisionsschange branch ofcSsh|]}|qSrU)branch)rparentrUrUrV rvzchangebranch..rs(a branch of the same name already existssheads(%ld) - head()s)cannot change branch in middle of a stackcontextcs"z|WStjyYdSwru)rManifestLookupError)rnewctxrctxrUrV filectxfn s  zchangebranch..filectxfns*changing branch of '%s' from '%s' to '%s' s branch_changer)rfrdextrarsnew node id is %s s branch-changeTfixphaseN)hg) quietemptys changed branch on %d changesets )%rJlock transaction bailifchangedrrevrangerrZrevsrrrr precheckr`rrY branchmaprrrrnoderp1p2memctx descriptionrrfrd commitctxr! cleanupnodesrrr)rlrrrr[rootsrrpb replacementsrrev oldbranchrrrrmcnewnoder+newidrrUrrV changebranchs&                TrcCsNtjtj|ds%|tj|}}||krdStjtj|dr |S)Ns.hg)rrisdirrdirname)poldprUrUrVfindrepoCs rcCs|r|j|jkrtjtd|d|}|js#|js#|j s#|j r,tjtd|d|d}t |j D] }| |j|dq5dS)zenforce the precondition that working directory must be clean. 'merge' can be set to false if a pending uncommitted merge should be ignored (such as when 'update --check' runs). 'hint' is the usual hint given to Abort exception. soutstanding uncommitted mergehintsuncommitted changesN)r#rnullidrrrrrrrrrsubstaterr)rrrr\rr1rUrUrVrLs rc Cst|dd|d}|d}|sI|rIzt|r!|j}W|Sdt|}W|St yH}zt t d|t |jfd}~ww|S)z1get the log message according to -m and -l optionr3r5rqs"can't read commit message '%s': %sN)r_rYisstdiofilenamefinrrr&readfilerwIOErrorrrrr strtolocalstrerror)rlr[r*logfileinstrUrUrV logmessage_s&    rcCs>t|tr|r |dS|dSt|dkr|dS|dS)areturn appropriate editform name (referencing a committemplate) 'ctxorbool' is either a ctx to be committed, or a bool indicating whether merging is committed. This returns baseformname with '.merge' appended if it is a merge, otherwise '.normal' is appended. s.mergers.normal)ryboolrrr) ctxorbool baseformnamerUrUrV mergeeditformus rc s0|ssrfddSrfddStS)a&get appropriate commit message editor according to '--edit' option 'finishdesc' is a function to be called with edited commit message (= 'description' of the new changeset) just after editing, but before checking empty-ness. It should return actual text to be stored into history. This allows to change description before storing. 'extramsg' is a extra message to be shown in the editor instead of 'Leave message empty to abort commit' line. 'HG: ' prefix and EOL is automatically added. 'editform' is a dot-separated list of names, to distinguish the purpose of commit text editing. 'getcommiteditor' returns 'commitforceeditor' regardless of 'edit', if one of 'finishdesc' or 'extramsg' is specified, because they are specific for usage in MQ. cst|||dS)N) finishdescextramsgeditform)commitforceeditorrrr1rrrrUrVrs z!getcommiteditor..cst|||dS)Nr commiteditorrrrUrVrsr)rrrrr[rUrrVgetcommiteditors  rcCs\g}tj|ddD]\}}}|dkr|t|||q ||||q d|S)NTrxstringr.)r% scantemplaterr) escapestrr)tmplpartstypstartendrUrUrV_escapecommandtemplates  rcCs"|s|St|t|}||S)aExpand a literal template 'tmpl' in a way suitable for command line '\' in outermost string is not taken as an escape character because it is a directory separator on Windows. >>> from . import ui as uimod >>> ui = uimod.ui() >>> rendercommandtemplate(ui, b'c:\\{path}', {b'path': b'foo'}) 'c:\\foo' >>> rendercommandtemplate(ui, b'{"c:\\{path}"}', {'path': b'foo'}) 'c:{path}' )r maketemplaterr renderdefault)rlrpropstrUrUrVrendercommandtemplates  rcCsL|}t|j|}tj|j|tj|d}d|i}|r!||||S)zExpand a literal template 'tmpl' byte-string against one changeset Each props item must be a stringify-able value or a callable returning such value, i.e. no bare list nor dict should be passed. )defaults resourcessctx) rrtemplateresourcesrlrr$keywordsrr)rrrrtresrmappingrUrUrVrendertemplates   r cCsRd}|r |dd|d}|s|dd}|s|}|sd}t||}|ddS)z&Format a changeset summary (one line).Nscommand-templatessoneline-summary.%ssoneline-summarys{separate(" ", label("oneline-summary.changeset", "{rev}:{node|short}"), join(filter(namespaces % "{ifeq(namespace, "branches", "", join(names % "{label("oneline-summary.{namespace}", name)}", " "))}"), " "))} "{label("oneline-summary.desc", desc|firstline)}"rqr)rr r)rlrcommand default_specspectextrUrUrVformat_changeset_summarys   rc Csvdddddddd}|d urd |d <|d urd |d <|d ur&|d ur&d|d <|d ur6d|d<d|d<d|d<g}tj|ddD]v\}}} |dkrR|||| q?|} | | kr|d| | } | dkrp|t|| | nE|t|| | | d| krttd|| d| d} | d} z ||| Wnt yttd| w| | ksXq?d |S)aConvert old-style filename format string to template string >>> _buildfntemplate(b'foo-%b-%n.patch', seqno=0) 'foo-{reporoot|basename}-{seqno}.patch' >>> _buildfntemplate(b'%R{tags % "{tag}"}%H') '{rev}{tags % "{tag}"}{node}' '\' in outermost strings has to be escaped because it is a directory separator on Windows: >>> _buildfntemplate(b'c:\\tmp\\%R\\%n.patch', seqno=0) 'c:\\\\tmp\\\\{rev}\\\\{seqno}.patch' >>> _buildfntemplate(b'\\\\foo\\bar.patch') '\\\\\\\\foo\\\\bar.patch' >>> _buildfntemplate(b'\\{tags % "{tag}"}') '\\\\{tags % "{tag}"}' but inner strings follow the template rules (i.e. '\' is taken as an escape character): >>> _buildfntemplate(br'{"c:\tmp"}', seqno=0) '{"c:\\tmp"}' s{node}s{rev}s {node|short}s${sub(r"[^\w]", "_", desc|firstline)}s7{if(revwidth, pad(rev, revwidth, "0", left=True), rev)}%s{reporoot|basename})HRhr2rhrrCNs{total}Ns{seqno}r-s3{pad(seqno, total|stringify|count, "0", left=True)}s{pathname|basename}rGs-{if(pathname|dirname, pathname|dirname, ".")}r6s {pathname}r=Trrrs)incomplete format spec in output filenamers-invalid format spec '%%%s' in output filenamer.) r%rrfindr)rrrrKeyErrorr) pattotalseqnorevwidthpathnameexpandernewnamerrrinrrUrUrV_buildfntemplates\     r#cKs*|s|St|fi|}t||t|Sru)r#r rrL)rrrrrUrUrV makefilename4sr$cCs| p|dkS)zATrue if the given pat looks like a filename denoting stdin/stdoutrPrU)rrUrUrVr>src@s<eZdZddZddZddZddZd d Zd d Zd S)_unclosablefilecCs ||_dSru)_fp)rSr>rUrUrVrUD z_unclosablefile.__init__cCdSrurUrrUrUrVrGz_unclosablefile.closecCs t|jSru)iterr&rrUrUrV__iter__Jr'z_unclosablefile.__iter__cCs t|j|Sru)rr&)rSr rUrUrV __getattr__Ms z_unclosablefile.__getattr__cCs|SrurUrrUrUrV __enter__Pr)z_unclosablefile.__enter__cCr(rurU)rSexc_type exc_valueexc_tbrUrUrV__exit__Sr)z_unclosablefile.__exit__N) rdrerfrUrr+r,r-r1rUrUrUrVr%Cs r%wbcKsX|dv}t|r|}|r|jj}t|S|jj}t|St||fi|}t||S)N)rhsrb)rrrlfoutrr%r$r )rrmoderwritablerr>fnrUrUrV makefileobjWs r7c Cs|d}|d}|d}d}|r|rtd}n|r |r td}n|s&|s&|r3|r-td}n|s3td}|r:t|d} |r|rF|j} n:|rjt|sTttd |d s]|d }|j |} t | ri| } n|rs|j d } n |r| |} t | r| } |rt | t j rnt| d r| j} n | durttd | | s|sttd|st|tdtj|sttd|tjd|f} t j tjtdd| |ddd} | S)z:opens the changelog, manifest, a filelog or a given revlogrLrMrNNs:cannot specify --changelog and --manifest at the same times5cannot specify --changelog and --dir at the same times6cannot specify filename with --changelog or --manifestsFcannot specify --changelog or --manifest or --dir without a repositorys9--dir can only be used on repos with treemanifest enabledrWr.s_revlogs!%r does not appear to be a revlogscannot give path to non-revlogsinvalid argumentssrevlog '%s' not founds free-form:%sF)audit)targetradix)rrrZ unfilteredr r!istreemanifestendswith manifestlog getstoragerrfileryrr& safehasattr_revlog CommandErrorrrisfilerevlog_constants KIND_OTHERvfsmodr'rr) rrfile_r[ returnrevlogclmfrrrdirlogfilelogr:rUrUrV openstoragees~               rOcCst||||ddS)apObtain a revlog backing storage of an item. This is similar to ``openstorage()`` except it always returns a revlog. In most cases, a caller cares about the main storage object - not the revlog backing it. Therefore, this function should only be used by code that needs to examine low-level revlog implementation details. e.g. debug commands. T)rJ)rO)rrrIr[rUrUrV openrevlogs rPc! stddgi d}ddd}|rD|s.s.ttdt|t dkrCttdnd t j dd  |r- dur_}n3t dkrnttd dd lm}t gd |}| tj|d t |} } | t  | D]} | | vr|| dq| | r̈ td | q dur+J|} | } j! "kr j!#t $| Wdn 1swY"| gi}t j%|d ddWddS1s&wYdSt &|}|s.walkpats8%s: --at-rev does not support a directory as destinations)%s: copy destination does not exist in %ssno files to copys!--at-rev requires a single sourcerscopyc st j|dvrdd\}} j|d| } } } j} | j o:| j } t  } | dur` td|  | fdStj|} d} | rkr j jkrs td|dSd} d} s| sr| rds| rtd}votfd d D}|rrtd }n+td }n&rd }nd}rtd|}ntd|}ntd}rtd}ntd} || |dSr| sr td||fdS td||fdSn}sz=| r!t|tj|p)d}tj|s6t|| rJ|d}t||t||ntj||dd}Wn<ty}z/|jtjkrq td|d}n td|t |j!fWYd}~dSWYd}~nd}~ww j"s|sr #td||fn #td||f <t j$ drss|r| s j%&dd} j'j(|d )gdSdSdS)!NrWrs*%s: not overwriting - %s collides with %s TFs%s: can't copy - same file rs-%s: not overwriting - file already committed c3s |] }|vo |vVqdSrurU)rgpctxabssrc abstargetrUrV s  z)copy..copyfile..sP('hg rename --at-rev .' to record the rename in the parent of the working copy) sL('hg copy --at-rev .' to record the copy in the parent of the working copy) s--after --forces--forces;('hg rename %s' to replace the file by recording a rename) s7('hg copy %s' to replace the file by recording a copy) s"%s: not overwriting - file exists s+('hg rename --after' to record the rename) s'('hg copy --after' to record the copy) s+%s: not recording move - %s does not exist s+%s: not recording copy - %s does not exist rs ~hgrenamers!%s: deleted in working directory s%s: cannot copy - %s smoving %s to %s scopying %s to %s )dryruncwdrremoveemptydirsr))*r canonpathrrsplitr# normalizerrr%trackedrr! checkportablerYrrrrlexistsanyrrrrmakedirsrenamer&rrr ENOENTrrrverboser dirstatecopyrlrjwvfs unlinkpathforget)rbrelsrcotargetrWabspathabsname reltargetr:srcentryalready_commitedprevsrcexistssamefilerlooks_like_copy_in_pctxrflags targetdirtmp srcexistsrr)) r\rrfrer[r]rqrtargetsrlrarVrgs                    zcopy..copyfilecstj|r6tj|}t|}r ttj |dnt|r-tt j 7fdd}|Sr@fdd}|Sfdd}|S)Nrctjt|dSrurrrr& localpathrdeststriplenrUrVrrz,copy..targetpathfn..ctjtjt|Srurrrrr&rrrrUrVrcrrurUrrrUrVrr) rrrrrirr&rrrrrossep)rrrXabspfxresrf destdirexistsrrrV targetpathfns    zcopy..targetpathfncs t|r fdd}|Stj|}t|tddkrsfdd}t|}t|r:ttj 7t j t j t j |drj|}tt j |d}|rb|ttj 7}|||krj|fdd}|Sr}fdd}|Sfd d}|S) NcrrurrrrUrVrrz1copy..targetpathafterfn..rcsFd}D]}tjt|d|d}tj|r |d7}q|S)Nrr)rrrr&rrn)rscorer1r)rrXrUrVevalpath's  z1copy..targetpathafterfn..evalpathrcrrurrrrUrVr:rcrrurrrrUrVr>rcrrurUrrrUrVrBr)rpatkindrrirrrr&rrrrrrrr)rrrXrrrr striplen1r)rrXrrVtargetpathafterfns0  $ "    zcopy..targetpathafterfns@with multiple sources, destination must be an existing directorys!destination %s is not a directorys)maybe you meant to use --after --at-rev=.r)5rcrrYrrZrr revsinglerrrrr! getuipathfnrrrr roverlayworkingctxsetbasergraftrp1copiesrp2copiesrV markcopiedrWrrtomemctx_for_amendrr#rr' movedirstater expandpatsrrrirhasdirrrrrislinkrrr& endswithsep)!rlrrHr[rqrwrnew_ctxrrcurrent_copiesrmem_ctxnew_noderrr_absdestcopylistrrXrZr[rWrrrtfnrerrors targetpathrbrxrU) r\rrfrrer[r]rqrrrlr^rVrs.                !           )   rc% Csddlm}|d}|d} |dp|d} |dp#|d} |d} |d} |d }|d }|d }|d }|d  }|d}|d}t|dpWd}|s]dSd}t||}|ri|} n | rp| } nd} |d| pxdt|dkr||t |dr| r|st t d||}||pt }n;|rz||}||}||dkr|d}|t }Wnt j y|\}}Ynw|t kr|t dn|\}}d}|r||dkr|||||dkr||||ds |r|j| pd|dd}t}ztj||||||d|ddWn=t jyG}z t j t|t ddd}~wt jyj}z|s[t t||r`d }WYd}~nd}~wwt|}|r|| rz|| n7|ds|rd}n t||pg}t|dd!}|drd}n td0d"|it |}i}t!D] } t"| ||||qi}!|rd |!d#<|d$rd$|!d%<|j#$|!d&!|j%| | | |||d'}t&D] } t'| ||qWdn 1swYn|ds |r| pd} n|(} t)}"zt}ztj*||||"||||dd( Wn/t jyH}z t j t+,|t ddd}~wt jy]}zt t+,|d}~ww|drgd}ntd)d*}|j-|||f| ||"| | | |d+ }#i}!|d$rd$|!d%<|j#$|!d& |#%}Wdn 1swYW|".n|".w|dr|r|t d,n|dr|rt/|| krt 0t d-t d.}$|rt d/t1|}$|$||fS)1aUtility function used by commands.import to import a single patch This function is explicitly defined here to help the evolve extension to wrap this part of the import logic. The API is currently a bit ugly because it a simple code translation from the import command. Feel free to make it better. :patchdata: a dictionary containing parsed patch data (such as from ``patch.extract()``) :parents: nodes that will be parent of the created commit :opts: the full dict of option passed to the import command :msgs: list to save commit message to. (used in case we need to save it when failing) :updatefunc: a function that update a repo to a given node updatefunc(, ) rrsfilenamer3r9r7branchsnodeidsp1sp2s no_commits import_branchsbypasssstripsprefixrHr)NNFFNs message: %s r.sexactsnot a Mercurial patchs\warning: import the patch as a normal revision (use --exact to import the patch as a merge) defaultspartialgY@)striprrr similaritys7check that whitespace in the patch has not been mangledrTs import.normalr)rsallowemptycommitsecret)sphasess new-commitsimport)reditorrrs import.bypassr)rrrfrdrrs3warning: can't check exact import with --no-commit s%patch is damaged or loses informationsapplied to working directorys created %srU)2rrrYfloatrrrrrrrrrZr RepoErrorrrr setparentsr# setbranchrrrrr!rrrr!rrrr"extrapreimportextrapreimportmaprlrrextrapostimportextrapostimportmapr filestore patchrepor) forcebytestrrrrrr)%rlr patchdatarr[msgs updatefuncrr=r*rfrdrnodeidrrnocommit importbranchrrrsimrejectscmdline_messager"partialrrrCrrridfuncr,storerrrUrUrV tryimportonesh                                  rcCst|}dd|D}|} |r||r|d} n|j} |j|d|d|dd| |d| |d d | | | | oR| d kd d | |ddt ||dt | t|dkrz|dt |d|j|jtt |dddtD]} t| ||} | dur|d| q|dd||d|rtj|| |||d} | D] \}}|j||dqdStj|| |||d} |jd| ddS)NcSsg|]}|r|qSrUrrrrUrUrVrerz!_exportsingle..rrs# HG changeset patch r9s # User %s s # Date %d %d r7s # %s rrs # Branch %s nodes # Node ID %s s # Parent %s rrS)rs# %s sdescrrqr[rr.)r)r!binnoderrreverserrrrrfrd formatdate condwriterrrr formatlistrmaplist extraexportextraexportmaprrstripisplainrdiffuirr)rrrr switch_parentrr2rrrprevheaderidr~ chunkiterrrrUrUrV _exportsinglecsF       rc CsVt|dD]#\}}||} |ds|jd||t|| |||||qdS)z,Export changesets to stdout or a single filer.r)rrrrN)rrmaxr&sortdictrr$ setdefaultrr maybereopenrlrorr)rrbasefm fntemplaterr2rrrfilemaprrrrrrUrUrV_exportfntemplates, rcsft}|D]}||D] }r|r||q qt||fdd|D}t||dS)Ncsg|]}|fqSrUrUrrrUrVrrvz)_prefetchchangedfiles..)rrrr!r prefetchfiles)rrrallfilesrrA revmatchesrUrrV_prefetchchangedfiless   r hg-%h.patchcCs@t||||st|||d|||dSt|||||||dS)aexport changesets as hg patches Args: repo: The repository from which we're exporting revisions. revs: A list of revisions to export as revision numbers. basefm: A formatter to which patches should be written. fntemplate: An optional string to use for generating patch file names. switch_parent: If True, show diffs against second parent when not nullid. Default is false, which always shows diff against p1. opts: diff options to use for generating the patch. match: If specified, only export changes to files matching this matcher. Returns: Nothing. Side Effect: "HG Changeset Patch" data is emitted to one of the following destinations: fntemplate specified: Each rev is written to a unique file named using the given template. Otherwise: All revs will be written to basefm. N)rrr)rrrrrr[rrUrUrVexports rc Csdt|||t|dd}t|j|di}t|||||||WddS1s+wYdS)z*Export changesets to the given file streamrTrsexportN)rrrrlr)rrr>rr[rrrrUrUrV exportfiles  "rc Cs|dur |dd||ddt||}||dd|jtt|dd|d d ||}|durK|d d |jtt|dd d|dd| | | }| ddttj|}|dd|j|dd d|ddS)zdutility function to display obsolescence marker in a readable way To be used by debug function.Nsindexs%i sprednodes%s s succnodesrrSsflags%X s parentnodess{%s} , )rTsepr7s(%s) smetadatas{%s}s%r: %r)fmtrrq)rrprednode succnodesrrmapr parentnodesrrdmetadatarrrrapply maybebytestr formatdictr)rmarkerindexsuccsrmetasmetarUrUrV showmarkers4  rcCsb|d|}z|}Wntyttdw|td|t|| fd|S)z;Find the tipmost changeset that matches the given date specsdate(%s)s revision matching date not foundsfound revision %d from %s s%d) rr ValueErrorrrZrrr(datestrrd)rlrrdmrevsrrUrUrVfinddate s   rc sgfdd}g}|d} d} t|\} } | s| r$t|| |j} |jddt|} |j}t|j| t| j ddddD]2} |}|sX|su|| vru|j |ru| r^| || ||jsh|su|jtd||dd qCt| j D]W}| |}z;t|}|j ||}t||}|d r|j||||dfi|n|j||||dfi|Wq{tjy|td ||Yq{w|d s| ||}fd d|DS)Nc|p ||Srurbadr^yrrrUrVr% rzadd..T) includeexactF)subreposrrfull adding %s sui.addremove.addedrr#skipping missing subrepository: %s dry_runc3 |] }|vr|VqdSrurrrrUrVrdZ zadd..)r!checkportabilityalertcasecollisionauditorr# narrowmatchrrrrVrrWrurnrrsrrr subdirmatcherreljoinsubdiruipathfnrYrrr LookupError)rlrrrr^ explicitonlyr[badfnnamesr+ccaabortrrr#rrWsubpathrsubmatch subprefix subuipathfnrejectedrUrrVr" sj          rcCsZ|j||<|jd||jf|dD]}||}|jD] }||||qqdS)Nsadding %s = %s sfilelog("path:.hgsub"))rrlrrrr addwebdirpath)r serverpathwebconfrrr.rUrUrVr3^ s  r3c s|r |r ttdgfdd}|d} g} |jt|dd} t| j| j| j | j } |r>fdd| D} t| j D]U| } t }|j|}t|}z&| j|||||d\}}fd d|D| fd d|DWqCtjy|td |YqCw|sшD]1}||jvr|j|s|| vr|j|r|j||jvrq|td |||q|rJtd }| ddD]k}|td|||f}|dkr |dkr ||dD]\}}|d|t |fq|td|||f}|dks|dkr&q|dkr1| !|q|dkrB| "|}| |d=n|dkrInq| D]}|j#s[$|r[|rh|jtd||ddqL|s| | |fddD| fdd| D| fS)Ns/cannot specify both --dry-run and --interactivecrrurrrrUrVrp rzforget..Trrcsg|] }|r|qSrU)rWrrrUrVrw zforget..)rerMcg|]}d|qSrWrUrr.rUrVr rcr8r9rUrr:rUrVr rrs+not removing %s: file is already untracked s[Ynsa?]$$ &Yes, forget this file$$ &No, skip this file$$ &Skip remaining files$$ Include &all remaining files$$ &? (display help)s forget %s %srs%s - %s rr removing %s ui.addremove.removedrc3rrur rrrUrVrd r!zforget..c3s|] }|vr|VqdSrurUr)r2rUrVrd r)%rrZrrrrrrrrrrrr%rur&r!r'rwrr(rr#rrrkrr promptchoiceextractchoicesrrlowerremover rsrW)rlrrrr^r)rerMr*r+forgotr1rwrr/r0r1subbad subforgotr responsesrrrrfnindexrU)rrr2r.rVrwh s                 rwc Csd}|jp ddh|@}|rF|sFg} ||D] } | ||| t| dkr8|d| | dd=d}q| rE|d| n5||D]/} ||j |d|ri|| } |dd | | |j | d | ||| d}qKt|jD]M} t| |} t| |}|s|| st| r|| }z|| p|}||| ||||dkrd}Wqtjy|td || Yqwq|S) Nrssizesflagsdr.rrs size flagss % 10d % 1s rr)rsdatahintrmatchesrrrrrrrsizerrrrrrr%r!r'rWrorr printfilesrr(rr)rlrrCr^rrrret needsfctxbufrfcr.r/r1rrecurserUrUrVr sV        rc s*d} |j|dd} | j| j| j| jf\} } }}|d| dur$g} d}nd}tj}|jtdt |tdd}|D]Q}t ||}|j ||}t||}|s]||s]t|r||}z||||||||| rud} Wq;tjy| td ||Yq;wq;|t|}|}|jtd t |td d}|D]Nfd d }||vp}|jvs|s҈dks|s҈|vrq|j r|j r| td|n | td|d} q||r | ||| }n|rG|}| | |}|jtdt |td d}|D]||j s3|vr>| td|d} q$|nH||}|jtdt | t | td d}| D]|| td|d} q_| D]|| td|d} qv|t|}|jtd t |td d}|D]|j s|s||jtd|ddq||s|!/|s|D]| vrܐq|j"#dd}|j j$d|dq|d%|Wdn 1swY|r| D]}|&|q | S)NrTr6Fs searchingrJ)runitrrsdeletingsfilescs$jD] }|drdSqdS)NrWTF)rrr:rr+rUrV insubrepo2 s zremove..insubrepors"not removing %s: no tracked files s#not removing %s: file is untracked sskippings#not removing %s: file still exists s<not removing %s: file is modified (use -f to force removal) sLnot removing %s: file has been marked for add (use 'hg forget' to undo add) r=r>rrrg) ignoremissingr))'rrrrrrr makeprogressrrrrr%rur&r!r'rWror incrementr removefilesrr(rcompleterdirsrr#rrrsrJrlrjrvrwr) rlrrCrr^r\rrrewarningsrNr1rrrrrr.progressr.r/r0r1r deleteddirsrrUrr remainingr)warningrUrTrVrB s      $       rBcCs| p d|vS)Ndata)rJ)rrUrUrV_catfmtneedsdata rrbcCs^d}t|r||}|r|||}||j|d|dd||j|ddS)zHook for adding data to the formatter used by ``hg cat``. Extensions (e.g., lfs) can wrap this to inject keywords/data, but must call this method first.r.rras%srIN)rbrr wwritedatarrr)rrrrdecoderrUrUrV_updatecatformatter s  rec sd}tfdd} tdkrXsXd} |j} } z#| rM| | | drMtrFt | fg| | WdSWn t yWYnwtrgt | fg D]} | | d}qlt j|dd}tjD]<}|}z t|}tj|}|j||fitsd}Wqtjy|td||Yqw|S)Nrc sd}r%ttj|d}z ttj|Wn ty$Ynwt|}t || dWddS1sBwYdS)N)rsdecode) r$rrrrprr rrrerY)rrrrrrrr[rrUrVr s "zcat..writerTrSr)rrLrrranypatsr? manifestnoderrbr!rrrrVrrrrrr%rrrcatr"rRepoLookupErrorrr)rlrrrrrrr[r5rrAmflmfnoderZr^r.rr/r0rUrfrVri sX     ric Cs|d}|rt||d<t||}t|d||}d}|dr)t|d}|p.t1|rQt ||} tj || d} t ||d| |dkrQt td||||||WdS1scwYdS) z5commit the specified files or all outstanding changesr7N addremovecommitrSr.r5failed to mark all new/missing files as added/removed)rYr( parsedaterr!rrr&nullcontextmanagerrgr addremoverrr) rlrrFrHr[rdr*rdsguardrelativer^rUrUrVr s$     $rcCsX||vr&||}||vr$||}|| o#||kSdS||vSNF)manifestfilectxcmpr)rctx1ctx2rbrUrUrVr s     rc$s6ddlmt|tjr||td| m| N| d7|d| }| | t||}t|}}|drbt|d}|dpj}tdkr} t| jt| jBt| jB} nt} t ||t!||} tj"|| d} |drt#|d | |rt$%td d vsd vrt&'|j(\} }}|rJ| rt&)||t*j+,|}t-.|fd d Dtdk}|j/0dddk}|s|r4t12j3r t123| fdd| D} fdd}n|tdffdd}t4||}t5d}|sb6}| p`|ddv}n|ddu}t7||d}| }8|d<j9|:3:g|| |||||d }t;<|6}|s|6kr|kr|ks|r|krш:WdWdWdSd}|drt=j>}|?|}|@|jABC|C||jD|jA}t@}|D] }|jE|dddd qt@} | D] }|jE|d!d!d"qWdn 1s1wY:|fi}!d}"|d#rNd#tFG|d#i}"|Hd$d%}#tjI||!d|"d||#d&Wdn 1skwYWdn1s{wYWd|SWd|S1swY|S)'Nrrsamending changeset %s amendr7r9rSrmr.ros.hgsubcsh|]}|r|qSrUrUrrrUrVrZ rzamend..rrscopies.read-froms filelog-onlycs$g|]}|vst|s|qSrU)rr)base filestoamendr+rUrVrq s zamend..c sz5|vr WdS|vr|}n|}|}j||||d|vd|v|d}|WSty?YdSw)Nr4x)risexec copysource)rrwr memfilectxrrrYr)rctx_rfctxrmctx)rcopiedr~oldr+rUrVrw s(    zamend..filectxfnscopying changeset %s to %s cs"z|WStyYdSwru)rwr)rrr)rrUrVr s   s commit.amendseditTNT)rrs amend_source)rrrrrfrdrrrrF)rrsnoterhs backup-bundle)rr targetphasebackup)Jrrr isenabledcreatemarkersoptrkrorrrJrrrrrrnrrLrdrYr(rprfrrrrrrrrrr!rrgrrrrrr#r_status writestaterrrrcheckunresolvedrlrr pathcopiesrrrrrrrrr stripdescrsecretrresetr#r'rrr(r fromlocalrjr)$rlrrrrHr[rmrdrfr\rrtr^r.r/ newsubstatemsrchangeset_copiesrr*rdoeditr pureextranewnewdesc commitphaserr# normalfilesr removedfilesr  obsmetadatarrU)r}rrr~rrr+rVamend s &                        ,4      *d ddrcCs"|r|St||||ddS)NT)runchangedmessagedetection)rr)rrr.rrUrUrVr s  rc Cs\|std}dd|dD}|ddd}|r7d|} |jd| r1t||||| }} n ||st||||} t } t |j |} |j| | oZ| oZ|j } |jj| |||| |jdd }|}tjt|tjd }|r|d|}td d |}t | |r||}|sttd |r||krttd|S)Ns$Leave message empty to abort commit.cSsg|]}|r|qSrUrU)rrrUrUrVr rvz%commitforceeditor..rrs changesetcommittemplatern)rpendingrr)rs(?m)^HG:.*( |$)r.sempty commit messagescommit message unchanged)rrinsertrrlrbuildcommittemplaterbuildcommittextrrrchdirrcurrenttransactionr#r writependingrrfrrresearch _linebelow MULTILINErrrrrZ)rrr.rrrrforms templatetextref committextolddirtrr editortextr stripbelowrUrUrVr sT          rcCsd|j}t|}t|||}|jjdd|jdD|s#d}| |j ||d| S)Ncss"|] \}}|t|fVqdSru)r% unquotestring)rkvrUrUrVrdM s  z&buildcommittemplate..rr.)r) rlrreference_templatespecrchangesettemplaterrcacher configitems pushbuffershow popbuffer)rrr.rrrlrrrUrUrVrI s  rcCsddd|dDS)NrqcSsg|]}|rd|qS)sHG: %srU)rrrUrUrVr[ rzhgprefix..)rr)rrUrUrVhgprefixZ rcCsng}|||}}}|r|||d|d|ttd|t||d|ttd||rT|ttd| re|ttd| t |rv|ttd|j | dd |D| d d |D| d d |D| d d |D|s|s|s|ttd |dd|S)Nr.s>Enter commit message. Lines beginning with 'HG:' are removed.sHG: --suser: %ss branch merges branch '%s's bookmark '%s'cSg|] }ttd|qS)s subrepo %srrrr1rUrUrVrv rz#buildcommittext..cSr)sadded %srrrUrUrVrw rcSr)s changed %srrrUrUrVrx rcSr)s removed %srrrUrUrVry rsno files changedrq)rrrrrrrrfrrr isactivewdirparent_activebookmarkrr)rrr.redittextrrrrUrUrVr^ s<       rc s|duri}||}|}|dur"|j|kr"|jtdn|dsArA|vrAtfdd|DsA|jtd|dsa|D]}| r`| kr`|jtd| qH|jj rw|j td| |fdS|jjr|j td| |fdSdS) Ns3warning: commit already existed in the repository! r|c3s(|]}|vo|kVqdSru)rrrbheadsrrUrVrd s zcommitstatus..screated new head s close_branchs reopening closed branch head %d scommitted changeset %d:%s )rr tiprlrrrYror closesbranchrr debugflagrrrs) rrrrrr[rrrrUrrV commitstatus s<  rcCs|jt|d||dS)Nr)rr!r)rrHr[rUrUrVpostcommitstatus rrc:st|}|j\}}}}||kr|}itj|dd|| dd} |d} t | ||t fdd| j D}  stdd} | | D] } | | <qWfd d }t|D] } | vr| | <qst||j|dddd }n|j|d }|D]}|D] } | | <qqt|t|j}t|j}t|j}t|j}t|j}||jt|j}t}||kr|}|}|}||B}ttt}}}n@|j|d }t|j}t|j}t|j}||B}|||O}||M}||8}||@}||8}||M}|||@O}||8}|}||jkrSt|}|D] }||vrI||q=||O}||8}|D]"}|j|}|rv|vrv|j |jrv|!|d|<qUt|} |D] }||vr| |q~|| }!t}|D]} |j | js|!| q||8}| D]} |j | jr|!| q| |8} t}"|D]} |"| }#t#j$%|#r|"!| q||"8}t}$|D]} |"| }#t#j$%|#r|$!| q||$8}gt&d fgt&dfgt&dfgt&dfgt&dfgt&dfdt&dfdt&dfdd}%d}&d}'d}(| dr<|(}%}&}'| rB|%})n|&})t}*d}+| dsUd}+|d|(f|!d|(f|d|)f|d|(f|d|(f||+|&f| d|(f|d|(f|"d|'f|d|(f|$d|'f|d |(f|d!|(ff },t 'D]\} }-|"| }#|,D]\}.\}/}0}1| |.vrq|/dur5|/(| |1r|1|%kr|*!| nD|&|1ks| | )| rt*|| }2t#j$j+|2|j,d"}3-t&d#| |3f| d$s| rt./|#|2nt.0|#|2| d$r4j1s+|-s4|0| n |-rA2|0| q| d$sd%}4fd&d'|4D}5tj3}6t|d(d'|5D}7|6|4|7fgt |d|}8t5||8| |*| r| D]7}9z| 6|9j7j |9g|Rit8|Wqt9yt:;d)|9t<fwWddSWddS1swYdS)*NTrSs interactiveFc3s|] }|r|VqdSrurUr)rCrUrVrd rzrevert..cSsdSrurUrrUrUrVr rzrevert..csV|vrdS|jvr dS|d}D] }||rdSqd||fdS)NrWs%s: %s )rrr)rrpath_r)rr+rlr^rUrVr* s  zrevert..badfn)node1rrrr)rrs reverting %s rr=sforgetting %s sundeleting %s sno changes needed to %s sfile not managed: %s )revertaddremovedroprQundeletenooprjr<rrrs no_backuprrrrQrrrrj)rs#saving current version of %s as %s rR)rrrcsg|]}|dqS)rrU)rrT)actionsrUrVr rzrevert..cSsg|] }|D]}|qqSrUrU)rsublistrrUrUrVr r7s(subrepository '%s' does not exist in %s!)=rrLr#rrrvr!rrJrYrrralwaysrrrVrWrrrrrrrrrrrrrBrr%rrrrrnritemsrrx backuppathrelpathrror&rrqrsrrr_performrevertrrevertr"rrrr):rlrrrHr[rrrrLrMr+ targetsubsrrZr*rkindrrr_deletedrrmodadded dsmodifieddsadded dsremoved localchangesmergeaddrrr}deladdedrremovunkr: dsremovunkbackupinteractivercheckdiscarddsmodifiedbackupr9 backupanddel disptablerWrxlistrdobackup absbaknamebaknameneeddataoplistprefetchrrrrU)rrrCr+rlr^rVr s                                                         #              $rc% sxj\}} } gfdd} fdd} fdd} tjjdd}d d D]1}|rWjtd |}|d krQ| d |j |q1 |q1| d |j |q1d d D]1}|||rjtd |}|d kr| d || |qi |qi| d || |qidd D]}||| d|j |q| j kfdd}t }|rfdddd D}t |}tjjdddd}d|_d|_d}| |krjddrd}nd}|dkr tjd||d}n tjd||d}t|}ztj|||d\}}|dkr3t|}Wn-tjyK}z ttd|d}~wtjya}z ttd |d}~wwt|\}}|durpt }t}td!d"|DD]}| d|q|t }|D]E}t |r|j!"} |j!"|vr#| }!t $j| }"t%&|!|"|'| | |vr|(| |dkr| | |)|q|*}#|+d |#rz tj,j|d#dd$Wn+tjy}ztt-.|d}~wtjy}ztt-.|d}~ww~ndd D]}| d|| ||r/||qd%d D]}||vrM| d%|| |j/|q7d&d D]8}|rjtd'|}|d krx| d&|| |||qU |qU| d&|| |||qUt01|}$d%d d&d dd D]}||$vrj2|$||qdS)(zfunction that actually perform all the actions computed for revert This is an independent function to let extension to plug in and react to the imminent revert. Make sure you have the working directory locked when calling this function. cs"|}|||dSru)wwriterr)rrQ)rrrUrVcheckoutsz _performrevert..checkoutcsFzjdd}jj||dWn tyYnwj|dS)Nrrgrh)rlrjrurvr r# set_untracked)rr)rrUrVdoremoves z _performrevert..doremovecs8|}jjs |sj|d|dSdS)Nr)rlrsr)rrrW)rr+rr^rUrV prntstatusmsg"s  z%_performrevert..prntstatusmsgT)cachedrQrs(forget added file %s (Yn)?$$ &Yes $$ &Nors(remove added file %s (Yn)?$$ &Yes $$ &Norcsjj|dS)N) reset_copy)r# set_tracked)r)rrrUrVnormalNsz_performrevert..normalcsg|]}|vr|qSrUrUr)excluded_filesrUrVrTrz"_performrevert..rrsrevert.interactive.)rrrsapplyrs!revert.interactive.select-to-keepskeepsdiscardNr)rrrcSsh|] }t|r|jqSrU)r{r~rrrUrUrVrsz!_performrevert..rrrrs,add back removed file %s (Yn)?$$ &Yes $$ &No)3r#rrr pathauditorrrlr?rrrrrr!rrrrrrjrrr reversehunksrrrZrrrrrr{r~rrrr&rrBrrrrr rr!rrrr)%rrr+r^rrrMr9rrrrrr audit_pathrrrrtorevertrCr2rrr4rr[r5unusedalsorestorer>rrrZr:rr@rrU)rrrr+rrr^rVrs                                      " rcCstjD]}|js|r |js|jrq||r!tj|| dqtjD]%}|jr9|r/|js9|j dkr6|s9|jr:q%||rJtj|| dq%dS)zLook for an unfinished multistep operation, like graft, and abort if found. It's probably good to check this right before bailifchanged(). rmergeN) r_unfinishedstates _clearable _allowcommit _reportonly isunfinishedrrrr_opname)rr skipmerger"r1rUrUrVrs8    rcCstjD]}|jr q|js||rtj||dqtjD]}|j dks*|jr+q |jr=||r=t |j |jq dS)z[Check for unfinished operations (as above), and clear the ones that are clearable. rrN)rrr r r rrrrr r&rr'r_fname)rr"r1rUrUrVclearunfinisheds  rcCs"tjD] }||r|SqdS)zIChecks for unfinished operations and returns statecheck object for itN)rrr )rr"rUrUrVgetunfinishedstates  rcCsbtd}tjD]}|js q||r||dfSq|djddddr/|tddfSdS)aiCheck for an unfinished operation and return the command to finish it. statemod._unfinishedstates list is checked for an unfinished operation and the corresponding message to finish it is generated if a method to continue is supported by the operation. Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is a boolean. s continue: %sTNF)missingrrs hg commitNN)rrr _continueflagr  continuemsgdirty)rcontmsgr"rUrUrV howtocontinues  rcCsDt|\}}|dur |r|jd|dS|jd|dSdS)zInform the user about the next action after completing hg resolve If there's a an unfinished operation that supports continue flag, howtocontinue will yield repo.ui.warn as the reporter. Otherwise, it will yield repo.ui.note. Nr)rrlrro)rrr`rUrUrVcheckafterresolved's rcCs2t|}d}|dr|d}tjtd||d)zRaise an abort suggesting how to properly continue if there is an active task. Uses howtocontinue() to find the active task. If there's no task (repo.ui.note for 'hg commit'), it does not offer a hint. Nrrsno %s in progressr)rrrr)rtaskr\rrUrUrVwrongtooltocontinue7s  rc s|s ttdt|}|d}|dur ttdt|dkr/|d}nd}d}|rÇfdd |D}d }fd d |D}|rgj j td d fdd|Dtddd}t j |}|t |rj tdd}|rÈ6"t|dd d|D} tjj | ddWdn1swYWdn1swY|sΈd}t||td|td|dd|dS)zSabort the interrupted graft and rollbacks to the state before interrupted graftsno interrupted graft to abortsnewnodesNs$cannot abort using an old graftstaterrFcsg|]}|qSrU)rrrrrUrVr\rzabortgraft..Tcsg|] }|s|qSrU)mutablerrrUrVr_rs%cannot clean up public changesets %s rc3s|] }t|VqdSru)bytesrrrUrVrdcrzabortgraft..s see 'hg help phases' for detailsrs;new changesets detected on destination branch, can't strip cSsg|]}|qSrUrrrUrUrVrwsr)rsgraft aborted sworking directory is now at %s )rrrrreadgraftstaterYrrrrrlrrrr descendantsrJrr clean_updaterrrrdelete) rlr graftstate statedatanewnodesstartctxcleanup immutabledesc strippointsrUrrV abortgraftGs^       r,cCs8z|WStjy|jd}d|iYSw)zDread the graft state file and return a dict of the data stored in it graftstatesnodes)rrCorruptedStater'rw)rr$nodesrUrUrVr s   r cCsD|t|d}t|||WdS1swYdS)z/abort logic for aborting graft using 'hg abort'r-N)rJrcmdstater,)rlrr$rUrUrV hgabortgrafts   $r1ru)F)Tr)FNNr.r)NNNN)r2)rFNN)FNN)r.)NNr.F)NNN)FN)FF) __future__rrrr rri18nrrrrrrrr r thirdpartyr rr r rrrvrrrrrrrrrrrrrrrrrrr r!r"rr#r$r%r&r'rHutilsr(r) revlogutilsr*rF TYPE_CHECKINGtypingr+r,rr dryrunopts confirmopts remoteoptswalkopts commitopts commitopts2 commitopts3 formatteropts templateoptslogoptsr2 diffwsopts diffopts2 mergetooloptssimilarityopts subrepooptsdebugrevlogoptsrr_rcrnrsr{rrrrrrrOobjectrPrtr{r1r}rrrrrrrrrrrr rr#r$rr%r7rOrPrrrrrrrrrrrrrrrrr3rwrrBrbrerirrrrrrrrrrrrhooks outgoinghooks summaryhookssummaryremotehooksrrrrrrr,r r1rUrUrUrVs   x      "      ne9 N  'g      G   K 3 \-  +  < e1 >  s  A # @ EJ       @