Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/hgext/mq.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��c@s�dZddlmZddlmZmZmZmZmZddl	m
Z
ddlmZm
Z
mZmZmZmZddlmZmZmZmZddlmZddlZddlZddlZddlZejd	7_d
deed�fgZiZe
j e�Z d
Z!ej"Z#de$fd��YZ%de$fd��YZ&d�Z'dej(fd��YZ)de$fd��YZ*d�Z+e dddeed�fddged�ed�fged ��d!��Z,e d"d#d$eed%�fgeed&��ed'��Z-e d(d#d)eed*�fgeed+��ed,��Z.e d-d.d/eed0�fd1d2d3ed4�ed5�fd6d7eed8�fddged9�ed�fd:d;eed<�fd=d>eed?�fged@��dA��Z/dB�Z0e dCdDdEeedF�fgedG��dH��Z1e dId3dJeedK�fdLdMeedN�fd3dOeedP�fdQdRd3edS�edT�fgej2edU��edV��Z3e dWej4dXdYedZ��d[��Z5e d\d]d^eed_�fgeed`��da��Z6e dbeedc��dd��Z7e deeedf��dg��Z8e dheedi��dj��Z9dk�Z:e dld.dmeedn�fd6d7eedo�fd:d;eed<�fdLdpeedq�fdrdsd3edt�edu�fdvdweedx�fdydzd3ed{�ed|�fgej;ej<ed}��d~��Z=e dd.dmeedn�fd:d;eed<�fd
d�eed��fdLdpeed��fdrdsd3ed��edu�fdvdweed��fdydzd3ed��ed|�fgej;ej<ed���d���Z>e d�ej?ej@ej;ed���d���ZAe d�d.dmeed��fddeed��fgej<ed���d���ZBe d�d3d�eed��fd6d7eed��fd3d�eed��fged���d���ZCe d�d�d�eed��fd1d�eed��fged���d���ZDe d�ged���ed���ZEd��ZFd��ZGe d�d3d�eed��fd6d7eed��fd.d�eed��fd�d�eed��fd�d�eed��fd]d�eed��fd1d2d3ed��ed5�fd3d�eed��fd3d�eed��fg	ed���ed���ZHe d�d�d�eed��fd1d2d3ed��ed5�fd3d�eed��fd6d7eed��fd3d�eed��fged���ed���ZIe d�ged���ed���ZJe d�dyd�eed��fdrd�eed��fged���d���ZKe d�dDd�eed��fd1d2d3ed��ed5�fd.d�eed��fd6d7eed��fgej<ed���d���ZLe d�ddged��ed�fd6d7eed��fd�d�eed��fd3d�eed��fd3d�eed��fd1d3eed��fddeed��fd�d�d3ed��fged���d���ZMe d�d1d�eed��fd
d�eed�fd3d�ed�fd3d�ed�fged��d��ZNe d��d�ed�fged��d��ZOe d��d�ePed�fd3d�Ped�fdDd�ed�fd3d�ed�fd3d�ePed�fd3d�ed�fged��ed��ZQd�ZRd�ZSd�ZTd�ZUd�ZVd�ZWd�ZXeXgZYd�ZZidd6dd6dd6dd6d	d
6dd6d	d
6Z[ej\d7_\dS(s�manage 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 headertinternaltstatusentrycBseZd�Zd�ZRS(cCs|||_|_dS(N(tnodetname(tselfRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt__init__SscCst|j�d|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	tpatchheadercBs\eZed�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�ZRS(	c
Csyd�}d�}g}g}d}d}d}	d}
d}d}d}
d}xXt|�D]J}|j�}|jd�s�|r�|jd�r�d}Pnd}|jd�r�d}q[n�|
d	kr�|jd
�r�d}q�|jd�r|d}q�|jd
�r"|dj�}	q�|jd�r>|d}q�|jd�rZ|d}
q�|jd�r�|r�|j|�d}
q�n|dkr�g}d	}
n�dkr�jd�s�|jd�r�d}d}
n�|
dkr|jd�s|jd�r|d}d}
nz|
dkr[|jd�sH|jd�r[|d}d}
n=|
dkr||dkr|d}
n|s�|r�|j|�n|j|�q[W||�||�t|�|_||�||�|
r|
jd�r|r|jdd�|jd|�n||_	||_
||_||_|	|_
|
|_||_|dk|_||_dS(NcSsSxL|rN|d}|jd�s@|jd�s@|jd�rJ|d=qPqWdS(Ni�sdiff -sIndex:s===========(t
startswith(tlinestl((s,/sys/lib/python2.7/site-packages/hgext/mq.pyteatdiffZs	

cSs,x%|r'|dj�s#|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|�s�y1|jjd�}|jj|dd|�Wq�tk
r�|jst|jdg�r�d|g|j|_q�dd|dg}||j|_q�Xn||_dS(NsFrom: s# User s# HG changeset patchisDate: R((tupdateheaderR2tindexR0t
ValueErrorR9t
_hasheaderR3(RR3t
patchheaderatttmp((s,/sys/lib/python2.7/site-packages/hgext/mq.pytsetuser�s
cCs�|jddg|�s�y1|jjd�}|jj|dd|�Wq�tk
r�|jst|jdg�r�d|g|j|_q�dd|dg}||j|_q�Xn||_dS(NsDate: s# Date s# HG changeset patchisFrom: R((R?R2R@R0RAR9RBR4(RR4RCRD((s,/sys/lib/python2.7/site-packages/hgext/mq.pytsetdate�s
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	setparent�s
cCs8|jr|j�n|g|_|j|j7_dS(N(R2t_delmsgR1(RR1((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt
setmessage�s	
cCslt}x_|D]W}xNtt|j��D]7}|j|j|�r)|||j|<t}Pq)q)Wq
W|S(sbUpdate all references to a field in the patch header.
        Return whether the field is present.(tFalsetxrangeR.R2RtTrue(Rtprefixestnewtrestprefixti((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR?�s
cCs<x5|D]-}x$|jD]}|j|�rtSqWqWtS(s8Check if a header starts with any of the given prefixes.(R2RRLRJ(RRMRPtcomment((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRB�s

cCs!|js
dSdj|j�dS(NR(s
s

(R2tjoin(R((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt__str__�s	cCs�|jrzd|jdj�}xWtt|j��D]=}||j|j�kr6|j|=|jd|_Pq6q6Wnd}x?|jD]4}x!||j|kr�|d7}q�W|j|=q�WdS(s�Remove existing message, keeping the rest of the comments fields.
        If comments contains 'subject: ', message will prepend
        the field and a blank line.s	subject: iiiN(R1tlowerRKR.R2(RtsubjRQtcitmi((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRH�s	
(RRRJRRERFRGRIR?RBRTRH(((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRXsd	
	
						cOs�|j�}|dkr?|jjddt�r?tj}q?n|dk	rc|jjdd�}nt|_	z9|dk	r�|jj
dd|�n|j||�SWdt|_	|dk	r�|jj|�nXdS(s�helper dedicated to ensure a commit respect mq.secret setting

    It should be used instead of repo.commit inside the mq source for operation
    creating new changeset.
    tmqtsecretRs
new-commitN(
t
unfilteredR)tuit
configboolRJRRZtbackupconfigRLt_committingpatcht	setconfigtcommitt
restoreconfig(trepotphasetargstkwargstbackup((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt	newcommits		tAbortNoCleanupcBseZRS((RR(((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRi(stqueuec
BseZdBd�Zejd��Zejd��Zejd��Zejd��Z	d�Z
idBd�Zd�Zd�Z
d	�Zejd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zed�Zd�Zd�Zed�ZdBdBdBdBid�Zd�ZdBd�Zd�Z d�Z!ee"edBdBdBdBed�Z#ee"edBdBdBdBed�Z$ed�Z%d�Z&d�Z'd�Z(d �Z)dBd!�Z*d"�Z+e"d#�Z,ee"d$�Z-dCZ.d*�Z/ed+�Z0d,�Z1d-�Z2e"d.dBd/�Z3d0�Z4ed1�Z5dBeedBeeeeed2�Z6dBee"eeed3�Z7d4�Z8dBd5�Z9ed6�Z:dBd7�Z;dBd8dBdBed9�Z<d:�Z=ed;�Z>dBdBd<�Z?dBd=�Z@d>�ZAed?�ZBd@�ZCdBdBdBdBedA�ZDRS(Dc	Cs�||_yrttjj|d��}|j�j�}|j�|satjj|d�}ntjj|d|�}Wn&tk
r�tjj|d�}nX|p�||_t	j
|j�|_
||_||_t
|_t
|_g|_d|_d|_d|_d|_t
|_yF|jddd�}|dkrRtj�n|r^d	pad
|_Wn2tjk
r�|jddd�j�|_nX|jddt
�|_dS(
Ns
patches.queuetpatchesspatches-tserieststatustguardsRYtgittyestnotautotplain(tbasepathtopentostpathRStreadR+tclosetIOErrorR
topenerR\tbaseuiRJtapplieddirtytseriesdirtytaddedt
seriespatht
statuspatht
guardspathR)tactiveguardstguardsdirtyR]RtConfigErrortgitmodetconfigRUR9(	RR\R|RwtpatchdirtfhtcurtcurpathR�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR,s<	

										"csq�fd�}y/�jj�j�j�}t||��SWn,tk
rl}|jtjkrfgS�nXdS(Nc3s�x~|D]v}|jdd�}t|�dkrT|\}}tt|�|�Vq|j�r�jjtd�|�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{RxR�t
splitlinestlistRzterrnotENOENT(RR�R te((Rs,/sys/lib/python2.7/site-packages/hgext/mq.pytappliedNs	cCsPy|jj|j�j�SWn,tk
rK}|jtjkrEgS�nXdS(N(R{RxR�R�RzR�R�(RR�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt
fullseriesascCs|j�|jS(N(tparseseriesRl(R((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRljs
cCs|j�|jS(N(R�tseriesguards(R((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�os
cCs^x3dj�D]%}||jkr
t||�q
q
Wt|_t|_t|_d|_dS(Ns&applied fullseries series seriesguards(	R�t__dict__tdelattrRJR}R~R�R)R�(Rta((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt
invalidatets			cCs�tj|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\R�RLtupgradeRoRtAbortRt	patchopts(RtoptstpatchfnR�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�}s
cGs�|j�}|jr�|jdkr�xZ|D]O}|j|d�}x*|D]"}|jd�rKt|_PqKqKW|j�q,Wn|S(s�Return a copy of input diff options with git set to true if
        referenced patch is a git patch and should be preserved as such.
        R�trs
diff --git(tcopyRoR�R{RRLRy(RR�RkR�tpatchfR>((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR��s

	cGstjj|j|�S(N(RvRwRS(Rtp((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRS�scsC�fd�}x-t|j�D]\}}||�r|SqWdS(Ncs&|jdd�d}|j��kS(Nt#ii(R�R#(R!(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt
matchpatch�s(t	enumerateR�R)(RRR�R@R!((Rs,/sys/lib/python2.7/site-packages/hgext/mq.pyt
findseries�s
s'\s?#([-+][^-+# \t\r\n\f][^# \t\r\n\f]*)cCs�g|_g|_x�|jD]�}|jd�}|dkrL|}d}n&|dkr^qn|| }||}|j�}|r||jkr�tjtd�||j|j	�f��n|jj
|�|jj
|jj|��qqWdS(NR�i�R(is%s appears more than once in %s(
RlR�R�tfindR#RR�RRSR�R-tguard_retfindall(RR!thRRR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR��s$			

cCsu|std�Sd}|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
checkguard�s

	
cCs}x5|D]-}|j|�}|rtj|��qqWtt|��}|jjddj|��||_t	|_
dS(Nsactive guards: %s
t (R�RR�tsortedtsetR\tdebugRSR�RLR�(RRnR�tbad((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt	setactive�s
	cCs�|jdkr�|_y|jj|j�j�}Wn1tk
rj}|jtjkra�ng}nXxrt	|�D]a\}}|j
|�}|r�|jjd|j
|j�|d|f�qx|jj|�qxWn|jS(Ns
%s:%d: %s
i(R�R)R{RxR�R�RzR�R�R�R�R\R�RSR-(RRnterrRQR�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytactive�s	
$cCs�x�|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.RR�RR�R�tsubR�RSR�RLR~(RtidxRntgR�tdrop((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt	setguards�s
1
cCs8t|t�r$|jj|�}n|j|}|sAtdfS|j�}g|D],}|ddkrT|d|krT|^qT}|r�tt	|d�fSg|D]}|ddkr�|^q�}g|D]}|d|kr�|^q�}|r.|rtt	|d�fStdj
tt	|��fStdfS(Nit-it+R�R((t
isinstancetstrRlR@R�RLR)R�RJtreprRStmap(RR�tpatchguardsRnR�texactnegtpostexactpos((s,/sys/lib/python2.7/site-packages/hgext/mq.pytpushable�s 

9))cCs<|r|jjp|jj}|s0|jjr8t|t�rT|jj|�}n|j|�\}}|r�r�dkr�|t
d�|j|�q�s�|t
d�|j|�q�t
d�|j||f�n|s8|r|t
d�|j||f�q5|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\twriteR�tverboseR�R�RlR@R�R)R(RR�tall_patchesR�R�twhy((s,/sys/lib/python2.7/site-packages/hgext/mq.pytexplainpushables(cs��fd�}�jr@|tt�j��j�t�_n�jrh|�j�j�t�_n�j	r�|�j
�j�t�_	n�jr��j
���r��dj�fd��jD��ng�_ndS(NcsB�j|d�}x|D]}|jd|�qW|j�dS(Ntws%s
(R{R�Ry(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	<genexpr>2s(R}R�R�R�R�RJR~R�R�R�R�R�RR�R)tadd(RR�((R�Rs,/sys/lib/python2.7/site-packages/hgext/mq.pyt	savedirty s				'cCsp|jd�}tjj|�s%dSytj|�Wn3tk
rk}|jjtd�t	|��nXdS(Ntundoserror removing undo: %s
(
tsjoinRvRwtexiststunlinktOSErrorR\R�RR�(RRcR�tinst((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt
removeundo5scCs�x�t|�D]}|j|�}tjj|�r
|jjtd�||df�|rutj	||d�q�tj
||d�q
q
WdS(Ns#saving current version of %s as %s
s.orig(R�twjoinRvRwtlexistsR\tnoteRRtcopyfiletrename(RRctfilesR�R�tabsf((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRg>sc	
CsT|jd�}	tj||||�}
tj|j|||||
||	|�dS(Ntstat(tgetR
tmatchRtdiffordiffstatR\(RRcR�tnode1tnode2R�R�tchangesR�R�tm((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||�}
|
r�jtd
�|
��nt
|d|	j�|	j�dt�}|dkr=tjtd���nyt|j|�|j�}Wn*tk
r�tjtd
�|��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 %sR�R�(tapplyRJRLR)RR�RR\R�R	tcleanR#R�RhtdescriptionR3RRSR9t	ExceptionR�R{R�R�R�RyR�(RRctmergeqtheadRtrevR�R�R�tctxtrettphR�R2((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)tdirstatetparentsRR�Rt	changelog(RRcR�tp1tp2tx((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
jtd�|�d
S|j
|�\}	}
|	s�j|dt�qon|j|�}|s|j
jtd�|�dS|d}|j||||||�\}
}|rn|jjt||��t|_n|
ro|
|fSqoW|j�d	|fS(Ns.hg.patches.merge.markers[mq]: merge markerR�R�spatch %s does not exist
iR�spatch %s is not applied
i(iN(iN(R�RhR)RLR�R-RR}R
tlookupR\R�RR�R�t	isappliedRR�(RRcR�RlR�tpnameR�R�RR�treasontinfoR�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt
mergepatch�s:	


$
c
Cs�t�}yAtj|j||ddd|dd�}tt|�|fSWnotk
r�}|jjt	|�d�|jj
s�|jjtd��n|jj
�tt|�tfSXdS(sPApply patchfile  to the working directory.
        patchfile: name of patch fileR#iR�teolmodes
s*patch failed, unable to continue (try -v)
N(R�R�RR\R)RLR�R�R�R�R�R�Rt	tracebackRJ(RRct	patchfileR�tfuzzR�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�s	
cCs!d}}}
z�j�}|j�}|jd�}
yO|j|||||||d|d|	d|
�}|
j�|j�|SWnqtk
r�|
j�|j�d|jj	�fSz|
j
�Wd|j�|jj�|j�X�nXWdt|
||�|j
|�XdS(Ntqpusht	all_filesttobackuptkeepchangesi(R)twlocktlockttransactiont_applyRyR�RiRRtabortR�RR�(RRcRlR�R�R�R�R�RRRRRttrR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR��s2






cCs�|s|j}nd}d}x�|D]�}
|j|
�\}}|s_|j|
dt�q%n|jjtd�|
�tjj	||
�}yt
|j	|
�|j�}Wn2tk
r�|jj
td�|
�d}PnX|j}|s�|
}n)|r|jd|
�ndj	|�}|jr�	r�tj|j||�}t|�|	@}|r|
rttd	���n|j||d
t�|	|}	n|j||�\}}}|dk	r�|j|�n|}n.|jj
td�|
�dgd}}}|r�|r�g}g}xF|D]>}tjj|j|��ra|j|�q0|j|�q0Wx|D]}|jj|�qyWx|D]}|jj|�q�W|jj�\}}|j||�ntj ||p��}|d}t!|d||j"|j#d
|dt�}|d|krPt$j%td���n|dkrtt$j%td���n|r�|j&jt'||
��n|r�|jj
td��d}Pn|r%|r%|jj
td��d}Pq%q%W||fS(s�returns (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.
        iR�sapplying %s
sunable to read %s
isimported patch %s
s
imported patch %ss
s"local changes found, refresh firstR�spatch %s is empty
ttipR�R�s(qpush exactly duplicates child changesetsrepository commit faileds*patch failed, rejects left in working dir
is)fuzz found when applying patch, stopping
iN((RwR)R�R�RLR\RmRRvRSRR9RzR�R1R-R8R�tchangedfilesR�RiRgRR�R�R�RtremoveR�Rt
setparentsR
t
matchfilesRhR3R4RR�R�R(RRcRlR�R�R�R�R�RRRR�R�t	patchnameR�RR:RR1ttouchedtpatcherrR�RtremovedtmergedR�RRR�toldtip((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�s�


	
	





!	cs�|s�|j�}|r,|dj|�nxY|D]N}ytj|j|��Wq3tk
r�}|jtjkr��q�q3Xq3Wng}|r�|j	| }|j	|4t
|_ng}xhtg|D]}|j
|�|f^q�dt
�D]2\}	}|	dk	r|j|	=q�j|�q�r�|r�td�|D��}
xu|D]6}td��|jj�t|
|�|f�qQWq�td��tjdj�fd�|D����n|j�t
|_g|D]}|j^q�S(Ntreversecss!|]}|j|jfVqdS(N(RR(R�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pys	<genexpr>Vss*revision %s refers to unknown patches: %s
sunknown patches: %s
R(c3s|]}�|VqdS(N((R�R�(tmsg(s,/sys/lib/python2.7/site-packages/hgext/mq.pys	<genexpr>\s(R�R)tforgetRvR�RSR�R�R�R�RLR}R�R�R�R-tdictRR\R�RRR�R�R~R(RRktnumrevsR�R�R�R�t	qfinishedtunknownRQR�R�((R+s,/sys/lib/python2.7/site-packages/hgext/mq.pyt_cleanup9s@


.

++
	cCs||jdjj�}g}x�|�D]�}}||kratjtd�|��n||}|j|j}|j�|kr�td�}	tj|	|��n|j|j}
xHdD]@}|j�||
kr�td�}	|j	j
|	|
�Pq�q�W|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(R�RR�R�RR�RRR�R\RmR-(RRctrevstfirstrevRkRQR�RtbaseR+Rtfmt((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt_revpatchesbs$

cCs�|j|j|t|��}|j|t|��}|r�|jjddt�r�||d}|jjddt	j
�}|j�|kr�|j�j�|kr�t	j
|||�q�ndS(NRYRZiRs
new-commit(t_phasecacheR6R�R1R.R\R]RJR�RtdraftRdRtadvanceboundary(RRcR2RkR/toldqbasettphase((s,/sys/lib/python2.7/site-packages/hgext/mq.pytfinishzs*c
Cs�|r/|jd�r/tjtd���ng}x�|D]�}|j|dt�}|j|�}|r�tjtd�|��n||jkr�tjtd�|��n||kr<|j|�q<q<Wd}|jd�r�|j	s	tjtd���nt
j||jd��}t|�dkrW|d|dkrW|j
�n|j||�}	||	7}t|	�}n|j|||jd	��dS(
NR�s4qdelete requires at least one revision or patch nameR�scannot delete applied patch %sspatch %s not in series fileisno patches appliediR�(R�RR�RRRLRRlR-R�R
trevrangeR.R*R6R1(
RRcRkR�trealpatchesRRR.R2t
revpatches((s,/sys/lib/python2.7/site-packages/hgext/mq.pytdelete�s.
	&

cCsd|jr`|jdj}|jdj}|jj�|krVtjtd���n||fSdS(s'check that working directory is at qtipi�s&working directory revision is not qtipN(NN(	R�RRRRRR�RR)(RRcttopR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt
checktoppatch�s	
cCs�g}|d}|r#||}n|j�d}xt|j�D]n}|j|�jt�r}tjt	d�|��qC||jks�|j|�j�rC|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)RR�tsubstateR�tdirtyRLRR�RR-(RRctbaserevtinclsubstwctxtbctxR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt
checksubstate�s

$cCszx"|d D]}d|krdSqW|dkrE|djd�n1|dkre|djd�n|djd�dS(Nis.hgsubstatesa?iR�ii(R-(Rt
substatestateR�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytputsubstate2changes�scCs7|rtjtd���ntjtd���dS(Ns"local changes found, refresh firstslocal changes found(RR�R(Rtrefresh((s,/sys/lib/python2.7/site-packages/hgext/mq.pytlocalchangesfound�scCs[|j�d \}}}}|s4|s4|s4|rK|rK|j|�n||||fS(Ni(RmRM(RRcR�RLR�R�R�td((s,/sys/lib/python2.7/site-packages/hgext/mq.pytchecklocalchanges�sRlRmRnt.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"R�Rs*"%s" cannot be used in the name of a patch(s.hgs.mq(R�R(t	_reservedRR�RR(RRRPR�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytcheckreservedname�s


cCs�|j|�|r�tjj|j|��r�tjj|j|��rftjtd�|��q�tjtd�|��ndS(Ns""%s" already exists as a directoryspatch "%s" already exists(	RRRvRwR�RStisdirRR�R(RRR�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytcheckpatchname�s
"
cCs(|r$|r$tjtd���ndS(Ns*cannot use both --force and --keep-changes(RR�R(RRR�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytcheckkeepchanges�scOsL|jd�}|jd�}|jd�}|rEtj|�}n|ji|jd�d6�}|jdt�r�|j|�n|j|�}	|	r�|	jd�|jd}
n|jd�s�|jd�s�|rQ|	r�|p��|	}nt
j|d!||�}d	�}||_
|jd
|�}
|
d \}}}}n'|j|dt�}
|
\}}}}t
j|||||	�}t|d!j��d
kr�tjtd���n|||}|j|�|j�}|j�}z=y|j|d�}Wn5tk
rM}tjtd�||jf��nXyy|jr�|r�|jd|d�|s�|jd�q�n|r|jd|�qnp|jd�|jdt|d!j�j��d�|r|jd|d�n|r|jd|�ntj |d�r9|�}n|rE|pLd|}t!|d!|||d
|dt�}|d!kr�tjtd���ny|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.|g�nWn|j/��nXWnbt0k
r+|j1|�}yt2j3|�Wn+t4k
r$|j5j6td �|�nX�nX|j7|�Wd!t8|�Xd!S("sWoptions:
           msg: a string or a no-argument function returning a string
        R+R3R4Rot	checknames.hgsubstatetincludetexcludecSs,|dkr(tjd||f��ndS(Ns.hgsubstates%s: %s(RR�(R�R+((s,/sys/lib/python2.7/site-packages/hgext/mq.pytbadfnsR�iR�iscannot manage merge changesetsR�scannot 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

R�R�R�R�serror unlinking %s
N(9R�Rt	parsedateR�RLRTRIR-RR�R
R�R)R�RmROR#R.RR�RRBt
fullseriesendRR{RztstrerrorR9R�RRRtsafehasattrRhR�R�RR�R~R}R
RKR�tdiffRyR�R�trollbackR�RSRvR�R�R\R�R�R(RRcR�tpatsR�R+R3R4R�RFRJR�RYR�R�R�R�RNtcommitfilesR0RR�R�t	commitmsgR�R5tchunkstchunkt	patchpath((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRN�s�
$		
	
%	
		





tallc	Cs�d}}z�|j�}|j�}|rz|j|d|dt�|j||d�}tj||�|jj	�nt
j|j|||�Wdt
||�XdS(NR�RLi(R)RRRORJR
R	R�RR�R
R#R\R(	RRcR2R�RgR�RRturev((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR#Xs
cCsFx?t|j�D].\}}|j|kr||j|jfSqWdS(sreturns (index, rev, patch)N(R�R�RRR)(RRRQR�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRhsc
s)�fd�}|�jkr"|Stjj�j|��syt|�}Wnttfk
rfn;Xt�j�|ko�t�j�knr��j|S|s||�}|r�|S|j	d�}|dkr]||| �}|r]�jj
|�}yt||dpd�}Wnttfk
r7qZX||dkrZ�j||Sq]n|j	d�}	|	dkr	|||	 �}|r�jj
|�}yt||	dp�d�}Wnttfk
r�qX||t�j�kr�j||Sqq	qntjt
d�|��dS(Ncs�|�jkr|Sg�jD]}||kr|^q}t|�dkr��jjtd�|�x"|D]}�jjd|�qnWdS|r�|dS�jr�jr�dkr��j�jt�dS|dkr�jdSndS(Nispatch name "%s" is ambiguous:
s  %s
itqtiptqbase(	RlR.R\R�RR)R�t	seriesendRL(RR	tmatchesR�(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pytpartialnamevs (
R�iiR�spatch %s not in series(RlRvRwtisfileRStintRAt
OverflowErrorR.trfindR@RR�R(
RRR�RmtsnoROtminusRQtofftplus((Rs,/sys/lib/python2.7/site-packages/hgext/mq.pyRusJ/c(Cs�|j|
|�|j�}|j�}z�g}
x*|j�j�D]\}}|
|7}
qDW|
sptg}
n|jj�|
kr�|r�|jj	t
d��n|js�|jjt
d��dS|r�|j
|�}|j|�}|r-|dt|j�dkr-|jjt
d�|�dS|j|�\}}|r�|jj|�|j�kr�tjt
d�|��q�q|r�t
d�|}nt
d�}|jjt
d	�||f�dSn?|r|jd
}|j|�r|jjt
d��dSn|j�}|t|j�krK|jjt
d��dS|rr|
rr|j|d
|j�n|rL|
r�tjt
d���n|r�tjt
d���n|jr�tjt
d���n|j|}t|j|�|j�j}|s"tjt
d�|��n|||dksLtj||�qLn|rf|sptjt
d���nxGt|j�D]6\}}|jj |d�d|j|kr�Pq�q�WxDt|j|�D]/\}}|jj |d�d|kr�Pq�q�W||}|t|j�ks&t!�|j|}|j|=|jj"||�|j#�t$|_%nt$|_&|dkr�|j'|�n|s�|j|}|d}n|jj||�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+||$d�x<|"D]4}%|%|jkr�j-|j.|%�dt$�q��|jjt
d���nX|jsG|#dS|jd
j/}&|#dr�|#ddkr�t
d�}'|jj0|'|&�n|jj0t
d�|&�|#dSWd|j1�XdS(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
i�s"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 moveR�RRRs cleaning up working directory...t
ignoremissingsdone
s/errors during apply, please fix and refresh %s
snow at: %s
(2RUR�Rt	branchmapt	iteritemsRRRR\RmRRlR�RRR.R�R�R@RkRR�RORRSR9R5R	R�R�R�R�R�tAssertionErrorR0R�RLR~R}RBR�RR�trevertR)t
unlinkpathR�RR�R((RRcRR�R�R�RgtmovetexacttnobackupRR�RtheadstbtlsRR�Rtstarttrootttargett	fullstarttrpnRQR@t	fullpatchtendRR�R�R�RNRRRRR�RAR+((s,/sys/lib/python2.7/site-packages/hgext/mq.pytpush�s�	#	 
	
& 



	

	!	
#	c	CsT|j||�|j�}z&|r�|j|�}	|	sL|j|�}n|j|�}	|	s�tjtd�|��q�n|js�|jj	td��|S|r�d}
n*|r�|	dd}
nt
|j�d}
|
t
|j�kr|jj	td�|�dS|s�|jj�}g|jD]}|j
^q/}
x�|D]1}||
krK|jj	td��t}qKqKWnfg|dj�D]}|j
�^q�}t}x.|j|
D]}|j
|kr�t}Pq�q�W|}t�}|rg|j|d|p
|�\}}}}|rB|sd|j||�qdqg|rg|j||||�qgnt|_t
|j�}|j|
j
}y|jj|�}Wn9tjk
r�t|�}tjtd�|��nX||jd	j
gkrtjtd
���n||jd	j
j�sPtjtd�dtd
���n|r�|j||�}||}|j|d�d \}}}}|r�tjtd���nt|||�|@}|r�r�j�n|j||�x:|D]2}tj|j |�dt�|jj!|�q�K||D]?}||}|j"||j#�|j$��|jj%|�q;W|j&|t'�nx;t(|j|
|!�D]#}|jjtd�|j)�q�W|j|
|5|j*||gdtdd�|jr+|jj+td�|jd	j)�n|jj+td��Wd|j,�XdS(Nspatch %s is not appliedsno patches applied
iisqpop: %s is already at the top
sqpop: forcing dirstate update
R�strying to pop unknown node %si�s?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 revsRvspopping %s
R�RgR#snow at: %s
spatch queue now empty
(-RURRRRR�RR�R\R�R.RRRRLR)RJR�ROR�R}RRRtLookupErrorRtmutableR
RmRMRgR{R�R�twwritetdatatflagstnormalR"RtreversedRR#R�R(RRcRR�R�RgR~RRRR�RR	trrR�t
needupdateR�RR�R�R�RNR�R�RRtqpRR�tfctx((s,/sys/lib/python2.7/site-packages/hgext/mq.pytpopFs�		
)	!	
"


!
	'c
	Cs�|j|�\}}|s5|jjtd��dS|j||�}|jd�rfd|}}n
|d}}|j||�}	|j||	||d|d|�dS(Nsno patches applied
R*R�R�(	RBR\R�RR
R�R)R�R�(
RRcRaR�RARR�R�R�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR_�s
c8Ks�|js#|jjtd��dS|jdd�j�}|jd�}|jd�}|rudtj|�}n|j�}z	|j	|�|jdj
|jdj}}	|jj
|�|gkr�jtd	���n||j�stjtd
�dtd���n|jj|�}
|j||�}|j|t|��}|rx|jd
�|jd
}
nt|j|	�|j�}|ji|jd�d6|	�}|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||�}|jd�r�j'|||||j(��}t$j%|dd|�}nt$j)|�}|j!d|�d \}}}}t*|�}t*|�}t*|�}x*|D]"}||krV|j+|�qVqVWxD|D]<}||kr�|j,|�|j+|�q�|j+|�q�Wg}xX||D]L}||kr|j,|�|j|�q�n
|j-|�|j+|�q�Wt.|�}t.|�}t.|�}|j!|d|�d \} }!}"}#t*| |!|"|#�}$g|||fD]}|j/|$�^q�}%t*|�}&x|%D]}|&j0|�q�Wt$j'||&�}||j1�}'y5|j2s|j3rdi}(xg|D]_})|jj4|)�}*|*dk	rm|*|jkrm|(j5|*g�j|)�n|jj+|)�qWx�|D]�})|j6|)�}+|+j7||)�}*|*r|(j5|*dg�j8|(j|)g��|)|kr|(|*dj|)�qn|)|(kr�|(|)=q�q�Wx�|(j9�D]0\}*},x!|,D]})|jj:|*|)�q@Wq-WnTx|D]})|jj+|)�qkWx0t.|jj;��D]}+|jj:d|+�q�Wx|D]}+|jj,|+�q�Wg}xOt<t=|�ddd�D]1}-|||-�s�j||-�||-=q�Wx|D]}+|jj>|+�q8Wx|D]}+|jj?|+�qYWx|D]}+|jj@|+�qzW|s�|jAs�d|	}.q�dj|jA�}.n|}.|jBp�|d}/||jC�}0|jD|
�|jjE�t|_F|jG||gdtHdd�Wn|jjI��nXy�||0|.|/|jKd|dt�}1g|%D]}t.|�^q|}2|r�|jL|
|2�ntMjN||d|2d|�}3x|3D]}4|j|4�q�W|jO�|jP}5x|'D]}6|1|5|6<q	W|5j�|jjtQ|1|	��WnW||
d}7|jjR|7j
�|7j#��|jS�|jjTtd���nXWd|jU�|jV|�XdS(Nsno patches applied
iR+R(R3R4s%d %di�s'cannot refresh a revision with childrens!cannot refresh immutable revisionR�s see "hg help phases" for detailss.hgsubstateRoR�t
atomictempiiRR�R�is	[mq]: %s
s
R�RgR#R�R�sMrefresh interrupted while patch was popped! (revert --all, qpush to recover)
(WR�R\R�RR�R+RR[RRBRRRRR�R�RR
RIRR-RRRSR9R�RIRERFRGR{RLR�RmRxtmanifestR
R�R)R#R�tmatchallR�R�R!tdiscardR�tintersectionR�t	bookmarksRoR�tcopiedt
setdefaultR*trenamedtextendRxR�tcopiesRKR.R�tnormallookupR�R1R3RdR"R�R}R#RJR�RhR4RKR�R_Ryt
_bookmarksRtrebuildR�R�RR�(8RRcRaR�R+tnewusertnewdateRRAR�tcparentstpatchparentRFRJRR�R�R2tmmtaatddR�tmantaaatmatchfnR�R�R�R�RNR	R,tcmtcatcrtcdt
allmatchestrefreshchangesR�tbmlistR�tdsttsrcR�tdstsRQR1R3toldphaseR�R�RdRetmarkstbmR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRL�s2	
!
"	$"





%+





#


	


	


	



cCs�|r4tjj|j�r4tjtd���nytj|j�Wn2tk
r|}|jtj	kss|r}�q}nX|r�|j
dt�SdS(Ns$patch queue directory already existstcreate(RvRwRSRR�RtmkdirR�R�tEEXISTR�RL(RRcR�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytinit�s
cCs�|r1||jkr1tjtd�|��n|sF|j�}n|jj|�d}g}xet|t|j��D]K}|j|�\}}|r�|j	||j|f�n|j
|�q{W|S(Nspatch %s is not in series filei(RlRR�RRkR@RKR.R�R-R�(RRcRR�t	unappliedRQR�R((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR��sicsH��fd�}tg�jD]}|j^q�}	|dkrYt�j�|}n|sO�jjr�tt||d��}
nx�t	|||�D]�}�j|}||	kr�d\}
}n.�j
|�dr�\}
}nd\}
}d
}�jjr d|
||
f}n|r8||
kr8q�n||||�q�Wn�}x�tj�j
�D]�\}}}|t�j
�d}xp|D]h}tj
j||�}|�jkr�|�j�j�jfkr�|jd�r�|j|�q�q�WqhWx<t|�D].}�jjr*d
p-d
}|||d�qWdS(Ncs+|r�jj|�n�r��j|��j�}|jrP|jdpSd}�jj�r��jj�t|�t|�d}|dkr�t	j
||�}q�d}n�jj|dd|��jjd��jj|dd|�n�jj|dd|��jjd�dS(	NiR(itlabelsqseries.s: sqseries.message.s
(R\R�RRSR9R1t	formattedt	termwidthR.Rtellipsis(tpfxR$tstateRR+twidth(RR(s,/sys/lib/python2.7/site-packages/hgext/mq.pytdisplayname�s'	itAR�itUR�tGtguardedR(s%*d %s RPsD tmissing(R�sapplied(R�s	unapplied(R�sguarded(R�R�RR)R.RlR\R�R�RKR�RvtwalkRwRSR�R�R�RR-R�(RRcR�R�tlengthRmRR�R�R�tidxwidthRQRtcharR�R�t	msng_listR�tdirsR�RNR�tflR	((RRs,/sys/lib/python2.7/site-packages/hgext/mq.pytqseries�sB%
"
cCs|jdkrtSdS(Ns.hg.patches.save.line(RRL(RR!((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt
issaveline�scCsP|jj�}|s0tjj|jd��rLtj|d|jd|�SdS(Ns.hgRwR�(R|R�RvRwRSRSR	t
repository(RR�R\((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR��s!cCs�||j�j�}|j�}d}d}g}	g}
d}x�|�D]�\}}|dkrr|d}qM|jd�r�|j�}
|
djd�}
g|
D]}t|�^q�}qM|dk	rM|j�}
|
jdd�\}}|r|
j	t
t|�|��q'|	j	|
�qMqMW|dkrQ|jjt
d��dS|jjt
d	�|d�|	|_|
|_|j�t|_t|_|jj�}|rC||kr�|jjt
d
��qC|jjt
d�t|��|jj�}||krt}nt}|j||gd|d
d�n|r�|jjt
d�t|d�t|d�f�|r�|jjt
d��|j�}|s�|jjt
d��dStj||d�q�ndS(NisPatch Data:is	Dirstate:i
R�Rsno saved patch data found
srestoring status: %s
s*save entry has children, leaving it alone
sremoving save entry %s
R�RgR#s&saved queue repository parents: %s %s
supdating queue directory
s unable to load queue repository
(R�R#R�R)R�RR+R�RR-RR\R�RR�R�R�RLR~R}RRRRRRJRmR�R	R�(RRcR�R@tqupdatetdescR RQt	datastartRlR�tqppR>R!R	R�RRtppR�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytrestore�sb
"		
		 	""cCsy|js#|jjtd��dS|j|jd�rS|jjtd��dS|shtd�}nd|jd�}|j�}|r�|jj�}|dt	|d	�t	|d�f7}n|d
7}|dj
d�|jD��7}|dj
d
�|jD��7}|j|dt
�}|sF|jjtd��dS|jjt|d��t
|_|j|�dS(Ns"save: no patches applied, exiting
ii�sstatus is already saved
shg patches saved stateshg patches: s
s
Dirstate: %s %sis

Patch Data:
R(css|]}d|VqdS(s%s
N((R�R	((s,/sys/lib/python2.7/site-packages/hgext/mq.pys	<genexpr>=scss|]}d|VqdS(s:%s
N((R�R	((s,/sys/lib/python2.7/site-packages/hgext/mq.pys	<genexpr>>sR�srepo commit failed
s.hg.patches.save.line(R�R\R�RR�R+R�RRRRSR�RaRLR-RR}R�(RRcR+R�R�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytsave,s.	+
  	cCsM|jrI|jdj}|j|�}|dkrAt|j�S|dSdS(Ni�ii(R�RR�R)R.R�(RR�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR\Gs	
cstd}��fd�}�jrj�jdj}y�jj|�}Wntk
r[dSX||d�S||�S(s�If 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|t�j�kr|SxLt|t�j��D]2}�j|�\}}|r]|S�j|�q8Wt�j�S(N(R.RlRKR�R�(R�RQR�R(R�R(s,/sys/lib/python2.7/site-packages/hgext/mq.pytnextVsi�i(R�RRlR@RA(RR�R�R�R�((R�Rs,/sys/lib/python2.7/site-packages/hgext/mq.pyRkPs		
cCsI|j|j}|jjs%|}n t|jj|��d|}|S(NR�(R�RR\R�R�RlR@(RR@R
R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytappliednamehs
	 cs��fd�}|rX|r3tjtd���ntj||�}|jdt�n|svtjtd���nt|�dks�t|�dkr�|r�tjtd���ng}	|r9|jj	|jj
|d��}
t|
�dkrtjtd�|d��n�jr�jj
|d	�}|g�jD]}|j
^qDkr|tjtd
�|d	��n|
�jdj
gkr�tjtd�|d	��n|jj�jd	j
�}|jj
|�d	}
nE|
|jj
|d	�gkr)tjtd�|d	��nd}
�ji|d
6�}x�|D]�}||j�s�tjtd�|dtd���n|jj
|�\}}|jj
|�}|tkr�tjtd�|��n|
r|
|krtjtd�||
f��n|}
|s/td|�}n||��j||��jjd	|��j|d�}tj||gd|d|�|j�t||�}�jjd	|��jj|�|	j|�d}qLW|r|jjddt�rt j!|t j"|g�n�j#�t�_$t�_%nx�t&|�D]�\}}|r-|dkr|tjtd���nt|�}�j'|��j(|�}t)j*j+|�s�tjtd�|��n|r$�j||��jj,td�||f�tj-|�j(|��q>|}n|dkrX|rXtjtd���n*|s�tt)j*j.|j/d���}n�j||�yP|dkr��jj0j1�}n+t2j3�j|�}|j1�}|j�Wn0t4t5fk
rtjtd�|��nX�j|d�}|j,|�|j�|sQ||�n|�j6kr��j7�|}|g�j||+n�j#�t�_%�jj8td �|��jj|�|	j|�d}qFW�j9|�|	S(!Ncs/|�jkr+tjtd�|��ndS(Ns&patch %s is already in the series file(RlRR�R(R$(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pytcheckseriesrss*option "-r" not valid when importing filesR*sno files or revisions specifiedis5option "-n" not valid when importing multiple patchesi�s/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 mutableR�s see "hg help phases" for detailsscannot import merge revision %ds#revision %d is not the parent of %ds%d.diffR�R�R�RYRZR�s%-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
(:RR�RR
R=tsortRLR.RRRR�R�t
parentrevsR)R�R�RtnormnameRTR�R0R{RtexportRyRRR-R\R]RJRtretractboundaryRZR�R}R~R�RRRSRvRwRnR�R�tbasenameR+tfinRxR	topenpathR�RzRlR\R�R�(RRcR�R$R�texistingR�RoR�timportedRR4R�t
lastparentR�R�RRR�tseRQtfilenamet
originpathttextR�R@((Rs,/sys/lib/python2.7/site-packages/hgext/mq.pytqimportps�*"	%





	
	$



	


N(sseriessstatussguardsRPs..(ERRR)RRt
propertycacheR�R�RlR�R�R�R�RSR�tretcompileR�R�R�R�R�R�R�RJR�R�R�RgR�RR
RRRLR�RR1R6R<R@RBRIRKRMRORQRRRTRURNR#RRR�R�R_RLR�R�R�R�R�R�R�R\RkR�R�(((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRj+s�"										
							'
	'	])		
		
		
			f	
=�k	
�7	6				cCsO|jdd�s1|jd�s1|jd�r5|St|�}t|d<|S(NRYRR�R}tkeep_changes(R]R�R-RL(R\R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytfixkeepchangesopts�s"
sqdelete|qremove|qrmtkR�skeep patch fileR�R�s%stop managing a revision (DEPRECATED)tREVshg qdelete [-k] [PATCH]...cOs*|j}|j|||�|j�dS(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\RcRkR�tq((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�}|jd�r�|r�|j	td��dS|jd�r�|dkr�|j	td��dS|jd�r�d}d}nd}|j
|d|d	|d
dd|jd��d
S(s<print the patches already applied

    Returns 0 on success.spatch %s is not in series fileiR�sno patches applied
sonly one patch applied
iiR�R�RmR�RN(RYRlRR�RR@RkRLR�R�R�(R\RcRR�R�R�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�s$		
	t
qunappliedR�sshow only the first patchshg qunapplied [-1] [-s] [PATCH]cKs�|j}|rS||jkr:tjtd�|��n|jj|�d}n|jt�}|t|j�kr�|j	d�r�|j
td��dS|j	d�r�dp�d
}|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 fileiR�sall patches applied
R�R�RmR�RN(
RYRlRR�RR@RkRLR.R�R�R)R�(R\RcRR�R�R�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�1s	$R�R�R�simport file in patch directoryR�RR(sname of patch filetNAMER�R�soverwrite existing filess)place existing revisions under mq controlR�Rosuse git extended diff formattPR�sqpush after importings>hg qimport [-e] [-n NAME] [-f] [-g] [-P] [-r REV]... [FILE]...cOs�|j�}z||j}za|j||d|jd�d|jd�d|jd�d|jd�d|jd��}Wd|j�XWd|j�X|r�|jd�r�|jd�r�|j||d	�Sd
S(s�import 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$RR�R�R�RoNR�i�i(RRYR�R�R�RR�(R\RcR�R�RR�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�Is+	%%cCs|j}|j||�}|j�|rtjj|jd��s�|jdd�}|jd�|jd�|jd�|jd�|jd�|j	�ntjj|jd��s�|jdd�j	�n|d
jddg�t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	.hgignoreR�s^\.hg
s^\.mq
s
syntax: glob
sstatus
sguards
RliN(
RYR�R�RvRwR�R�twopenerR�RyR)R�R(R\RcR�R�R�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytqinit�s"	






s^qinitR�screate-reposcreate queue repositorys
hg qinit [-c]cKst||d|jd��S(s�init 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.R�tcreate_repo(RR�(R\RcR�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR��stqclonetpulls"use pull protocol to copy metadataR�tnoupdates)do not update the new working directoriestuncompresseds)use uncompressed transfer (fast over LAN)R�Rks#location of source patch repositorytREPOs#hg qclone [OPTION]... SOURCE [DEST]cKs)d�}|dkr'tj|�}ntj|||j|��}|jd�ro|j|jd��}n||�}ytj|||�Wn)tjk
r�tj	t
d���nXd\}}|j�r|j�}	|	jj
r�|	|j�tjkr�|	jj
dj}tj|�s|t|	j��}
t|
j|	j|���}|j|	jj|�d�q|q�n<|jd�r�y|jd�}Wq�tjk
r�q�Xn|jt
d��tj|||j�|d|jd�d	|d
td|jd��\}}|jt
d
��tj|||jd�pS||�||�d|jd�d
|jd�d|jd��|j�r%|j�}	|r�jt
d��|	jj |	|gd
tdd�n|jd�s%|jt
d��tj!|	|	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 <src>/.hg/patches by
    default. Use -p <url> 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�}|jd�r(|d }n|dS(s+compute a patch repo url from a repo objectR�i�s/.hg/patches(turltendswith(RcR	((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR��s
Rks4versioned patch repository not found (see init --mq)iRRjscloning main repository
RR�R�tstreamRscloning patch repository
Rs6stripping applied patches from destination repository
Rgs updating destination repository
N(NN(#R)R	tdefaultdesttpeert
expandpathR�Rt	RepoErrorRR�RtlocalRYR�RdRRZRtislocalR�RR�t
differenceR-RRtcapableRR�tcloneR	RJR#R�R(R\tsourcetdestR�R�tsrtpatchespathRjtdestrevRcRtdr((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�sV	%&0%sqcommit|qcis
^commit|ciis hg qcommit [OPTION]... [FILE]...cOsJ|j}|j�}|s-tjd��ntj|j|||�dS(sscommit changes in the queue repository (DEPRECATED)

    This command is deprecated; use :hg:`commit --mq` instead.sno queue repositoryN(RYR�RR�RRaR\(R\RcRaR�R�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRa	s
	R�R�R�sprint patches not in seriesshg qseries [-ms]cKs2|jj|d|jd�d|jd��dS(s7print the entire series file

    Returns 0 on success.R�Ri(RYR�R�(R\RcR�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRl	stqtopshg qtop [-s]c
Ks}|j}|jr!|jt�p$d}|rb|j|d|dddddd|jd��n|jtd��dSd	S(
s>print the name of the current patch

    Returns 0 on success.iR�iR�RmR�Rsno patches applied
N(RYR�RkRLR�R�R�R(R\RcR�R�tt((s,/sys/lib/python2.7/site-packages/hgext/mq.pyRA	s	"tqnexts
hg qnext [-s]c	Ksm|j}|j�}|t|j�krA|jtd��dS|j|d|ddd|jd��dS(sDprint the name of the next pushable patch

    Returns 0 on success.sall patches applied
iR�R�RN(RYRkR.RlR�RR�R�(R\RcR�R�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�,	s	tqprevs
hg qprev [-s]cKs�|j}t|j�}|dkr;|jtd��dS|sX|jtd��dS|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
i�R�R�RmR�RN(
RYR.R�R�RRlR@RR�R�(R\RcR�R�R!R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytprev8	s	cCsl|jd�r2|jd�r2|j�|d<n|jd�rh|jd�rhdtj�|d<ndS(NR3tcurrentuserR4tcurrentdates%d %d(R�tusernameRtmakedate(R\R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytsetupheaderoptsI	ss^qnewteditsedit commit messages'import uncommitted changes (DEPRECATED)R s#add "From: <current user>" to patchtuR3sadd "From: <USER>" to patchtUSERtDR!s#add "Date: <current date>" to patchRNR4sadd "Date: <DATE>" to patchtDATEs0hg qnew [-e] [-m TEXT] [-l FILE] PATCH [FILE]...cs�tj�������fd�}|j}��d<�jd�rV|�d<n
��d<t���|j|||��|j�dS(screate a new patch

    qnew creates a new patch on top of the currently-applied patch (if
    any). The patch will be initialized with any outstanding changes
    in the working directory. You may also use -I/--include,
    -X/--exclude, and/or a list of files after the patch name to add
    only changes to matching files to the new patch, leaving the rest
    as uncommitted modifications.

    -u/--user and -d/--date can be used to set the (given) user and
    date, respectively. -U/--currentuser and -D/--currentdate set user
    to current user and date to current date.

    -e/--edit, -m/--message or -l/--logfile set the patch header as
    well as the commit message. If none is specified, the header is
    empty and the commit message is '[mq]: PATCH'.

    Use the -g/--git option to keep the patch in the git extended diff
    format. Read the diffs help topic for more information on why this
    is important for preserving permission changes and copy/rename
    information.

    Returns 0 on successful creation of a new patch.
    cs%�j��jd�p!�j��S(NR3(R%R�R"((R+R�R\(s,/sys/lib/python2.7/site-packages/hgext/mq.pytgetmsgu	sR+R%i(Rt
logmessageRYR�R$RNR�(R\RcRReR�R*R�((R+R�R\s,/sys/lib/python2.7/site-packages/hgext/mq.pyRNO	s%	




s	^qrefreshRs;refresh only files already in the patch and specified filess2add/update author field in patch with current users0add/update author field in patch with given users0add/update date field in patch with current dates.add/update date field in patch with given dates=hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...c
Os(|j}tj||�}|jd�r�|jsJ|jtd��dS|rhtjtd���n|jdj	}t
|j|�|j�}|j
dj|j�|jp�|j��}|j|�nt||�|j�}z-|j||d||�}	|j�|	SWd|j�XdS(	s>update 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"i�s
R+N(RYRR+R�R�R�RRR�RRRSR9R%R1R3R"tsavecommitmessageR$RRLR�R(
R\RcRaR�R�R1RRRR((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'tjtd���n|j|�dsRtjtd���n|j|�tj||�}|jd�r�|r�tjtd���q�n|j	d�}g}g}x�|D]}	|j	|	�}
|
|ks�|kr
|j
td�|
�n|j|
�r5tjtd�|
��n|j|
�q�Wx�|D]�}
|s�t
|j|
�|j�}|jr�|j|j�q�n|j|
�}|j||�\}
}}|
sMtjtd	�|
��qMqMW|sTt
|j|�|j�}|j|j}}x(|D] }|jd
�|j|�qWdj|�}n|jd�r�|j||p{|j��}n|j|j�|�}|j�}z=|j|d|d
|j�|j|||�|j�Wd|j�XdS(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(RYRR�RRBRORR+R�RR�RR-RRSR9R1RR3R�R%R"R�R�RRLRoR@R�R(R\RcR�R�R�R1R5RktmessagesR�R�RR:tpatchsuccessRR3R+R�R((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	Ks�t||�}|j}|j|�}|jd�}|jd�}|j|�r�|j||d|jd�d|d|�}n-|j||d|jd�d|d|�}|j�|S(sSpush or pop patches until named patch is at top of stack

    Returns 0 on success.t	no_backupR�R�R~R(R�RYRR�RR�R�R�(R\RcRR�R�R~RR((s,/sys/lib/python2.7/site-packages/hgext/mq.pytgoto
s
	$$	
tqguardR!R�slist all patches and guardstnonesdrop all guardss8hg qguard [-l] [-n] [PATCH] [-- [+GUARD]... [-GUARD]...]cs����fd�}|j�td��jD���d}t|�}|jd�r�|sm|jd�r�tjtd���nx't	t
�j��D]}||�q�WdS|s�|ddd!d	kr�js�jtd
���n�jdj}n|dkr:|ddd!d	kr:|j
d�}n|dkr^tjtd���n|ss|jd�r��j|�}|dkr�tjtd
�|��n�j||��j�n|�jj�j|���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.
    cs9�j|pdg}�j|�kr2d}n"�j|�drNd}nd}d||f}�jd�j�j||��x�t|�D]�\}}|jd�r��j|d	d
�n8|jd�r�j|d	d�n�j|d	d
�|t|�dkr��jd�q�q�W�jd�dS(Nt	unguardedR�iR�R�s!qguard.patch qguard.%s qseries.%ss%s: R�R�sqguard.positiveR�sqguard.negativesqguard.unguardediR�s
(R�RlR�R�R�R�RR.(R�RnR�R�RQR�(R�R�R\(s,/sys/lib/python2.7/site-packages/hgext/mq.pyRmK
s"		$css|]}|jVqdS(N(R(R�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pys	<genexpr>a
sR�R5s.cannot mix -l/--list with options or argumentsNiis-+sno patches appliedi�sno patch to work withsno patch named %s(RYR�R�R)R�R�RR�RRKR.RlRR�R�R�R�R@R(R\RcReR�RmRRQR�((R�R�R\s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�2
s4		#
tqheadershg qheader [PATCH]cCs�|j}|r!|j|�}n/|jsA|jtd��dS|jd�}t|j|�|j�}|jdj|j�d�dS(sMprint the header of the topmost or specified patch

    Returns 0 on success.sno patches applied
iRis
N(	RYRR�R�RRRSR9R1(R\RcRR�R((s,/sys/lib/python2.7/site-packages/hgext/mq.pytheader|
s		c
Cs�tjj|�\}}tj|�}tjd|�}d}d}xb|D]Z}|j|�}|rMt|j	d��}	|dks�|	|kr�|	}|}q�qMqMW|r�tjj
||�|fSdS(Ns%s.([0-9]+)i(NN(RvRwR�tlistdirR�R�R)R�RotgroupRS(
Rwt	directoryR4tnamestnameretmaxindextmaxnameR�R�R@((s,/sys/lib/python2.7/site-packages/hgext/mq.pytlastsavename�s
cCs=t|�\}}|dkr'd}n|d|d}|S(Nis.%di(R@R)(RwR�R@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 textR�Rgsapply all patchesR�s%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||�}|jd�r�|jd�rW|j|jd��}nt|j�\}}|s�|jtd��dSt	||j
|j|�}|jtd�|j�n|j||d|jd�d|jd�d|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.
    R�Rs%no saved queues found, please use -n
ismerging with queue at: %s
R�R�R�RgR|R}R~R2RR�N(RYR)R�R�RSR@RwR�RRjR|R�(	R\RcRR�R�R�RARQR((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]cKs�t||�}t}|jd�rtt||j|j|j|jd���}|jtd�|j�t	}n	|j
}|j||d|jd�d|d|jd�d|jd�d|jd	��}|j�|S(
s�pop 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
R�R�RgR~R2RR�(
R�RLR�RjR|RwRSR�RRJRYR�R�(R\RcRR�tlocalupdateR�R((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR��s-		$
sqrename|qmvshg qrename PATCH1 [PATCH2]cKs�|j}|s|}d}n|r6|j|�}n/|jsV|jtd��dS|jd�}|j|�}tjj	|�r�t
tjj|tjj|���}|j|�}n|j|�|j
td�||f�|j|�}|jj|j|�}|djg|D]}	d|	^q!�|j|<|j�t|_|j|�}
|
r�t|
d|�|j|
d<nt|_tjj|�}tjj	|�s�tj|�ntj|j|�|�|j�}|r�||jkr�|d}
|j�}zZ|j|d	krQ|jj|�|jj |�n |
j!||�|
j"|g�Wd|j#�Xn|j$�dS(
s�rename a patch

    With one argument, renames the current patch to PATCH1.
    With two arguments, renames PATCH1 to PATCH2.

    Returns 0 on success.sno patches applied
NRisrenaming %s to %s
R(s #iiR�(%RYR)RR�R�RRSRvRwRSR�R�RTR�R�R�R�R�R�RLR~RRR}tdirnametmakedirsRR�R�RRR�R�R�R,RR�(R\RcRRR�R�tabsdestRQRnR�RtdestdirR�RGR((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR��sR			'
1
	!	
tqrestoreR@sdelete save entryR�supdate queue working directoryshg qrestore [-d] [-u] REVcKsT|j|�}|j}|j||d|jd�d|jd��|j�dS(ssrestore the queue state saved by a revision (DEPRECATED)

    This command is deprecated, use :hg:`rebase` instead.R@R�R�i(RRYR�R�R�(R\RcR�R�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�2s	
tqsaveR�scopy patch directoryscopy directory nametemptysclear queue status files
force copys5hg qsave [-m TEXT] [-l FILE] [-c] [-n NAME] [-e] [-f]cKsi|j}tj||�}|j|d|�}|r:|S|j�|jd�r9|j}|jd�r�jj|j	|jd��}tjj
|�r	tjj|�s�tj
td�|��n|jd�s�j
td�|��q�nt|�}|jtd�||f�tj||�n|jd�re|j2t|_|j�nd	S(
s`save current queue state (DEPRECATED)

    This command is deprecated, use :hg:`rebase` instead.R+R�Rs,destination %s exists and is not a directoryR�s&destination %s exists, use -f to forcescopy %s to %s
RJi(RYRR+R�R�R�RwRvRSRtR�RSRR�RRBR�t	copyfilesR�RLR}(R\RcR�R�R1RRwRA((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�As2	
	!
	
R#sNstrip specified revision (optional, can specify revisions without this option)sDforce removal of changesets, discard uncommitted changes (no backup)R�Rgspbundle only changesets with local revision number greater than REV which are not descendants of REV (DEPRECATED)s
no backupsR~sno backups (DEPRECATED)signored  (DEPRECATED)s'do not modify working copy during striptBtbookmarks.remove revs only reachable from given bookmarks1hg strip [-k] [-f] [-n] [-B bookmark] [-r] REV...csgd}|jd�rd}n'|jd�s<|jd�rEd}n|j�t|�|jd�}ttj||��}|jd�r�|jd�}|j}||kr�tjt	d	�|��nt
}xF|j�D]8\}}	||kr�	||j�kr�
}Pq��|rQ|jd
|||�}
|jt|
��n|s�||=|j�|jt	d�|�q�n|s�tjt	d���nt�j|��}|j|�}|j|�}
t
}xB|jj�D]1}|tkr�j|�|kr�
}Pq��t�fd
�|
D��}|j}|jr�j|jd��|kr�
|_d}t|j�}x6t|j�D]%\}}|j|kr�|}Pq�q�W|j||5|j�q�t|�}|r�jd�r�j �}z�|jj!||d�}||}|jd|j��}g}x%|D]}|j"||j#��qZW|j}g|D]}||dkr�|^q�}|j"|�|jj$||j%�|�|jj�t
}Wd|j&�Xn|jd�r5||=|j�|jt	d�|�n|jj'||d|d|d|jd��dS(s�strip changesets and all their descendants from the repository

    The strip command removes the specified changesets and all their
    descendants. If the working directory has uncommitted changes, the
    operation is aborted unless the --force flag is supplied, in which
    case changes will be discarded.

    If a parent of the working directory is stripped, then the working
    directory will automatically be updated to the most recent
    available ancestor of the stripped parent after the operation
    completes.

    Any stripped changesets are stored in ``.hg/strip-backup`` as a
    bundle (see :hg:`help bundle` and :hg:`help unbundle`). They can
    be restored by running :hg:`unbundle .hg/strip-backup/BUNDLE`,
    where BUNDLE is the bundle file created by the strip. Note that
    the local revision numbers will in general be different after the
    restore.

    Use the --no-backup option to discard the backup bundle once the
    operation completes.

    Strip is not a history-rewriting operation and can be used on
    changesets in the public phase. But if the stripped changesets have
    been pushed to a remote repository you will likely pull them again.

    Return 0 on success.
    RgRgR#R2R~R5R�RMsbookmark '%s' not foundsmancestors(bookmark(%s)) - ancestors(head() and not bookmark(%s)) - ancestors(bookmark() and not bookmark(%s))sbookmark '%s' deleted
sempty revision setc3s|]}�j|�VqdS(N(R(R�R�(tcl(s,/sys/lib/python2.7/site-packages/hgext/mq.pys	<genexpr>�sRiiR�s%s::.R�NR�R�((R�RR�R�R
R=R�RR�RRLRxRRJR2R�R�tdescendantstunionRRRRR�RYR�RR}R.R�R�R�RR
R�R�R�R�RR#(R\RcR2R�RgtmarkR�tuniquebmR�R�trsrevsROtstrippedrevstrootsR�R�t	rootnodesR�R�R�RQRRRhtuctxtdescendantrevsR R�RR�t
dirchanges((RNs,/sys/lib/python2.7/site-packages/hgext/mq.pyR#gs�.				"	
!			


	)



tqselectsdisable all guardsRlslist all guards in series fileR�s)pop to before first guarded applied patchtreapplyspop, then reapply patchess!hg qselect [OPTION]... [GUARD]...cOs.|j}|j�}|s*|jd�r�|j|�}gtt|j��D]}|j|�dsO|^qO}|j|�|j	�|s�|j
td��n|jd�r|jd�r|j|�}	gtt|j��D]}|j|�ds�^q�
t|	�t|�krU|j
td�t|�t|	�f�nt|
�t|�kr�|j
td�t|�t|
�f�q�qnb|jd�r�i}d}xU|jD]J}|s�|d	7}nx.|D]&}
|j
|
d�||
cd	7<q�q�W|jr(||d
<n|j�}|jdd��|r�|jtd
��xK|D]-\}}|jd|�|j|d�qgWq|jtd��nP|r�jtd��x4|D]}
|j|
d�q�Wn|jtd��|jd�o%|jo%|jd�}t}|jd�sL|jd�r��tt|j��D]z}|j|�\}}|sb|j
td��t}|dkr�|j|dt�n|j|t|d	��PqbqbWn|r*z0|r|j
td��|j||�nWd|j	�XndS(suset or print guarded patches to push

    Use the :hg:`qguard` command to set or print guards on patch, then use
    qselect to tell mq which guards to use. A patch will be pushed if
    it has no guards or any positive guards match the currently
    selected guard, but will not be pushed if any negative guards
    match the current guard. For example::

        qguard foo.patch -- -stable    (negative guard)
        qguard bar.patch    +stable    (positive guard)
        qselect stable

    This activates the "stable" guard. mq will skip foo.patch (because
    it has a negative match) but push bar.patch (because it has a
    positive match).

    With no arguments, prints the currently active guards.
    With one argument, sets the active guard.

    Use -n/--none to deactivate guards (no other arguments needed).
    When no guards are active, patches with positive guards are
    skipped and patches with negative guards are pushed.

    qselect can change the guards on applied patches. It does not pop
    guarded patches by default. Use --pop to pop back to the last
    applied patch that is not guarded. Use --reapply (which implies
    --pop) to push back to the current patch afterwards, but skip
    guarded patches.

    Use -s/--series to print a list of all guards in the series file
    (no other arguments needed). Use -v for more information.

    Returns 0 on success.R5isguards deactivated
R�R[sAnumber of unguarded, unapplied patches has changed from %d to %d
s=number of guarded, applied patches has changed from %d to %d
RlitNONEtkeycSs|ddS(Nii((R	((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt<lambda>Issguards in series file:
s%2d  s
sno guards in series file
sactive guards:
sno active guards
i�spopping guarded patches
Rgsreapplying unguarded patches
N(RYR�R�R�RKR.R�R�R�R�RmRR�R�R�R�R�R�R�R�RJRLR�R�R�(R\RcReR�R�Rnt
old_unappliedRQtold_guardedR�R�tnoguardstgsR�R�tcountR[tpoppedR�R((s,/sys/lib/python2.7/site-packages/hgext/mq.pytselect�s|)	

 #

	

'tqfinishR�sfinish all applied changesetsshg qfinish [-a] [REV]...cOs�|jd�r/|r/tjtd���n|jd�rKd	|}n|j}|jst|jtd��dStj||�}|dj	�|kr�|dj�r�|jtd��n|j
�}z|j||�|j�Wd|j�XdS(
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.
    R�sno revisions specifiedsqbase::qtipsno patches applied
iRPs6warning: uncommitted changes in the working directory
N(sqbase::qtip(R�RR�RRYR�RmR
R=R�R)R�R�RR<R�R(R\RcR=R�R�R2R((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR<ms"
		&tqqueueslist all available queuesR�sprint name of active queueR�screate new queueR�srename active queuesdelete reference to queuetpurges"delete queue, and remove patch dirs[OPTION] [QUEUE]cs�j�d�d�d��fd����fd�}����fd�}��fd�}��fd����fd	�}�fd
�}d�}	����fd�}
|s�|jd
�s�|jd�rt��}|jd�r|jd|f�dSx^|�D]S}|jd|f�||kr_|jr_|jtd��q|jd�qWdS|	|�s�tjtd���n|��|jd�r|�kr�tjtd�|��n|�r���n||�||�n	|jd�rk��}||krEtjtd�|��n|�krmtjtd�|��n||�}
||�}tjj	|�r�tjtd�|��n�j
dd�}xj�D]b}||kr|jd|f�tjj	|
�r.tj|
|�q.q�|jd|f�q�W|j�tj�j
d��j
����|�n�|jd�r�|
|�n�|jd�r��kr�|
|�n||�}tjj	|�rtj|�qn.|�krtjtd���n||�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.queuecs5tjj�j�}|jd�r1|d}n|S(Nspatches-i(RvRwR�R(R�(R�(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt_getcurrent�s
cs9y �j�d�}|j�Wntk
r4tSXtS(NR�(R{RyRzRLRJ(R�(t
_allqueuesRc(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt	_noqueues�s
cs���}yg�j�d�}g|D]}|j�r%|j�^q%}|j�||kro|j|�nWntk
r��g}nXt|�S(NR�(R{R#RyR-RzR�(tcurrentR�Rjtqueues(Rjt
_defaultqueueRiRc(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt
_getqueues�s	+


cs/�jr!tjtd���n�|�dS(Ns@new queue created, but cannot make active as patches are applied(R�RR�R(R(t_setactivenocheckR�(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt
_setactive�s	cs<�j�d�}|dkr.|j|�n|j�dS(NR�Rk(R{R�Ry(RR�(t_activequeueRc(s,/sys/lib/python2.7/site-packages/hgext/mq.pyRp�scs4�j�d�}|jd|f�|j�dS(NR�s%s
(R{R�Ry(RR�(RjRc(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt	_addqueue�scs.|dkr�jd�S�jd|�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$tjtd���n��}||krQtjtd���n�jdd�}x4�D],}||kr�qjn|jd|f�qjW|j�tj�jd��j���dS(Ns'cannot delete queue that does not exists$cannot delete currently active queuespatches.queues.newR�s%s
(RR�RR{R�RyR�RS(RRlR�Rj(RjRiR�Rc(s,/sys/lib/python2.7/site-packages/hgext/mq.pyt_delete�s	

R�R�s%s
Ns%ss
 (active)
s
s9invalid queue name, may not contain the characters ":\/."R�squeue "%s" already existsR�s%can't rename "%s" to its current names'non-queue directory "%s" already existsspatches.queues.newR�R@Rhs"use --create to create a new queue(RYR�R�tquietRRR�RvRwR�R{R�RyRStshutiltrmtree(R\RcRR�RkRoRqRsRtRuRvRlRjtolddirtnewdirR�tqdir((RrRjRnRiRpR�R�Rcs,/sys/lib/python2.7/site-packages/hgext/mq.pyRg�s�			%			


	


"


cCsn|jjrj|jjddt�r0tj}n	tj}||jjdj}||j	|j��n|S(sEcallback used to set mq changeset as secret when no phase data existsRYRZi(
RYR�R\R]RJRRZR8RR�(RcRUtmqphaseRj((s,/sys/lib/python2.7/site-packages/hgext/mq.pytmqphasedefaultsH
s	csKd|jf�fd��Y�|j�rG�|_|jjt�ndS(Ntmqrepoc	sheZejd��Zed�Zddddeei�fd�Z�fd�Z	�fd�Z
RS(cSst|j|j|j�S(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(RYR�RRRRR�(RterrmsgR�RRRk((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(R�RtsuperRa(RR�R3R4R�R�teditortextra(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pyRa`
s
	cs�|jjr�|r�g|jjD]}|j^q }|r{t|�}x1t|�D] }||krjPqT|j�qTWnxB|D]7}||j�tjkr�t	j
td���q�q�Wnt�|�j
||�dS(Nssource has mq patches applied(RYR�RR�R�R�RdRRZRR�RR�t	checkpush(RR�R2R�t
outappliedRR(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�i
s"
cs�t�|�j�}|j}|js+|Sg|jD]}|j|jf^q5}y"|j�jj|dd�Wn=t	j
k
r�|jjt
d�t|dd��|SX|jj}g|D]}||d�r�|^q�}|s�S|j|dddf�|j|dddf�|j|jj|dd�ddf�|d}xQ|D]I}|d|kr�|jjt
d�|d�qf|d||d<qfW|S(	s,augment tags from base class with patch tagsi�is)mq status file refers to unknown node %s
RiRjtqparentis+tag %s overrides mq patch of the same name
(R�t	_findtagsRYR�RRR[RR�RR�R\R�RRthasnodeR-R(RtresultR�Rtmqtagstincludedtmqtttags(R(s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�}
s2		(")+

N(RRRR�RYRJR�R)RaR�R�((R(s,/sys/lib/python2.7/site-packages/hgext/mq.pyRT
s(t	__class__Rt_phasedefaultsR-R~(R\Rc((Rs,/sys/lib/python2.7/site-packages/hgext/mq.pyt	reposetupS
sN	cOsZtj|d�rG|jdt�rG|jtd�|jd��n|||||�S(NR�t	no_commits#cannot import over an applied patchR�(RR^R�RJR�R(torigR\RcReRf((s,/sys/lib/python2.7/site-packages/hgext/mq.pytmqimport�s
cOs�|jdd�}|s(||||�S|rb|d}tj|�s�tjtd���q�n3tjt	j
��}|s�tjtd���ntj||�}t||t
�S(NRYis0only a local queue repository may be initializeds5there is no Mercurial repository here (.hg not found)(R�R)R	RRR�RRtfindrepoRvtgetcwdR�RRL(R�R\ReRfRYtrepopathRc((s,/sys/lib/python2.7/site-packages/hgext/mq.pytmqinit�s
cOst|jdd�}|s+|||||�S|j}|j�}|s^tjtd���n||j|||�S(s>Add --mq option to operate on patch repository instead of mainRYsno queue repositoryN(R�R)RYR�RR�RR\(R�R\RcReRfRYR�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt	mqcommand�s	c
Os�|||||�}|j}g}t|j�t|j|��}}	|ru|j|jtd�d�|�n|	r�|j|jtd�d�|	�n|r�|jtd�dj|��n|j	td��|S(Ns
%d appliedsqseries.applieds%d unappliedsqseries.unappliedsmq:     %s
s, smq:     (empty queue)
(
RYR.R�R�R-R�RR�RSR�(
R�R\RcReRfR�R�R�R�R&((s,/sys/lib/python2.7/site-packages/hgext/mq.pyR�s	%&&#cCsqtj|ddtd��tg|jjD]}||jj�^q,�}g|D]}||krU|^qUS(s+``mq()``
    Changesets managed by MQ.
    ismq takes no arguments(RtgetargsRR�RYR�RR�(RctsubsetR	R�R�((s,/sys/lib/python2.7/site-packages/hgext/mq.pytrevsetmq�s2cs�dddtd�fg�tjtjdt�tjtjdt�tjtjdt�}|dj	��t
tjjd�����fd	�}|tj�xBtj�D]4\}}|j
t
kr�|t|d
i��q�q�Wttjd<dS(NR(RYsoperate on patch repositorytimportRR�iR�csfx_|j�D]Q}tj|�d}|�kr8q
ntj||t�}|dj��q
WdS(Nii(tkeysRtparsealiasesRtwrapcommandR�R�(tcmdtabletcmdR�(tmqopttnowrap(s,/sys/lib/python2.7/site-packages/hgext/mq.pytdotable�sR�(R)RRR�RttableR�RR�R�R�tnorepoR�t__file__tgetattrR�Rtsymbols(R\R�R�textnamet	extmodule((R�R�s,/sys/lib/python2.7/site-packages/hgext/mq.pytextsetup�s
tredsqguard.negativetyellowsqguard.positivetgreensqguard.unguardedsblue bold underlinesqseries.applieds
black boldsqseries.guardedsred boldsqseries.missingsqseries.unapplieds qnew qrefresh qdiff qcommit(]t__doc__tmercurial.i18nRtmercurial.nodeRRRRRtmercurial.lockRt	mercurialRRR	R
RRR
RRRRR�RvR�R�RxR�R)t
seriesoptsR�tcommandt
testedwithtnormpathR�tobjectRRRhR�RiRjR�R@R�R�R�RR�t
remoteoptsRR�RaRlRAR�RR$twalkoptst
commitoptsRNRLR�t	diffopts2R_R0R3R�R8R@RBR�R�R�R�R�R#ReR<RJRgR~R�R�R�R�RR�t
i18nfunctionsR�t
colortablet	inferrepo(((s,/sys/lib/python2.7/site-packages/hgext/mq.pyt<module><sx(."0	�����			3				L	!!!	
�(
�,E	G								9	 �j+�	T								



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.