Qc@s dZddlmZddlmZmZmZmZmZddl m Z ddl m Z m Z mZmZmZmZddl mZmZmZmZddl mZddlZddlZddlZddlZe jd 7_d d eed fgZiZe j eZ d Z!ej"Z#de$fdYZ%de$fdYZ&dZ'dej(fdYZ)de$fdYZ*dZ+e dddeedfddgededfged d!Z,e d"d#d$eed%fgeed&ed'Z-e d(d#d)eed*fgeed+ed,Z.e d-d.d/eed0fd1d2d3ed4ed5fd6d7eed8fddged9edfd:d;eed<fd=d>eed?fged@dAZ/dBZ0e dCdDdEeedFfgedGdHZ1e dId3dJeedKfdLdMeedNfd3dOeedPfdQdRd3edSedTfge j2edUedVZ3e dWe j4dXdYedZd[Z5e d\d]d^eed_fgeed`daZ6e dbeedcddZ7e deeedfdgZ8e dheedidjZ9dkZ:e dld.dmeednfd6d7eedofd:d;eed<fdLdpeedqfdrdsd3edtedufdvdweedxfdydzd3ed{ed|fge j;e j<ed}d~Z=e dd.dmeednfd:d;eed<fd deedfdLdpeedfdrdsd3ededufdvdweedfdydzd3eded|fge j;e j<eddZ>e de j?e j@e j;eddZAe dd.dmeedfddeedfge j<eddZBe dd3deedfd6d7eedfd3deedfgeddZCe dddeedfd1deedfgeddZDe dgededZEdZFdZGe dd3deedfd6d7eedfd.deedfddeedfddeedfd]deedfd1d2d3eded5fd3deedfd3deedfg ededZHe dddeedfd1d2d3eded5fd3deedfd6d7eedfd3deedfgededZIe dgededZJe ddydeedfdrdeedfgeddZKe ddDdeedfd1d2d3eded5fd.deedfd6d7eedfge j<eddZLe dddgededfd6d7eedfddeedfd3deedfd3deedfd1d3eedfddeedfddd3edfgeddZMe dd1deedfd deedfd3deedfd3deedfgeddZNe dddeedfgeddZOe dddePedfd3dePedfdDdePedfd3dePedfd3dePedfd3dePedfgededZQdZRdZSdZTdZUdZVdZWdZXeXgZYdZZidd6dd6dd6dd6d d 6d d 6d d 6Z[e j\d7_\dS(smanage a stack of patches This extension lets you work with a stack of patches in a Mercurial repository. It manages two stacks of patches - all known patches, and applied patches (subset of known patches). Known patches are represented as patch files in the .hg/patches directory. Applied patches are both patch files and changesets. Common tasks (use :hg:`help command` for more details):: create new patch qnew import existing patch qimport print patch series qseries print applied patches qapplied add known patch to applied stack qpush remove patch from applied stack qpop refresh contents of top applied patch qrefresh By default, mq will automatically use git patches when required to avoid losing file mode changes, copy records, binary files or empty files creations or deletions. This behaviour can be configured with:: [mq] git = auto/keep/yes/no If set to 'keep', mq will obey the [diff] section configuration while preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq will override the [diff] section and always generate git or regular patches, possibly losing data in the second case. It may be desirable for mq changesets to be kept in the secret phase (see :hg:`help phases`), which can be enabled with the following setting:: [mq] secret = True You will by default be managing a patch queue named "patches". You can create other, independent patch queues with the :hg:`qqueue` command. If the working directory contains uncommitted files, qpush, qpop and qgoto abort immediately. If -f/--force is used, the changes are discarded. Setting:: [mq] keepchanges = True make them behave as if --keep-changes were passed, and non-conflicting local changes will be tolerated and preserved. If incompatible options such as -f/--force or --exact are passed, this setting is ignored. i(t_(tbinthextshorttnullidtnullrev(trelease(tcommandstcmdutilthgtscmutiltutiltrevset(trepairt extensionsterrortphases(tpatchNs qclonetstsummarys print first line of patch headertinternalt statusentrycBseZdZdZRS(cCs|||_|_dS(N(tnodetname(tselfRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt__init__SscCst|jd|jS(Nt:(RRR(R((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt__repr__Us(t__name__t __module__RR(((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRRs t patchheadercBs\eZedZdZdZdZdZdZdZ dZ dZ RS( c Csyd}d}g}g}d}d}d} d} d} d} d} d}xXt|D]J}|j}|jds|r|jdrd}Pnd}|jdrd}q[n| d kr|jd r|d }q|jd r|d }q|jd r"|dj} q|jdr>|d} q|jdrZ|d} q|jd r|r|j|d} qn|dkrg}d } n| dkr|jds|jdr|d} d} n| dkr|jds |jdr|d}d} nz| dkr[|jdsH|jdr[|d}d} n=| dkr||dkr|d} n|s|r|j|n|j|q[W||||t||_||||| r| jdr| r|jdd|jd| n||_ ||_ ||_ ||_ | |_ | |_| |_|dk|_||_dS(NcSsSxL|rN|d}|jds@|jds@|jdrJ|d=qPqWdS(Nisdiff -sIndex:s ===========(t startswith(tlinestl((s,/sys/lib/python2.7/site-packages/hgext/mq.pyteatdiffZs   cSs,x%|r'|djs#|d=qPqWdS(Ni(tstrip(R ((s,/sys/lib/python2.7/site-packages/hgext/mq.pyteatemptycs  is diff --gits+++ is--- ithgpatchs# User is# Date s # Parent i s # Branch s # Node ID i s# s# HG changeset patchttagdones Subject: s subject: ttagsFrom: sfrom: isDate: sdate: t(tNonetfiletrstripRtlstriptappendtlent diffstartlinetinserttmessagetcommentstusertdatetparenttnodeidtbranchthaspatcht plainmode(RtpfR9R"R$R1R2R3R4R5tformattsubjectR7R6t diffstarttline((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRYs                              cCs|jddg|sy1|jjd}|jj|dd|Wqtk r|jst|jdgrd|g|j|_qdd|dg}||j|_qXn||_dS(NsFrom: s# User s# HG changeset patchisDate: R((t updateheaderR2tindexR0t ValueErrorR9t _hasheaderR3(RR3t patchheaderatttmp((s,/sys/lib/python2.7/site-packages/hgext/mq.pytsetusers cCs|jddg|sy1|jjd}|jj|dd|Wqtk r|jst|jdgrd|g|j|_qdd|dg}||j|_qXn||_dS(NsDate: s# Date s# HG changeset patchisFrom: R((R?R2R@R0RAR9RBR4(RR4RCRD((s,/sys/lib/python2.7/site-packages/hgext/mq.pytsetdates cCsj|jdg|s]y1|jjd}|jj|dd|Wq]tk rYq]Xn||_dS(Ns # Parent s# HG changeset patchi(R?R2R@R0RAR5(RR5RC((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt setparents cCs8|jr|jn|g|_|j|j7_dS(N(R2t_delmsgR1(RR1((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt setmessages   cCslt}x_|D]W}xNtt|jD]7}|j|j|r)|||j|dBdBd<Z?dBd=Z@d>ZAed?ZBd@ZCdBdBdBdBedAZDRS(Dc Cs||_yrttjj|d}|jj}|j|satjj|d}ntjj|d|}Wn&tk rtjj|d}nX|p||_t j |j|_ ||_ ||_ t |_t |_g|_d|_d|_d|_d|_t |_yF|jddd}|dkrRtjn|r^d pad |_Wn2tjk r|jddd j|_nX|jdd t |_dS( Ns patches.queuetpatchesspatches-tserieststatustguardsRYtgittyestnotautotplain(tbasepathtopentostpathRStreadR+tclosetIOErrorR topenerR\tbaseuiRJt applieddirtyt seriesdirtytaddedt seriespatht statuspatht guardspathR)t activeguardst guardsdirtyR]Rt ConfigErrortgitmodetconfigRUR9( RR\R|RwtpatchdirtfhtcurtcurpathR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR,s<               "csqfd}y/jjjj}t||SWn,tk rl}|jtjkrfgSnXdS(Nc3sx~|D]v}|jdd}t|dkrT|\}}tt||Vq|jrjjtd|qqWdS(NRismalformated mq status line: %s (tsplitR.RRR#R\twarnR(R R!tentrytnR(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt parselinesPs   (R{RxRt splitlinestlistRzterrnotENOENT(RRR te((Rs,/sys/lib/python2.7/site-packages/hgext/mq.pytappliedNs cCsPy|jj|jjSWn,tk rK}|jtjkrEgSnXdS(N(R{RxRRRzRR(RR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt fullseriesas cCs|j|jS(N(t parseseriesRl(R((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRljs cCs|j|jS(N(Rt seriesguards(R((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRos cCs^x3djD]%}||jkr t||q q Wt|_t|_t|_d|_dS(Ns&applied fullseries series seriesguards( Rt__dict__tdelattrRJR}R~RR)R(Rta((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt invalidatets   cCstj|j|}|jdkr0t|_nR|jdkrBn@|jdkrf|jdk|_ntjt d|j|r|j ||}n|S(NRrtkeepRpRqs,mq.git option can be auto/keep/yes/no got %s(syessno( tpatchmodtdiffoptsR\RRLtupgradeRoR tAbortRt patchopts(RtoptstpatchfnR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR}s  cGs|j}|j r|jdkrxZ|D]O}|j|d}x*|D]"}|jdrKt|_PqKqKW|jq,Wn|S(sReturn a copy of input diff options with git set to true if referenced patch is a git patch and should be preserved as such. Rtrs diff --git(tcopyRoRR{RRLRy(RRRkRtpatchfR>((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRs    cGstjj|j|S(N(RvRwRS(Rtp((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRSscsCfd}x-t|jD]\}}||r|SqWdS(Ncs&|jddd}|jkS(Nt#ii(RR#(R!(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt matchpatchs(t enumerateRR)(RRRR@R!((Rs,/sys/lib/python2.7/site-packages/hgext/mq.pyt findseriess  s'\s?#([-+][^-+# \t\r\n\f][^# \t\r\n\f]*)cCsg|_g|_x|jD]}|jd}|dkrL|}d}n&|dkr^qn|| }||}|j}|r||jkrtjtd||j|j fn|jj ||jj |j j |qqWdS(NRiR(is%s appears more than once in %s( RlRRtfindR#R RRRSRR-tguard_retfindall(RR!thRRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRs$        cCsu|stdSd}|d}|dkr@td||fSx.|D]&}||krGtd||fSqGWdS(Nsguard cannot be an empty strings# is-+s*guard %r starts with invalid character: %rs!invalid character in guard %r: %r(R(Rtguardt bad_charstfirsttc((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt checkguards       cCs}x5|D]-}|j|}|rtj|qqWtt|}|jjddj|||_t |_ dS(Nsactive guards: %s t ( RR RtsortedtsetR\tdebugRSRRLR(RRnRtbad((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt setactives  cCs|jdkrg|_y|jj|jj}Wn1tk rj}|jtjkrang}nXxrt |D]a\}}|j |}|r|j j d|j |j|d|fqx|jj|qxWn|jS(Ns %s:%d: %s i(RR)R{RxRRRzRRRRR\RRSR-(RRnterrRQRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytactives   $cCsx|D]}t|dkr;tjtd|n|ddkrgtjtd|n|j|d}|rtj|qqW|jjd|j|}|djg|D]}d|^q|j|<|j t |_ dS( Nisguard %r too shortis-+s!guard %r starts with invalid chariR(s #( R.R RRRRtsubRRSRRLR~(RtidxRntgRtdrop((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt setguardss 1 cCs8t|tr$|jj|}n|j|}|sAtdfS|j}g|D],}|ddkrT|d|krT|^qT}|rtt |dfSg|D]}|ddkr|^q}g|D]}|d|kr|^q}|r.|rtt |dfStdj t t |fStdfS(Nit-it+RR(( t isinstancetstrRlR@RRLR)RRJtreprRStmap(RRt patchguardsRnRtexactnegtpostexactpos((s,/sys/lib/python2.7/site-packages/hgext/mq.pytpushables    9))cCs<|r|jjp|jj}|s0|jjr8t|trT|jj|}n|j|\}}|r|r|dkr|t d|j|q|s|t d|j|q|t d|j||fn|s8|r|t d|j||fq5|t d|j|q8ndS(Ns"allowing %s - no guards in effect s*allowing %s - no matching negative guards sallowing %s - guarded by %s sskipping %s - guarded by %s s!skipping %s - no matching guards ( R\twriteRtverboseRRRlR@RR)R(RRt all_patchesRRtwhy((s,/sys/lib/python2.7/site-packages/hgext/mq.pytexplainpushables(       csfd}jr@|ttjjt_njrh|jjt_nj r|j j t_ nj rj rdjfdj Dng_ ndS(NcsBj|d}x|D]}|jd|qW|jdS(Ntws%s (R{RRy(titemsRwtfpRQ(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt writelist!s c3s%|]}|dkr|VqdS(N(R)(t.0tf(tqrepo(s,/sys/lib/python2.7/site-packages/hgext/mq.pys 2s(R}RRRRRJR~RRRRRRRR)tadd(RR((RRs,/sys/lib/python2.7/site-packages/hgext/mq.pyt savedirty s        'cCsp|jd}tjj|s%dSytj|Wn3tk rk}|jjtdt |nXdS(Ntundoserror removing undo: %s ( tsjoinRvRwtexiststunlinktOSErrorR\RRR(RRcRtinst((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt removeundo5scCsxt|D]}|j|}tjj|r |jjtd||df|rutj ||dqtj ||dq q WdS(Ns#saving current version of %s as %s s.orig( RtwjoinRvRwtlexistsR\tnoteRR tcopyfiletrename(RRctfilesRRtabsf((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRg>sc CsT|jd} tj||||} tj|j||||| || | dS(Ntstat(tgetR tmatchRtdiffordiffstatR\( RRcRtnode1tnode2RRtchangesRRtm((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt printdiffJsc Cs |j||gdtdtd|\}}|dkrC||fS|dkrktjtd|n|jjtd|t j |||j ||gdtdd ||} t j ||} | rtjtd | nt |d| j| jd t}|dkr=tjtd nyt|j||j} Wn*tk rtjtd |nX|j||}|j|d} t| } | r| j| n|j||||d| | j|j|d|fS(Nt update_statuststricttmergeisapply failed for patch %ss"patch didn't work out, merging %s tupdateRgR#supdate returned %dtforcesrepo commit failedsunable to read %sRR(tapplyRJRLR)R RRR\RR tcleanR#RRht descriptionR3RRSR9t ExceptionRR{RRRRyR(RRctmergeqtheadRtrevRRRtctxtrettphRR2((s,/sys/lib/python2.7/site-packages/hgext/mq.pytmergeoneQs:    '     cCs|dkrL|jj\}}|tkr1|S|js>dS|jdjS|jj|\}}|tkr|g|jD]}|j^q}kr|S|S(Ni(R)tdirstatetparentsRRRt changelog(RRcRtp1tp2tx((s,/sys/lib/python2.7/site-packages/hgext/mq.pytqparentsxs   1cCs|jsYd}t|dddt}|j||jjt||t|_n|j|}x|D]}|j |dt}|s|j j t d|d S|j |\} } | s|j|dtqon|j|} | s|j j t d|d S| d} |j||||| |\} }|rn|jjt||t|_n| ro| |fSqoW|jd |fS( Ns.hg.patches.merge.markers[mq]: merge markerRRspatch %s does not exist iRspatch %s is not applied i(iN(iN(RRhR)RLRR-RR}R tlookupR\RRRRt isappliedRR(RRcRRlRtpnameRRRRtreasontinfoRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt mergepatchs:     $  c Cst}yAtj|j||ddd|dd}tt||fSWnotk r}|jjt |d|jj s|jj t dn|jj tt|tfSXdS(sPApply patchfile to the working directory. patchfile: name of patch fileR#iRteolmodes s*patch failed, unable to continue (try -v) N(RRRR\R)RLRRRRRRRt tracebackRJ(RRct patchfileRtfuzzR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRs   c Cs!d} } } z|j} |j} |jd} yO|j|||||||d|d| d| }| j|j|SWnqtk r| j|jd|jj fSz| j Wd|j |jj |j XnXWdt | | | |j |XdS(Ntqpusht all_filesttobackupt keepchangesi(R)twlocktlockt transactiont_applyRyRRiRRtabortRRR(RRcRlRRRRRRRRRRttrR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRs2           c Cs|s|j}nd} d} x|D]} |j| \}}|s_|j| dtq%n|jjtd| tjj || }yt |j | |j }Wn2t k r|jj td| d} PnX|j}|sd| }n)|r|jd| ndj |}|jr| rtj|j||}t|| @}|r| rttd n|j||d t| |} n|j||\}}}|dk r|j|n| }n.|jj td | dgd}}}|r|rg}g}xF|D]>}tjj|j|ra|j|q0|j|q0Wx|D]}|jj|qyWx|D]}|jj|qW|jj\}}|j||ntj ||pg}|d }t!|d||j"|j#d |dt} |d |krPt$j%tdn| dkrtt$j%tdn|r|j&jt'| | n|r|jj tdd} Pn|r%|r%|jj tdd} Pq%q%W| | fS(sreturns (error, hash) error = 1 for unable to read, 2 for patch failed, 3 for patch fuzz. tobackup is None or a set of files to backup before they are modified by a patch. iRs applying %s sunable to read %s isimported patch %s s imported patch %ss s"local changes found, refresh firstRspatch %s is empty ttipRRs(qpush exactly duplicates child changesetsrepository commit faileds*patch failed, rejects left in working dir is)fuzz found when applying patch, stopping iN((RwR)RRRLR\RmRRvRSRR9RzRR1R-R8Rt changedfilesRRiRgRRRRRtremoveRRt setparentsR t matchfilesRhR3R4R RRR(RRcRlRRRRRRRRRRt patchnameRRR:RR1ttouchedtpatcherrRRtremovedtmergedRRRRtoldtip((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRs                !   c s|s|j}|r,|dj|nxY|D]N}ytj|j|Wq3tk r}|jtjkrqq3Xq3Wng}|r|j | }|j |4t |_ ng}xht g|D]}|j ||f^qdt D]2\} }| dk r|j| =q|j|qW|r|rtd|D} xu|D]6}td|jjt| ||fqQWqtdtjdjfd|Dn|jt |_g|D]} | j^qS(Ntreversecss!|]}|j|jfVqdS(N(RR(RR((s,/sys/lib/python2.7/site-packages/hgext/mq.pys Vss*revision %s refers to unknown patches: %s sunknown patches: %s R(c3s|]}|VqdS(N((RR(tmsg(s,/sys/lib/python2.7/site-packages/hgext/mq.pys \s(RR)tforgetRvRRSRRRRRLR}RRRR-tdictRR\RRR RRR~R( RRktnumrevsRRRRt qfinishedtunknownRQRR((R+s,/sys/lib/python2.7/site-packages/hgext/mq.pyt_cleanup9s@     .    + +  c Cs||jdjj}g}xt|D]\}}||kratjtd|n||}|j|j}|j|krtd} tj| |n|j|j} xHdD]@} |j| | krtd} |j j | | PqqW|j | q-W|S(Nisrevision %d is not manageds/cannot delete revision %d above applied patchess[mq]: %ssimported patch %ss-patch %s finalized without changeset message (s[mq]: %ssimported patch %s( RRRRR RRRRR\RmR-( RRctrevstfirstrevRkRQRRtbaseR+Rtfmt((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt _revpatchesbs$     cCs|j|j|t|}|j|t|}|r|jjddtr||d}|jjddt j }|j |kr|j j |krt j |||qndS(NRYRZiRs new-commit(t _phasecacheR6RR1R.R\R]RJRRtdraftRdRtadvanceboundary(RRcR2RkR/toldqbasettphase((s,/sys/lib/python2.7/site-packages/hgext/mq.pytfinishzs*c Cs| r/|jd r/tjtdng}x|D]}|j|dt}|j|}|rtjtd|n||jkrtjtd|n||kr<|j|q<q<Wd}|jdr|j s tjtdnt j ||jd}t |dkrW|d|dkrW|j n|j||} || 7}t | }n|j|||jd dS( NRs4qdelete requires at least one revision or patch nameRscannot delete applied patch %sspatch %s not in series fileisno patches appliediR(RR RRR RLR RlR-RR trevrangeR.R*R6R1( RRcRkRt realpatchesRRR.R2t revpatches((s,/sys/lib/python2.7/site-packages/hgext/mq.pytdeletes.   &  cCsd|jr`|jdj}|jdj}|jj|krVtjtdn||fSdS(s'check that working directory is at qtipis&working directory revision is not qtipN(NN( RRRRRR RRR)(RRcttopR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt checktoppatchs  cCsg}|d}|r#||}n|jd}xt|jD]n}|j|jtr}tjt d|qC||jks|j|jrC|j |qCqCW|S(svreturn list of subrepos at a different revision than substate. Abort if any subrepos have uncommitted changes.is'uncommitted changes in subrepository %sN( R)RRtsubstateRtdirtyRLR RRR-(RRctbaserevtinclsubstwctxtbctxR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt checksubstates  $cCszx"|d D]}d|kr dSq W|dkrE|djdn1|dkre|djdn|djddS(Nis .hgsubstatesa?iRii(R-(Rt substatestateRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytputsubstate2changess   cCs7|rtjtdntjtddS(Ns"local changes found, refresh firstslocal changes found(R RR(Rtrefresh((s,/sys/lib/python2.7/site-packages/hgext/mq.pytlocalchangesfoundscCs[|jd \}}}}|s4|s4|s4|rK| rK|j|n||||fS(Ni(RmRM(RRcRRLRRRtd((s,/sys/lib/python2.7/site-packages/hgext/mq.pytchecklocalchangessRlRmRnt.s..cCs||jkr+tjtd|nx9dD]1}|j|r2tjtd|q2q2Wx6d D].}||krntjtd|qnqnWdS( Ns*"%s" cannot be used as the name of a patchs.hgs.mqs!patch name cannot begin with "%s"RRs*"%s" cannot be used in the name of a patch(s.hgs.mq(RR(t _reservedR RRR(RRRPR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytcheckreservednames    cCs|j|| rtjj|j|rtjj|j|rftjtd|qtjtd|ndS(Ns""%s" already exists as a directoryspatch "%s" already exists( RRRvRwRRStisdirR RR(RRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytcheckpatchnames  " cCs(|r$|r$tjtdndS(Ns*cannot use both --force and --keep-changes(R RR(RRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytcheckkeepchangess cOsL|jd}|jd}|jd}|rEtj|}n|ji|jdd6}|jdtr|j|n|j|} | r| jd|jd} n|jds|jds|rQ| rt |pg| }nt j |d!||} d } | | _ |jd | } | d \}}}}n'|j|d t} | \}}}}t j||||| } t|d!jd krtjtdn|||}|j||j}|j}z=y|j|d}Wn5tk rM}tjtd||jfnXyy|jr|r|jd|d|s|jdqn|r|jd|qnp|jd|jdt|d!jjd|r|jd|dn|r|jd|ntj |dr9|}n|rE|pLd|}t!|d!|||d | d t}|d!krtjtdny|g|j"||+|j#jt$|||j%t|_&t|_'|r|d}|j|n|r{|j(||}| r3|j)| | nt*j+|d|d|d| d|}x|D]}|j|qaWn|j,|j-}|r|d!j.|gnWn|j/nXWnbt0k r+|j1|}yt2j3|Wn+t4k r$|j5j6td |nXnX|j7|Wd!t8|Xd!S("sWoptions: msg: a string or a no-argument function returning a string R+R3R4Rot checknames .hgsubstatetincludetexcludecSs,|dkr(tjd||fndS(Ns .hgsubstates%s: %s(R R(RR+((s,/sys/lib/python2.7/site-packages/hgext/mq.pytbadfns RiRiscannot manage merge changesetsRscannot write patch "%s": %ssFrom: s s Date: %d %d s# HG changeset patch s # Parent s# User s# Date %s %s t__call__s[mq]: %ssrepo commit faileds RRRRserror unlinking %s N(9RR t parsedateRRLRTRIR-RRR RR)RRmROR#R.RRRRBt fullseriesendRR{RztstrerrorR9RRRRt safehasattrRhRRRRR~R}R RKRtdiffRyRRtrollbackRRSRvRRR\RRR(RRcRtpatsRR+R3R4RRFRJRRYRRRRRNt commitfilesR0RRRt commitmsgRR5tchunkstchunkt patchpath((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRNs $       %              tallc Csd}}z|j}|j}|rz|j|d|dt|j||d}tj|||jj nt j |j |||Wdt ||XdS(NRRLi(R)RRRORJR R RRRR R#R\R( RRcR2RRgRRRturev((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR#Xs   cCsFx?t|jD].\}}|j|kr||j|jfSqWdS(sreturns (index, rev, patch)N(RRRRR)(RRRQR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR hsc s)fd}|jkr"|Stjjj|s yt|}Wnttfk rfn;Xtj |kotjknrj|S|s ||}|r|S|j d}|dkr]||| }|r]jj |}yt||dpd}Wnttfk r7qZX||dkrZj||Sq]n|j d} | dkr ||| }|rjj |}yt|| dpd}Wnttfk rqX||tjkrj||Sqq q nt j t d|dS(Ncs|jkr|SgjD]}||kr|^q}t|dkrjjtd|x"|D]}jjd|qnWdS|r|dSjrjr|dkrjjtdS|dkrjdSndS(Nispatch name "%s" is ambiguous: s %s itqtiptqbase( RlR.R\RRR)Rt seriesendRL(RR tmatchesR(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt partialnamevs (   RiiRspatch %s not in series(RlRvRwtisfileRStintRAt OverflowErrorR.trfindR@R RR( RRRRmtsnoROtminusRQtofftplus((Rs,/sys/lib/python2.7/site-packages/hgext/mq.pyR usJ/    c (Cs|j| ||j} |j} zg} x*|jjD]\}}| |7} qDW| sptg} n|jj| kr| r|jj t dn|j s|jj t ddS|r|j |}|j|}|r-|dt|jdkr-|jj t d|dS|j|\}}|r|j j||jkrtjt d|qq|rt d|}n t d}|jj t d ||fdSn?|r|j d }|j|r|jj t d dSn|j}|t|j krK|jj t d dS| rr| rr|j|d |jn|rL| rtjt dn|rtjt dn|jrtjt dn|j |}t|j||jj}|s"tjt d|n|||dksLtj||qLn|rf|sptjt dnxGt|jD]6\}}|jj |dd|j |krPqqWxDt|j|D]/\}}|jj |dd|krPqqW||}|t|jks&t!|j|}|j|=|jj"|||j#t$|_%nt$|_&|dkr|j'|n|s|j |}|d}n|j j||d}t(}| r|s| r7|j|dt$\}}}} | r#|j|||| q7|j||n|j ||!}!t(}"yL|rt|j)|||!| }#n'|j*||!|d|"d|d| }#Wn|jj t d|jj}$tj+||$dx<|"D]4}%|%|jkrtj-|j.|%dt$qqW|jj t dnX|jsG|#dS|jd j/}&|#dr|#ddkrt d}'|jj0|'|&n|jj0t d|&|#dSWd| j1XdS(Ns"(working directory not at a head) sno patches in series iis qpush: %s is already at the top s#cannot push to a previous patch: %ss guarded by %ssno matching guardsscannot push '%s' - %s is"all patches are currently applied s#patch series already fully applied RLs.cannot use --exact and --keep-changes togethers&cannot use --exact and --move togethers(cannot push --exact with applied patchess"%s does not have a parent recordedRPs please specify the patch to moveRRRRs cleaning up working directory...t ignoremissingsdone s/errors during apply, please fix and refresh %s s now at: %s (2RURRt branchmapt iteritemsRRRR\RmRRlRR R R.RRR@RkR RRORRSR9R5R RRRRRtAssertionErrorR0RRLR~R}RBRRRtrevertR)t unlinkpathRRRR((RRcRRRRRgtmovetexacttnobackupRRRtheadstbtlsRRRtstarttrootttargett fullstarttrpnRQR@t fullpatchtendRRRRRNRRRRRRAR+((s,/sys/lib/python2.7/site-packages/hgext/mq.pytpushs    #       &           !  #   c CsT|j|||j}z&|r|j|} | sL|j|}n|j|} | stjtd|qn|js|jj td| S|rd} n*|r| dd} nt |jd} | t |jkr|jj td|dS|s|j j } g|jD]} | j ^q/} x| D]1}|| krK|jj tdt}qKqKWnfg|dj D]}|j ^q} t}x.|j| D]}|j | krt}PqqW|}t}|rg|j|d|p |\}}}}|rB|sd|j||qdqg|rg|j||||qgnt|_t |j}|j| j }y|jj|}Wn9tjk rt|}tjtd|nX||jd j gkrtjtd n||jd j jsPtjtd d td n|r|j||}||}|j|dd \}}}}|rtjtdnt||||@}|r|r|jn|j||x:|D]2}tj|j |dt|j j!|qWxK||D]?}||}|j"||j#|j$|j j%|q;W|j&|t'nx;t(|j| |!D]#}|jjtd|j)qW|j| |5|j*||gdtdd|jr+|jj+td|jd j)n|jj+tdWd|j,XdS(Nspatch %s is not appliedsno patches applied iisqpop: %s is already at the top sqpop: forcing dirstate update Rstrying to pop unknown node %sis?popping would remove a revision not managed by this patch queues*popping would remove an immutable revisionthints see "hg help phases" for detailsRPis!deletions found between repo revsRvs popping %s RRgR#s now at: %s spatch queue now empty (-RURR R R RRRR\RR.RRRRLR)RJRRORR}RRRt LookupErrorRtmutableR RmRMRgR{RRtwwritetdatatflagstnormalR"RtreversedRR#RR(RRcRRRRgR~RRRRRR trrRt needupdateRRRRRRNRRRRtqpRRtfctx((s,/sys/lib/python2.7/site-packages/hgext/mq.pytpopFs     ) !    "    !  'c Cs|j|\}}|s5|jjtddS|j||}|jdrfd|}}n |d}}|j||} |j|| ||d|d|dS(Nsno patches applied R*RR( RBR\RRR RR)RR( RRcRaRRARRRRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR_s c8 Ks |js#|jjtddS|jddj}|jd}|jd}|rudtj|}n|j}z |j ||jdj |jdj }} |j j ||gkrtjtd n||jstjtd d td n|j j|} |j||} |j|t| } | rx| jd |jd } nt|j| |j}|ji|jdd6| }|r|j|n|r|j|n|r|j|n|jt| |j| ddt}t |}|rD|j|n|j!| |d \}}}|j j"|}|j#j"|d}|}t$j%|d||}|jdrt$j'|||||j(}t$j%|dd|}nt$j)|}|j!d|d \}}}}t*|}t*|}t*|}x*|D]"}||krV|j+|qVqVWxD|D]<}||kr|j,||j+|q|j+|qWg}xX||D]L}||kr|j,||j|qn |j-||j+|qWt.|}t.|}t.|}|j!| d|d \} }!}"}#t*| |!|"|#}$g|||fD]}|j/|$^q}%t*| }&x|%D]}|&j0|qWt$j'||&}||j1}'y5|j2s|j3rdi}(xg|D]_})|jj4|)}*|*dk rm|*|jkrm|(j5|*gj|)n|jj+|)qWx|D]})|j6|)}+|+j7||)}*|*r|(j5|*dgj8|(j|)g|)|kr|(|*dj|)qn|)|(kr|(|)=qqWx|(j9D]0\}*},x!|,D]})|jj:|*|)q@Wq-WnTx|D]})|jj+|)qkWx0t.|jj;D]}+|jj:d|+qWx|D]}+|jj,|+qWg}xOt<t=|dddD]1}-|||-s|j||-||-=qqWx|D]}+|jj>|+q8Wx|D]}+|jj?|+qYWx|D]}+|jj@|+qzW|s|jAsd| }.qdj|jA}.n|}.|jBp|d}/||jC}0|jD| |jjEt|_F|jG||gdtHddWn|jjInXytJ||0|.|/|jKd|dt}1g|%D]}t.|^q|}2| r|jL| |2ntMjN|| d|2d|}3x|3D]}4|j|4qW|jO|jP}5x|'D]}6|1|5|6R!R RRRtppRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytrestoresb    "            "" cCsy|js#|jjtddS|j|jdrS|jjtddS|shtd}nd|jd}|j}|r|jj}|dt |d t |df7}n|d 7}|d j d |jD7}|d j d |j D7}|j |dt }|sF|jjtddS|jjt|dt |_|j|dS(Ns"save: no patches applied, exiting iisstatus is already saved shg patches saved states hg patches: s s Dirstate: %s %sis Patch Data: R(css|]}d|VqdS(s%s N((RR ((s,/sys/lib/python2.7/site-packages/hgext/mq.pys =scss|]}d|VqdS(s:%s N((RR ((s,/sys/lib/python2.7/site-packages/hgext/mq.pys >sRsrepo commit failed s.hg.patches.save.line(RR\RRRR+RRRRRSRRaRLR-RR}R(RRcR+RRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytsave,s.  +    cCsM|jrI|jdj}|j|}|dkrAt|jS|dSdS(Niii(RRRR)R.R(RRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR\Gs   cstd}fd}jrjjdj}yjj|}Wntk r[dSX||dS||S(sIf all_patches is False, return the index of the next pushable patch in the series, or the series length. If all_patches is True, return the index of the first patch past the last applied one. ics{s|tjkr|SxLt|tjD]2}j|\}}|r]|Sj|q8WtjS(N(R.RlRKRR(RRQRR(RR(s,/sys/lib/python2.7/site-packages/hgext/mq.pytnextVsii(RRRlR@RA(RRRRR((RRs,/sys/lib/python2.7/site-packages/hgext/mq.pyRkPs  cCsI|j|j}|jjs%|}n t|jj|d|}|S(NR(RRR\RRRlR@(RR@R R((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt appliednamehs    c sfd}|rX|r3tjtdntj||}|jdtn|svtjtdnt|dkst|dkr|rtjtdng} |r9|jj |jj |d} t| dkrtjtd|dnj r|jj |d } | gj D]} | j ^qDkr|tjtd |d n| j dj gkrtjtd |d n|jj j d j } |jj | d } nE| |jj |d gkr)tjtd |d nd} ji|d 6}x|D]}||jstjtd|dtdn|jj |\}}|jj |} |tkrtjtd|n| r| |krtjtd|| fn|} |s/td|}n||j||jjd |j|d}tj|| gd|d||jt| |}j jd |jj|| j|d}qLW|r|jjddtrt j!|t j"| gnj#t_$t_%nxt&|D]\}}|r-|dkr|tjtdnt|}j'|j(|}t)j*j+|stjtd|n|r$j||jj,td||ftj-|j(|q>|}n|dkrX| rXtjtdn*|stt)j*j.|j/d}nj||yP|dkrjj0j1}n+t2j3j|}|j1}|jWn0t4t5fk rtjtd|nXj|d}|j,||j|sQ||n|j6krj7|}|gj||+nj#t_%jj8td |jj|| j|d}qFWj9|| S(!Ncs/|jkr+tjtd|ndS(Ns&patch %s is already in the series file(RlR RR(R$(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt checkseriesrss*option "-r" not valid when importing filesR*sno files or revisions specifiedis5option "-n" not valid when importing multiple patchesis/revision %d is the root of more than one branchisrevision %d is already manageds*revision %d is not the parent of the queues"revision %d has unmanaged childrenRosrevision %d is not mutableRs see "hg help phases" for detailsscannot import merge revision %ds#revision %d is not the parent of %ds%d.diffRRRRYRZRs%-e is incompatible with import from -spatch %s does not existsrenaming %s to %s s$need --name to import a patch from -t/sunable to read file %ssadding %s to series file (:R RRR R=tsortRLR.RRRRRt parentrevsR)RRRtnormnameRTRR0R{RtexportRyRRR-R\R]RJRtretractboundaryRZRR}R~RRRRSRvRwRnRRtbasenameR+tfinRxR topenpathRRzRlR\RR(RRcRR$RtexistingRRoRtimportedRR4Rt lastparentRRRRRtseRQtfilenamet originpathttextRR@((Rs,/sys/lib/python2.7/site-packages/hgext/mq.pytqimportps*" %             $          N(sseriessstatussguardsRPs..(ERRR)RR t propertycacheRRRlRRRRRSRtretcompileRRRRRRRRJRRRRgRRR RRRLRRR1R6R<R@RBRIRKRMRORQRRRTRURNR#R R RRR_RLRRRRRRRR\RkRR(((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRj+s "             ' '   ] )      f =   k   7  6    cCsO|jdd s1|jds1|jdr5|St|}t|d<|S(NRYRRR}t keep_changes(R]RR-RL(R\R((s,/sys/lib/python2.7/site-packages/hgext/mq.pytfixkeepchangesoptss "  sqdelete|qremove|qrmtkRskeep patch fileRRs%stop managing a revision (DEPRECATED)tREVshg qdelete [-k] [PATCH]...cOs*|j}|j||||jdS(s=remove patches from queue The patches must not be applied, and at least one patch is required. Exact patch identifiers must be given. With -k/--keep, the patch files are preserved in the patch directory. To stop managing a patch and move it into permanent history, use the :hg:`qfinish` command.i(RYR@R(R\RcRkRtq((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR@s  tqappliedt1tlasts%show only the preceding applied patchshg qapplied [-1] [-s] [PATCH]c Ks|j}|rS||jkr:tjtd|n|jj|d}n|jt}|jdr| r|j tddS|jdr|dkr|j tddS|jdr|d}d}nd}|j |d|d |d d d |jd d S(s<print the patches already applied Returns 0 on success.spatch %s is not in series fileiRsno patches applied sonly one patch applied iiRRRmRRN( RYRlR RRR@RkRLRRR(R\RcRRRRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRs$   t qunappliedRsshow only the first patchshg qunapplied [-1] [-s] [PATCH]cKs|j}|rS||jkr:tjtd|n|jj|d}n|jt}|t|jkr|j dr|j tddS|j drdpd }|j |d|d|ddd |j d d S( s<print the patches not yet applied Returns 0 on success.spatch %s is not in series fileiRsall patches applied RRRmRRN( RYRlR RRR@RkRLR.RRR)R(R\RcRRRRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR1s $RRRsimport file in patch directoryRRR(sname of patch filetNAMERRsoverwrite existing filess)place existing revisions under mq controlRRosuse git extended diff formattPRsqpush after importings>hg qimport [-e] [-n NAME] [-f] [-g] [-P] [-r REV]... [FILE]...cOs|j}z||j}za|j||d|jdd|jdd|jdd|jdd|jd}Wd|jXWd|jX|r|jdr|jd r|j||d Sd S( simport a patch or existing changeset The patch is inserted into the series after the last applied patch. If no patches have been applied, qimport prepends the patch to the series. The patch will have the same name as its source file unless you give it a new one with -n/--name. You can register an existing patch inside the patch directory with the -e/--existing flag. With -f/--force, an existing patch of the same name will be overwritten. An existing changeset may be placed under mq control with -r/--rev (e.g. qimport --rev tip -n patch will place tip under mq control). With -g/--git, patches imported with --rev will use the git diff format. See the diffs help topic for information on why this is important for preserving rename/copy information and permission changes. Use :hg:`qfinish` to remove changesets from mq control. To import a patch from standard input, pass - as the patch file. When importing from standard input, a patch name must be specified using the --name flag. To import an existing patch while renaming it:: hg qimport -e existing-patch -n new-name Returns 0 if import succeeded. R$RRRRRoNRii(RRYRRRRR(R\RcRRRRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRIs+  % %cCs|j}|j||}|j|rtjj|jds|jdd}|jd|jd|jd|jd|jd|j ntjj|jds|jddj n|d j ddgt j ||nd S( s"initialize a new queue repository This command also creates a series file for ordering patches, and an mq-specific .hgignore file in the queue repository, to exclude the status and guards files (these contain mostly transient state). Returns 0 if initialization succeeded.s .hgignoreRs^\.hg s^\.mq s syntax: glob sstatus sguards RliN( RYRRRvRwRRtwopenerRRyR)RR(R\RcRRRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytqinits"        s^qinitRs create-reposcreate queue repositorys hg qinit [-c]cKst||d|jdS(sinit a new queue repository (DEPRECATED) The queue repository is unversioned by default. If -c/--create-repo is specified, qinit will create a separate nested repository for patches (qinit -c may also be run later to convert an unversioned patch repository into a versioned one). You can use qcommit to commit changes to this queue repository. This command is deprecated. Without -c, it's implied by other relevant commands. With -c, use :hg:`init --mq` instead.Rt create_repo(RR(R\RcR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRstqclonetpulls"use pull protocol to copy metadataRtnoupdates)do not update the new working directoriest uncompresseds)use uncompressed transfer (fast over LAN)RRks#location of source patch repositorytREPOs#hg qclone [OPTION]... SOURCE [DEST]c Ks)d}|dkr'tj|}ntj|||j|}|jdro|j|jd}n ||}ytj|||Wn)tjk rtj t dnXd\}}|j r|j } | j j r| |jtjkr| j j dj}tj|s|t| j} t| j| j|}|j| jj|dq|qn<|jdry|jd}Wqtjk rqXn|jt dtj|||j|d|jdd |d td |jd \}} |jt d tj|||jdpS|||| d|jdd |jd d |jd | j r%| j } |r|jt d| j j | |gd tddn|jds%|jt dtj!| | jj"q%ndS(sTclone main and patch repository at same time If source is local, destination will have no patches applied. If source is remote, this command can not check if patches are applied in source, so cannot guarantee that patches are not applied in destination. If you clone remote repository, be sure before that it has no patches applied. Source patch repository is looked for in /.hg/patches by default. Use -p to change. The patch directory must be a nested Mercurial repository, as would be created by :hg:`init --mq`. Return 0 on success. cSs0|j}|jdr(|d }n|dS(s+compute a patch repo url from a repo objectRis /.hg/patches(turltendswith(RcR ((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRs  Rks4versioned patch repository not found (see init --mq)iR Rjscloning main repository RRRtstreamRscloning patch repository Rs6stripping applied patches from destination repository Rgs updating destination repository N(NN(#R)R t defaultdesttpeert expandpathRRt RepoErrorR RRtlocalRYRRdRRZRtislocalRRRt differenceR-RRtcapableR RtcloneR RJR#RR( R\tsourcetdestRRtsrt patchespathRjtdestrevRcRtdr((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRsV      %&0  %s qcommit|qcis ^commit|ciis hg qcommit [OPTION]... [FILE]...cOsJ|j}|j}|s-tjdntj|j|||dS(sscommit changes in the queue repository (DEPRECATED) This command is deprecated; use :hg:`commit --mq` instead.sno queue repositoryN(RYRR RRRaR\(R\RcRaRRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRa s   RRRsprint patches not in seriesshg qseries [-ms]cKs2|jj|d|jdd|jddS(s7print the entire series file Returns 0 on success.RRi(RYRR(R\RcR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRl stqtops hg qtop [-s]c Ks}|j}|jr!|jtp$d}|rb|j|d|dddddd|jdn|jtddSd S( s>print the name of the current patch Returns 0 on success.iRiRRmRRsno patches applied N(RYRRkRLRRRR(R\RcRRtt((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRA s "tqnexts hg qnext [-s]c Ksm|j}|j}|t|jkrA|jtddS|j|d|ddd|jddS(sDprint the name of the next pushable patch Returns 0 on success.sall patches applied iRRRN(RYRkR.RlRRRR(R\RcRRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR, s   tqprevs hg qprev [-s]c Ks|j}t|j}|dkr;|jtddS|sX|jtddS|jj|jdj}|j|d|ddddd |j d d S( sHprint the name of the preceding applied patch Returns 0 on success.isonly one patch applied sno patches applied iRRRmRRN( RYR.RRRRlR@RRR(R\RcRRR!R((s,/sys/lib/python2.7/site-packages/hgext/mq.pytprev8 s  cCsl|jd r2|jdr2|j|d" to patchtuR3sadd "From: " to patchtUSERtDR!s#add "Date: " to patchRNR4sadd "Date: " to patchtDATEs0hg qnew [-e] [-m TEXT] [-l FILE] PATCH [FILE]...cstjfd}|j}d<jdrV|dupdate the current patch If any file patterns are provided, the refreshed patch will contain only the modifications that match those patterns; the remaining modifications will remain in the working directory. If -s/--short is specified, files currently included in the patch will be refreshed just like matched files and remain in the patch. If -e/--edit is specified, Mercurial will start your configured editor for you to enter a message. In case qrefresh fails, you will find a backup of your message in ``.hg/last-message.txt``. hg add/remove/copy/rename work as usual, though you might want to use git-style patches (-g/--git or [diff] git=1) to track copies and renames. See the diffs help topic for more information on the git diff format. Returns 0 on success. R%sno patches applied is*option "-e" incompatible with "-m" or "-l"is R+N(RYRR+RRRRR RRRRSR9R%R1R3R"tsavecommitmessageR$RRLRR( R\RcRaRRR1RRRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRL s&$  -   s^qdiffshg qdiff [OPTION]... [FILE]...cOs|jj|||dS(sdiff of the current patch and subsequent modifications Shows a diff which includes the current patch as well as any changes which have been made in the working directory since the last refresh (thus showing what the current patch would become after a qrefresh). Use :hg:`diff` if you only want to see the changes made since the last qrefresh, or :hg:`export qtip` if you want to see changes made by the current patch without including changes made since the qrefresh. Returns 0 on success. i(RYR_(R\RcRaR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR_ stqfoldsedit patch headerskeep folded patch filess/hg qfold [-e] [-k] [-m TEXT] [-l FILE] PATCH...cOs|j}|s'tjtdn|j|dsRtjtdn|j|tj||}|jdr|rtjtdqn|j d}g}g}x|D]} |j | } | |ks| |kr |j td| n|j | r5tjtd| n|j | qWx|D]} |st |j| |j} | jr|j | jqn|j| } |j|| \} }}| sMtjtd | qMqMW|sTt |j||j} | j| j}}x(|D] }|j d |j|qWd j|}n|jdr|j||p{|j}n|j|j|}|j}z=|j|d |d |j|j||||jWd|jXdS(s,fold the named patches into the current patch Patches must not yet be applied. Each patch will be successively applied to the current patch in the order given. If all the patches apply successfully, the current patch will be refreshed with the new cumulative patch, and the folded patches will be deleted. With -k/--keep, the folded patch files will not be removed afterwards. The header for each folded patch will be concatenated with the current patch header, separated by a line of ``* * *``. Returns 0 on success.s&qfold requires at least one patch nameisno patches appliedR%s*option "-e" incompatible with "-m" or "-l"Ris!skipping already folded patch %s s*qfold cannot fold already applied patch %sserror folding patch %ss* * *s R+RoN(RYR RRRBRORR+RR RR R-RRSR9R1RR3RR%R"RRRRLRoR@RR(R\RcRRRR1R5RktmessagesRRRR:t patchsuccessRR3R+RR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytfold s\         ! tqgotos keep-changess&tolerate non-conflicting local changessoverwrite any local changess no-backups"do not save backup copies of filesshg qgoto [OPTION]... PATCHc Kst||}|j}|j|}|jd}|jd}|j|r|j||d|jdd|d|}n-|j||d|jdd|d|}|j|S(sSpush or pop patches until named patch is at top of stack Returns 0 on success.t no_backupRRR~R(RRYR RR RRR(R\RcRRRR~RR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytgoto s  $ $  tqguardR!Rslist all patches and guardstnonesdrop all guardss8hg qguard [-l] [-n] [PATCH] [-- [+GUARD]... [-GUARD]...]csfd}|jtdjDd}t|}|jdr|sm|jdrtjtdnx't t j D]}||qWdS| s|ddd!d krjstjtd njd j }n|dkr:|ddd!d kr:|j d}n|dkr^tjtd n|ss|jdrj|}|dkrtjtd |nj||jn|j jj|dS(sset or print guards for a patch Guards control whether a patch can be pushed. A patch with no guards is always pushed. A patch with a positive guard ("+foo") is pushed only if the :hg:`qselect` command has activated it. A patch with a negative guard ("-foo") is never pushed if the :hg:`qselect` command has activated it. With no arguments, print the currently active guards. With arguments, set guards for the named patch. .. note:: Specifying negative guards now requires '--'. To set guards on another patch:: hg qguard other.patch -- +2.6.17 -stable Returns 0 on success. cs9j|pdg}j|kr2d}n"j|drNd}nd}d||f}jdjj||xt|D]\}}|jdrj|d d n8|jd rj|d d nj|d d |t|dkrjdqqWjddS(Nt unguardedRiRRs!qguard.patch qguard.%s qseries.%ss%s: RRsqguard.positiveRsqguard.negativesqguard.unguardediRs (RRlRRRRRR.(RRnRRRQR(RRR\(s,/sys/lib/python2.7/site-packages/hgext/mq.pyRmK s"  $css|]}|jVqdS(N(R(RR((s,/sys/lib/python2.7/site-packages/hgext/mq.pys a sRR5s.cannot mix -l/--list with options or argumentsNiis-+sno patches appliedisno patch to work withsno patch named %s(RYRRR)RRR RRRKR.RlRRRRRR@R (R\RcReRRmRRQR((RRR\s,/sys/lib/python2.7/site-packages/hgext/mq.pyR2 s4   #   tqheadershg qheader [PATCH]cCs|j}|r!|j|}n/|jsA|jtddS|jd}t|j||j}|jdj|jddS(sMprint the header of the topmost or specified patch Returns 0 on success.sno patches applied iRis N( RYR RRRRRSR9R1(R\RcRRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytheader| s  c Cstjj|\}}tj|}tjd|}d}d}xb|D]Z}|j|}|rMt|j d} |dks| |kr| }|}qqMqMW|rtjj |||fSdS(Ns %s.([0-9]+)i(NN( RvRwRtlistdirRRR)RRotgroupRS( Rwt directoryR4tnamestnameretmaxindextmaxnameRRR@((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt lastsavename s cCs=t|\}}|dkr'd}n|d|d}|S(Nis.%di(R@R)(RwRR@tnewpath((s,/sys/lib/python2.7/site-packages/hgext/mq.pytsavename s   s^qpushsapply on top of local changesR}s-apply the target patch to its recorded parentslist patch name in commit textRRgsapply all patchesRs%merge from another queue (DEPRECATED)smerge queue name (DEPRECATED)R|s-reorder patch series and apply only the patchs0hg qpush [-f] [-l] [-a] [--move] [PATCH | INDEX]c KsF|j}d}t||}|jdr|jdrW|j|jd}nt|j\}}|s|jtddSt ||j |j|}|jtd|jn|j ||d|jdd|jdd|d |jd d |jd d |jd d |jd d|jd}|S(s,push the next patch onto the stack By default, abort if the working directory contains uncommitted changes. With --keep-changes, abort only if the uncommitted files overlap with patched files. With -f/--force, backup and patch over uncommitted changes. Return 0 on success. RRs%no saved queues found, please use -n ismerging with queue at: %s RRRRgR|R}R~R2RRN( RYR)RRRSR@RwRRRjR|R( R\RcRRRRRARQR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR s" -$s^qpopspop all patchessqueue name to pop (DEPRECATED)s)forget any local changes to patched filess!hg qpop [-a] [-f] [PATCH | INDEX]cKst||}t}|jdrtt||j|j|j|jd}|jtd|jt }n |j }|j ||d|jdd|d|jdd|jdd|jd }|j |S( spop the current patch off the stack Without argument, pops off the top of the patch stack. If given a patch name, keeps popping off patches until the named patch is at the top of the stack. By default, abort if the working directory contains uncommitted changes. With --keep-changes, abort only if the uncommitted files overlap with patched files. With -f/--force, backup and discard changes made to such files. Return 0 on success. Rsusing patch queue: %s RRRgR~R2RR( RRLRRjR|RwRSRRRJRYRR(R\RcRRt localupdateRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR s-  $ s qrename|qmvshg qrename PATCH1 [PATCH2]cKs|j}|s|}d}n|r6|j|}n/|jsV|jtddS|jd}|j|}tjj |rt tjj|tjj |}|j|}n|j ||j td||f|j|}|jj|j|}|djg|D]} d| ^q!|j|<|jt|_|j|} | rt| d||j| d sRiiRs%s::.RNRR((RRRRR R=RR RRRLRxRRJR2RRt descendantstunionRRRRRRYRR R}R.RRRRR RRRRRR#(R\RcR2RRgtmarkRtuniquebmRRtrsrevsROt strippedrevstrootsRRt rootnodesRRRRQRRRhtuctxtdescendantrevsR RRRt dirchanges((RNs,/sys/lib/python2.7/site-packages/hgext/mq.pyR#g s.     "  !         )    tqselectsdisable all guardsRlslist all guards in series fileRs)pop to before first guarded applied patchtreapplyspop, then reapply patchess!hg qselect [OPTION]... [GUARD]...c Os.|j}|j}|s*|jdr|j|}gtt|jD]}|j|dsO|^qO}|j||j |s|j t dn|jd r|jd r|j|} gtt|jD]}|j|ds|^q} t| t|krU|j t dt|t| fnt| t|kr|j t dt|t| fqqnb|jdri}d} xU|j D]J} | s| d 7} nx.| D]&} |j | d|| cd 7I ssguards in series file: s%2d s sno guards in series file sactive guards: sno active guards ispopping guarded patches Rgsreapplying unguarded patches N(RYRRRRKR.RRRRRmRRRRRRRRRRJRLRRR(R\RcReRRRnt old_unappliedRQt old_guardedRRtnoguardstgsRRtcountR[tpoppedRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytselect s|)     #      '  tqfinishRsfinish all applied changesetsshg qfinish [-a] [REV]...cOs|jd r/| r/tjtdn|jdrKd |}n|j}|jst|jtddStj||}|dj |kr|dj r|j tdn|j }z|j|||jWd|jXdS( shmove applied patches into repository history Finishes the specified revisions (corresponding to applied patches) by moving them out of mq control into regular repository history. Accepts a revision range or the -a/--applied option. If --applied is specified, all applied mq revisions are removed from mq control. Otherwise, the given revisions must be at the base of the stack of applied patches. This can be especially useful if your changes have been applied to an upstream repository, or if you are about to push your changes to upstream. Returns 0 on success. Rsno revisions specifieds qbase::qtipsno patches applied iRPs6warning: uncommitted changes in the working directory N(s qbase::qtip(RR RRRYRRmR R=RR)RRRR<RR(R\RcR=RRR2R((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR<m s"   &  tqqueueslist all available queuesRsprint name of active queueRscreate new queueRsrename active queuesdelete reference to queuetpurges"delete queue, and remove patch dirs[OPTION] [QUEUE]c sjdddfdfd}fd}fd}fdfd }fd }d } fd } | s|jd s|jdrt} |jdr|jd| fdSx^|D]S} |jd| f| | kr_|j r_|jtdq|jdqWdS| |stjtdn||jdr|krtjtd|n|r|n||||n |jdrk} || krEtjtd|n|krmtjtd|n|| } ||}tjj |rtjtd|nj dd}xjD]b} | | kr|jd|ftjj | r.tj | |q.q|jd| fqW|j tj j dj |n|jdr| |n|jdr|kr| |n||}tjj |rtj|qn.|krtjtdn||dS(s6manage multiple patch queues Supports switching between different patch queues, as well as creating new patch queues and deleting existing ones. Omitting a queue name or specifying -l/--list will show you the registered queues - by default the "normal" patches queue is registered. The currently active queue will be marked with "(active)". Specifying --active will print only the name of the active queue. To create a new queue, use -c/--create. The queue is automatically made active, except in the case where there are applied patches from the currently active queue in the repository. Then the queue will only be created and switching will fail. To delete an existing queue, use --delete. You cannot delete the currently active queue. Returns 0 on success. Rkspatches.queuess patches.queuecs5tjjj}|jdr1|d}n|S(Nspatches-i(RvRwRR(R(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt _getcurrent s cs9y jd}|jWntk r4tSXtS(NR(R{RyRzRLRJ(R(t _allqueuesRc(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt _noqueues s  cs}ygjd}g|D]}|jr%|j^q%}|j||kro|j|nWntk rg}nXt|S(NR(R{R#RyR-RzR(tcurrentRRjtqueues(Rjt _defaultqueueRiRc(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt _getqueues s +    cs/jr!tjtdn|dS(Ns@new queue created, but cannot make active as patches are applied(RR RR(R(t_setactivenocheckR(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt _setactive s cs<jd}|dkr.|j|n|jdS(NRRk(R{RRy(RR(t _activequeueRc(s,/sys/lib/python2.7/site-packages/hgext/mq.pyRp s cs4jd}|jd|f|jdS(NRs%s (R{RRy(RR(RjRc(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt _addqueue scs.|dkrjdSjd|SdS(NRkspatches-(RS(R(Rc(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt _queuedir s  cSs%x|D]}|dkrtSqWtS(Ns:\/.(RJRL(RR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt _validname s  cs|kr$tjtdn}||krQtjtdnjdd}x4D],}||krqjn|jd|fqjW|jtjjdjdS(Ns'cannot delete queue that does not exists$cannot delete currently active queuespatches.queues.newRs%s (R RRR{RRyRRS(RRlRRj(RjRiRRc(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt_delete s      RRs%s Ns%ss (active) s s9invalid queue name, may not contain the characters ":\/."Rsqueue "%s" already existsRs%can't rename "%s" to its current names'non-queue directory "%s" already existsspatches.queues.newRR@Rhs"use --create to create a new queue(RYRRtquietRR RRvRwRR{RRyRStshutiltrmtree(R\RcRRRkRoRqRsRtRuRvRlRjtolddirtnewdirRtqdir((RrRjRnRiRpRRRcs,/sys/lib/python2.7/site-packages/hgext/mq.pyRg s   %                 "      cCsn|jjrj|jjddtr0tj}n tj}||jjdj}||j |jn|S(sEcallback used to set mq changeset as secret when no phase data existsRYRZi( RYRR\R]RJRRZR8RR(RcRUtmqphaseRj((s,/sys/lib/python2.7/site-packages/hgext/mq.pytmqphasedefaultsH s   csKd|jffdY|jrG|_|jjtndS(Ntmqrepoc sheZejdZedZddddeeifdZfdZ fdZ RS(cSst|j|j|jS(N(RjR\R|Rw(R((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRYU scSs}|jjry| ry|jj}g|jjD]}|j^q/}|d|ksd|d|krytj|qyndS(Nii(RYRRRRR R(RterrmsgRRRRk((s,/sys/lib/python2.7/site-packages/hgext/mq.pytabortifwdirpatchedY s " R(cs>|jtd|t|j|||||||S(Ns&cannot commit over an applied mq patch(RRtsuperRa(RRR3R4RRteditortextra(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pyRa` s  cs|jjr| rg|jjD]}|j^q }|r{t|}x1t|D] }||krjPqT|jqTWnxB|D]7}||jtjkrt j t dqqWnt |j ||dS(Nssource has mq patches applied(RYRRRRRRdRRZR RRRt checkpush(RRR2Rt outappliedRR(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pyRi s"   cst|j}|j}|js+|Sg|jD]}|j|jf^q5}y"|jjj|ddWn=t j k r|j j t dt|dd|SX|jj}g|D]}||dr|^q}|s|S|j|dddf|j|dddf|j|jj|ddddf|d}xQ|D]I}|d|kr|j j t d|dqf|d||dAdd --mq option to operate on patch repository instead of mainRYsno queue repositoryN(RR)RYRR RRR\(RR\RcReRfRYRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt mqcommand s  c Os|||||}|j}g}t|jt|j|}} |ru|j|jtdd|n| r|j|jtdd| n|r|jtddj|n|j td|S(Ns %d appliedsqseries.applieds %d unappliedsqseries.unapplieds mq: %s s, smq: (empty queue) ( RYR.RRR-RRRRSR( RR\RcReRfRRRRR&((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR s %&&#cCsqtj|ddtdtg|jjD]}||jj^q,}g|D]}||krU|^qUS(s+``mq()`` Changesets managed by MQ. ismq takes no arguments(R tgetargsRRRYRRR(RctsubsetR RR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytrevsetmq s2csdddtdfgtjtjdttjtjdttjtjdt}|dj t tj j dfd }|tjxBtjD]4\}}|j t kr|t|d iqqWttjd<sx(."0        3       L  !! !  ( ,E  G              9    j+  T