�
_�@szdZddklZddkZddkZddklZddklZl Z l
Z
lZddklZl
Z
lZlZlZlZddklZlZdeifd ��YZhZeie�Zd
efd��YZdefd
��YZdefd��YZd�Zd�Zedddded�ed�fddged�ed�fddeed�fdd ged!�ed"�fd#d$ged%�ed"�fdd&ded'�ed"�fd(d)eed*�fdd+eed,�fd-d.eed/�fdd0ded1�ed2�fg
ed3��d4��Z d5�Z!d6�Z"d7�Z#e!e"gZ$dS(8scommand to transplant changesets from another branch
This extension allows you to transplant patches from another branch.
Transplanted patches are recorded in .hg/transplant/transplants, as a
map from a changeset hash to its hash in the source repository.
i�(t_N(tshort(t
bundlerepothgtmergetmatch(tpatchtrevlogtscmutiltutilterrortcmdutil(trevsett
templatekwtTransplantErrorcBseZRS((t__name__t
__module__(((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyRsttransplantentrycBseZd�ZRS(cCs||_||_dS(N(tlnodetrnode(tselfRR((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyt__init__s (RRR(((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyRsttransplantscBsGeZdddd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs[||_||_||_|pti|i�|_nh|_t|_|i�dS(N(tpathttransplantfiletopenerRRtFalsetdirtytread(RRRR((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyR#s cCs�tii|i|i�}|io�tii|�ovxs|ii|i�i�D]R}tt i
|id��\}}|ii
|g�}|it||��qTWndS(Nt:(tosRtjoinRtexistsRRt
splitlinestmapRtbintsplitRt
setdefaulttappendR(RtabspathtlineRRtlist((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyR.s!cCs�|io�|io�tii|i�pti|i�n|i|id�}xe|ii�D]T}xK|D]C}t t
i|i|i
f�\}}|i|d|d�qpWqcW|i�nt|_dS(NtwRs
(RRRRtisdirtmkdirRRt
itervaluesR"RthexRRtwritetcloseR(RtfpR)tttltr((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyR/6s$!cCs|ii|�pgS(N(Rtget(RR((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyR5BscCs8|ii|g�}|it||��t|_dS(N(RR%R&RtTrueR(RRRR)((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pytsetEscCs=|ii|i�}|o||i|�=t|_ndS(N(RR5RtindexR6R(Rt
transplantR)((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pytremoveJsN( RRtNoneRRR/R5R7R:(((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyR"s ttransplantercBs�eZd�Zd�Zhd�Zd�Zeedd�Zdd�Z d�Z
d�Zd�Zd �Z
ed
�Zd�Zd�Zd
�ZRS(cCs[||_|id�|_ti|i�|_t|idd|i�|_d|_dS(NR9RR(tuiRRRRRR;teditor(RR=trepo((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyRQs cCs�t||�o+||ii|d|�jotSq;nxr|ii|�D]^}t||i�p|ii|�tSn|i|ii|d|i�jotSqNqNWtS(s`returns True if a node is already an ancestor of parent
or has already been transplantedtstop( thasnodet changelogt reachableR6RR5RR:R(RR?tnodetparentR2((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pytappliedYs%cCs�t|�}|ii�\}}g} ti|i|�}
t|
_d}}}
z#|i �}|i
�}|id�}
x�|D]�}||}d|t|�f}|i
|||�o!|iitd�|�q�n|ii|�}|id�p�|d|jo| i|�|}q�n| o`||jo|i|d| �nti|| dttd�|ii�\}}g} q�nt}||jo4t}t||�p|i|d|g�q�nt}|dtijo�|id �p0|iitd
�|t|�f�t}q�|i|d �}||jo/titd�t|�t|�f��q�n|d}|o
d}nntidd
�\}}t i!|d�}ti"|||d|
�}x|D]}|i#|�q�i$�||=|p|oz�L|i%|||ii&|�|d|d|id�d|id��}Wn t'j
o|
i$��nX|o1|o*|ii(td�|t|�f�n8|o0|ii(td�t|�t|�f�nWd|ot i)|�nXq�q�W|
i$�| o4|i|d| �ti|| dttd�nWd|i*||�|i+i#�|
o|
i,�n|i,�|i,�XdS(s:apply the revisions in revmap one by one in revision orderR9s%s:%ss%skipping already applied revision %s
tfilteritheadsi�iREsskipping merge changeset %s:%s
s%s is not a parent of %stprefixshg-transplant-R*toptsRtlogs%s merged at %s
s%s transplanted to %s
N(-tsortedtdirstatetparentsRtdiffoptsR=R6tgitR;twlocktlockttransactionRRFtwarnRRBR5R&tpullRtupdateRRARtnullidtnotetlookupR tAbortttempfiletmkstempRtfdopentdiffR/R0tapplyoneRRtstatustunlinkt
saveseriesRtrelease(RR?tsourcetrevmaptmergesRJtrevstp1tp2tpullsRORRRQttrtrevRDtrevstrRNtdomerget skipmergeREt patchfiletfdR1tgentchunktn((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pytapplyhs�
$
%
c
Csg|iitd�|�|d|d|d}}}tidd�\}} ti|d�}
|
id�|
id |�|
id
|�|
i|d�|
i�z�t i
d|t i| �t i|�fd
h|dd<ti
|�d<dt idtd�d|ii�|it| ��dd!\}}}Wdti| �X|||fS(s0arbitrarily rewrite changeset before applying its
filtering %s
iiiRIshg-transplant-R*s# HG changeset patch
s
# User %s
s
# Date %d %d
s
s%s %s %stenvirontHGUSERt
HGREVISIONtonerrt errprefixs
filter failedtoutN(R=R`RR[R\RR]R/R0R tsystemt
shellquoteRR.RZtfouttparselogtfileRa(RRGRDRBRptusertdatetmsgRqt
headerfileR1((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyRG�s&
)cCs�|d \}} \}
}}}
d|
|f}h|d<}|o%|i||||�\} }}
n|o|
dti|�7}
n|iitd�t|��|iid| ||
f�|o!|oti td���n|o%ymt
�}ti|i||d|d d�t
|�}|p+|iitd
�ti|��dSnWq$tj
o�}tii|id�}tii|�oti|�n|ii�}|}|i| ||
||d|�|iit|�d
�ttd���q$Xnd}|o>|ii�\}}|i||�ti|id�}nti |id|�}|i!|
| |d|d|d|i"�}|pt#d��n|p|i$i
||�n|S(s>apply the patch in patchfile to the repository as a transplantis%d %dttransplant_sources
(transplanted from %s)sapplying %s
s %s %s
%s
s"can only omit patchfile if mergingtfilesteolmodes%s: empty changesettseriesRs
s1fix up the merge and run hg transplant --continuettextraRR>s"nothing committed after transplantN(%RGRR.R=R`RRRXR RZR7RR;R)RTt ExceptionRRRR RaRMRhRKR/tstrRRNt
setparentsRtalwaystroottexacttcommitR>tRuntimeErrorR(RR?RDtclRpRRKRGtmanifestR�ttimettimezoneR�tmessageR�R�tinstt
seriespathRhRitmRt((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyR_�sR% "#c
Cstiitii|id��oE|i|�\}}|iitd�t|�t|�f�ntii|id�}tii|�p|i i
�dSn|i�\}}h} x$|D]}|| |ii
|�<q�Wti|�|i||| ||�dS(s7recover last transaction and apply remaining changesetstjournals%s transplanted as %s
R�N(RRR RtrecoverR=R`RRRR/t
readseriesRBRlRaRu(
RR?RdRJRtRDR�tnodesRfRe((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pytresume*s%
cCs�|i�\}}}}}t}|p|p|p|dotitd���n|d}t|�djomtid�oSti td�}||jo/titd�t
|�t
|�f��q�q�t}nh|d<} |i�}
z�i
i�\}}||jo&titd�ti|���n|o|i||d�n|i|||d| d |i�}
|
ptitd
���n|p|ii|
|�n|i�|
|fSWd|
i�XdS(s/commit working directory using journal metadataistransplant log file is corruptiREs%s is not a parent of %sR�s'working dir not at transplant parent %sR�R>s
commit failedN(treadlogRR RZRtlenRJR5RdRYRR6RQRMRNRR.R�R�R>RR7tunlogRc(RR?RDR�R�R�RNRRER�RQRhRiRt((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyR�<s>$
$
cCsrg}g}|}xS|iid�i�D]9}|id�o
|}q+n|iti|��q+W||fS(NR�s# Merges(RRR!t
startswithR&RR#(RR�RftcurR(((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyR�dscCs�|pdSntii|i�pti|i�n|idd�}x2t|�D]$}|iti||�d�qXW|o<|id�x,|D] }|iti|�d�q�Wn|i �dS(NR�R*s
s # Merges
(
RRR+R,RRLR/RR.R0(RReRfR�RlR�((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyRbps
"
"c Cs\g}g}ti}t}d}d}x�i�i�D]�}|o|i|�q:|id�o|d}q:|id�o|d}q:|id�oti|d�}q:|id�o|iti|d��q:|id�pt }|i|�q:q:Wd||fjot
itd ���n|||d
i
|�|fS(Ns# User is# Date s
# Node ID i
s # Parent i s# s,filter corrupted changeset (no user or date)s
(RRWRR;RR!R&R�R#R6R RZRR( RR1RNR�RDtinmsgR�R�R(((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyRs0 cCs�tii|i�pti|i�n|idd�}|id|�|id|�|idti|��|idti|�d�|o"|idti|�d�n|i|i�d�|i �dS( s,journal changelog metadata for later recoverR�R*s
# User %s
s
# Date %s
s
# Node ID %s
s # Parent s
N(
RRR+R,RR/RR.trstripR0(RR�R�R�RhRiRR1((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyRK�s"cCs|i|id��S(NR�(RR(R((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyR��scCs@tii|id�}tii|�oti|�ndS(sremove changelog journalR�N(RRRR Ra(Rtabsdst((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyR��scs����fd�}|S(Ncs��i�|��otSn�ii|�dtijotSn�ii|�d}|id�}|o�i�|��otSntS(NiiR�( RFRRBRNRRWRR5R6(RDR�tcnode(RR?RdR�(s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pytmatchfn�s ((RR?RdR�R�((R?RdRR�s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyttransplantfilter�sN(RRRRFRuRGRR;R_R�R�R�RbRRKR�R�R�(((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyR<Ps j < ( cCs;y|ii|�dj SWntij
otSnXdS(N(RBRlR;R
tRevlogErrorR(R?RD((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyRA�scCs�d�}ti|||�}g}g}xZ|D]R}|i||�d} x�| p�|itd��} | djo||�d} qQ| djoM|ii|�d}
x*ti ||
|�D]}|i
|�q�Wd} qQ| d
jo|i
td��d} qQqQW| djo|i|�q1| djo|i|�q1| d joPq1| d
jod}d}Pq1q1W|i�||fS(s#interactively transplant changesetscSs|itd��dS(Ns�y: transplant this changeset
n: skip this changeset
m: merge at this changeset
p: show patch
c: commit selected changesets
q: cancel transplant
?: show this help
(R/R(R=((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyt
browsehelp�ssapply changeset? [ynmpcq?]:t?tpityRtR�tctqsno such option
N(R�RtR�R�R�(((
Rtshow_changesettshowR;tpromptRRBRNRR^R/R&R0(R=R?R�RJR�t displayerRRfRDtactionRERs((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyt
browserevs�sD
R9tsRdR�spull patches from REPOtREPOtbtbranchspull patches from branch BRANCHtBRANCHtatalls pull all changesets up to BRANCHR�tprunes
skip over REVtREVR�Rsmerge at REVREs)parent to choose when transplanting mergetetedits invoke editor on commit messagesRKs%append transplant info to log messageR�tcontinues-continue last transplant session after repairRGs!filter changesets through commandtCMDsChg transplant [-s REPO] [-b BRANCH [-a]] [-p REV] [-m REV] [REV]...csqtid�}tid�}d�}|||�|id�p|idd�|d<n|id�p|idd�|d<nt||�}|id�oti|_n|ii �\}} t
|�djo)|tijoti
td ���n|id
�p~| tijoti
td���n|i�d \}
}}}
|
p|p|p|
oti
td
���q�n|id�}|ojti|||i|��}t|i|idd��}ti|||d|dt�\}}}n+|}t|i|idd��}d}z|id
�o|i|||�dSn|i|||��|id�oUg}ti||id��D]}||i|�q�~���fd�}n�}t|i|idd��}h}|o:x�i||�D]}|i|�|t|�<q,Wn�|id�p|o�||jo|||d|�}n||||d|�}|id�o
|}n)t||||�\}}|i|�x(|D]}|||i i!|�<q�x$|D]}|||i i!|�<qW|i"|||||�Wd|o|�nXdS(s
transplant changesets from another branch
Selected changesets will be applied on top of the current working
directory with the log of the original changeset. The changesets
are copied and will thus appear twice in the history. Use the
rebase extension instead if you want to move a whole branch of
unpublished changesets.
If --log is specified, log messages will have a comment appended
of the form::
(transplanted from CHANGESETHASH)
You can rewrite the changelog message with the --filter option.
Its argument will be invoked with the current changelog message as
$1 and the patch as $2.
If --source/-s is specified, selects changesets from the named
repository. If --branch/-b is specified, selects changesets from
the branch holding the named revision, up to that revision. If
--all/-a is specified, all changesets on the branch will be
transplanted, otherwise you will be prompted to select the
changesets you want.
:hg:`transplant --branch REVISION --all` will transplant the
selected branch (up to the named revision) onto your current
working directory.
You can optionally mark selected transplanted changesets as merge
changesets. You will not be prompted to transplant any ancestors
of a merged transplant, and you can merge descendants of them
normally instead of transplanting them.
Merge changesets may be transplanted directly by specifying the
proper parent changeset by calling :hg:`transplant --parent`.
If no merges or revisions are provided, :hg:`transplant` will
start an interactive changeset browser.
If a changeset application fails, you can fix the merge by hand
and then resume where you left off by calling :hg:`transplant
--continue/-c`.
css+x$|D]}||�o |VqqWdS(N((R?tcsetsRRD((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pytincwalk,s
css�|p|i�}ng}x*|D]"}|i|ii||��q$Wx7|ii||�dD]}||�o |VqdqdWdS(Ni(RHR&RBtancestortnodesbetween(R?R�tbranchesRt ancestorsR�RD((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyttransplantwalk1s
cSs|id�oQ|id�p |id�p|id�otitd���ndSn|id�p$|p|id�p
|id�ptitd���n|id�oM|id�ptitd���n|otitd ���qndS(
NR�R�R�Rs4--continue is incompatible with branch, all or mergeRds3no source URL, branch tag or revision list provideds --all requires a branch revisions*--all is incompatible with a revision list(R5R RZR(RJRg((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyt checkopts;s0 RKR9RGR�isno revision checked outR�soutstanding uncommitted mergesisoutstanding local changesRdR�t onlyheadstforceNR�cs�|�o
|�jS(((tx(ttfR�(s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyt<lambda>usRR�R((((#R R�R5tconfigR<RtcommitforceeditorR>RMRNR�RRWRZRR`Rtpeert
expandpathR"RYRtgetremotechangesR6R;R�R�RtrevrangetintR�textendRBRlRu(R=R?RgRJR�R�R�ttpRhRiR�R�R4tdt
sourcerepoRdR�R�t cleanupfnt_[1]R�RfRetalltransplantst newmerges((R�R�s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pyR9�s~=
#8!
cCsc|oti|||�}n|}g}|D]+}||i�id�o||q1q1~S(s```transplanted([set])``
Transplanted changesets in set, or all transplanted changesets.
R�(RtgetsetR�R5(R?tsubsetR�R�R�R4((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pytrevsettransplanted�scKs0|i�id�}|oti|�pdS(sT:transplanted: String. The node identifier of the transplanted
changeset if any.R�R�(R�R5RR.(R?tctxtargsRt((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pytkwtransplanted�scCsttid<ttid<dS(Nttransplanted(R�RtsymbolsR�R
tkeywords(R=((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pytextsetup�s
(%t__doc__tmercurial.i18nRRR[tmercurial.nodeRt mercurialRRRRRRRR R
RRR
RZRtcmdtabletcommandtobjectRRR<RAR�R;RR9R�R�R�t
i18nfunctions(((s?/sys/lib/python/lib/python2.5/site-packages/hgext/transplant.pys<module>sD"..� + �
|