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

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


��c@sHddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ejZd�Zd�Z
defd��YZded�Zd	efd
��YZdZdefd
��YZdefd��YZdefd��YZdefd��YZdefd��YZd�Zd�ZdS(i�N(tutil(t_cCs"d�}tj|�}||�S(NcSs?tj|�}g|D]}|j�d^q}dj|�S(Nit(tbase64tencodestringt
splitlinestjoin(tstlinestl((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt	encodeargs#(tpickletdumps(targsR
R((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt
encodeargss	cCstj|�}tj|�S(N(RtdecodestringRtloads(R((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt
decodeargsstMissingToolcBseZRS((t__name__t
__module__(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyRscCsM|p	|}tj|�sI|r*tjp-t}|td�|��ndS(Nscannot find required "%s" tool(RtfindexetAbortRR(texetnametaborttexc((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt	checktoolstNoRepocBseZRS((RR(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR%stSKIPtcommitcBseZddidd�ZRS(c		CsX|p	d|_|pd|_||_||_||_||_||_||_dS(Ntunknowns0 0(tauthortdatetdesctparentstbranchtrevtextratsortkey(	tselfR R!R"R#R$R%R&R'((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt__init__+s					N(RRtNoneR)(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR*stconverter_sourcecBs�eZdZddd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zdd
�Z
d�Zd�Zd
�Zd�Zd�Zd�ZRS(sConversion source interfacecCs(||_||_||_d|_dS(smInitialize conversion source (or raise NoRepo("message")
        exception if path is not a valid repository)sutf-8N(tuitpathR%tencoding(R(R,R-R%((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR)9s			cCsdS(N((R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytbeforeBscCsdS(N((R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytafterEscCsdS(s*set the map of already-converted revisionsN((R(trevmap((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt	setrevmapHscCs
t�dS(s(Return a list of this repository's headsN(tNotImplementedError(R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytgetheadsLscCs
t�dS(sReturn a pair (data, mode) where data is the file content
        as a string and mode one of '', 'x' or 'l'. rev is the
        identifier returned by a previous call to getchanges(). Raise
        IOError to indicate that name was deleted in rev.
        N(R3(R(RR%((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytgetfilePscCs
t�dS(s#Returns a tuple of (files, copies).

        files is a sorted list of (filename, id) tuples for all files
        changed between version and its first parent returned by
        getcommit(). id is the source revision id of the file.

        copies is a dictionary of dest: source
        N(R3(R(tversion((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt
getchangesXs	cCs
t�dS(s$Return the commit object for versionN(R3(R(R6((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt	getcommitcscCs
t�dS(sdReturn the tags as a dictionary of name: revision

        Tag names must be UTF-8 strings.
        N(R3(R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytgettagsgscCs�|s|jpd}nt|t�r4|jd�Sy|j|�jd�SWnUtk
r�y|jd�jd�SWq�tk
r�|j|d�jd�SXnXdS(Nsutf-8slatin-1treplace(R.t
isinstancetunicodetencodetdecodetUnicodeError(R(RR.((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytrecodens


cCs
t�dS(sJReturn the files changed by rev compared to parent[i].

        i is an index selecting one of the parents of rev.  The return
        value should be the list of files that are different in rev and
        this parent.

        If rev has no parents, i is None.

        This function is only needed to support --filemap
        N(R3(R(R%ti((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytgetchangedfiles|scCsdS(s5Notify the source that a revision has been converted.N((R(R%tsinkrev((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt	converted�scCstS(s�Return true if this source has a meaningful, native revision
        order. For instance, Mercurial revisions are store sequentially
        while there is no such global ordering with Darcs.
        (tFalse(R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pythasnativeorder�scCstS(s@Return true if this source has ability to close branch.
        (RE(R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pythasnativeclose�scCsdS(s�If rev is a meaningful revision reference in source, return
        the referenced identifier in the same format used by getcommit().
        return None otherwise.
        N(R*(R(R%((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt	lookuprev�scCsiS(spReturn the bookmarks as a dictionary of name: revision

        Bookmark names are to be UTF-8 strings.
        ((R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytgetbookmarks�sN(RRt__doc__R*R)R/R0R2R4R5R7R8R9R@RBRDRFRGRHRI(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR+6s"										
				tconverter_sinkcBszeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�ZRS(
s"Conversion sink (target) interfacecCs||_||_g|_dS(s�Initialize conversion sink (or raise NoRepo("message")
        exception if path is not a valid repository)

        created is a list of paths to remove if a fatal error occurs
        laterN(R,R-tcreated(R(R,R-((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR)�s		cCs
t�dS(s(Return a list of this repository's headsN(R3(R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR4�scCs
t�dS(s�Path to a file that will contain lines
        source_rev_id sink_rev_id
        mapping equivalent revision identifiers for each system.N(R3(R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt
revmapfile�scCsdS(s�Path to a file that will contain lines
        srcauthor=dstauthor
        mapping equivalent authors identifiers for each system.N(R*(R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt
authorfile�scCs
t�dS(s�Create a revision with all changed files listed in 'files'
        and having listed parents. 'commit' is a commit object
        containing at a minimum the author, date, and message for this
        changeset.  'files' is a list of (path, version) tuples,
        'copies' is a dictionary mapping destinations to sources,
        'source' is the source repository, and 'revmap' is a mapfile
        of source revisions to converted revisions. Only getfile() and
        lookuprev() should be called on 'source'.

        Note that the sink repository is not told to update itself to
        a particular revision (or even what that revision would be)
        before it receives the file data.
        N(R3(R(tfilestcopiesR#RtsourceR1((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt	putcommit�scCs
t�dS(s�Put tags into sink.

        tags: {tagname: sink_rev_id, ...} where tagname is an UTF-8 string.
        Return a pair (tag_revision, tag_parent_revision), or (None, None)
        if nothing was changed.
        N(R3(R(ttags((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytputtags�scCsdS(s�Set the current branch name. Called before the first putcommit
        on the branch.
        branch: branch name for subsequent commits
        pbranches: (converted parent revision, parent branch) tuplesN((R(R$t	pbranches((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt	setbranch�scCsdS(s;Tell the destination that we're using a filemap

        Some converter_sources (svn in particular) can claim that a file
        was changed in a revision, even if there was no change.  This method
        tells the destination that we're using a filemap and that it should
        filter empty revisions.
        N((R(tactive((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytsetfilemapmode�scCsdS(N((R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR/�scCsdS(N((R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR0�scCsdS(s�Put bookmarks into sink.

        bookmarks: {bookmarkname: sink_rev_id, ...}
        where bookmarkname is an UTF-8 string.
        N((R(t	bookmarks((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytputbookmarks�scCs
t�dS(s$Return True if the sink contains revN(R3(R(R%((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt	hascommit�s(RRRJR)R4RMRNRRRTRVRXR/R0RZR[(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyRK�s	
								
			tcommandlinecBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	d
�Zd�Zd�Z
ed
��Zd�Zd�ZRS(cCs||_||_dS(N(R,tcommand(R(R,R]((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR)s	cCsdS(N((R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytprerunscCsdS(N((R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytpostrunscOs"|j|gt|�}x�|j�D]�\}}t|�dkrX|jd|�n|jd|jdd��y>t|�dkr�|jd|�n|dcd|7<Wq&tk
r�q&Xq&Wg|D]}tj|�^q�}|j	j
s|dtjg7}nd	j
|�}|S(
Nit-s--RRi�t=s2>t (R]tlistt	iteritemstlentappendR:t	TypeErrorRt
shellquoteR,t	debugflagtostdevnullR(R(tcmdR
tkwargstcmdlinetktvtarg((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt_cmdlines 
"cOsd�}|j||||�S(Nc
Ss1tj|dtdddtjdtj�}|S(Ntshelltbufsizei�t	close_fdststdout(t
subprocesstPopentTrueRtclosefdstPIPE(Rntp((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytpopen s	(t_dorun(R(RlR
RmR}((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt_runs	cOs|jtj|||�S(N(R~Rtpopen2(R(RlR
Rm((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt_run2'scOsV|j|||�}|jjd|f�|j�z||�SWd|j�XdS(Nsrunning: %s
(RrR,tdebugR^R_(R(topenfuncRlR
RmRn((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR~*s
cOsB|j|||�}|j�d}|jj|�||jfS(Ni(RtcommunicateR,R�t
returncode(R(RlR
RmR|toutput((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytrun3scOsT|j|||�}|jj�}|j�|jjdj|��||jfS(NR(RRvt	readlinestwaitR,R�RR�(R(RlR
RmR|R�((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytrunlines9s

RcCsr|rn|r<|jjtd�|j�|jj|�ntj|�d}tjd|j|f��ndS(Ns
%s error:
is%s %s(R,twarnRR]RtexplainexitR(R(tstatusR�tmsg((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt	checkexit@scOs/|j|||�\}}|j||�|S(N(R�R�(R(RlR
RmR�R�((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytrun0HscOs8|j|||�\}}|j|dj|��|S(NR(R�R�R(R(RlR
RmR�R�((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt	runlines0MscCs?d}ytjd�}Wnttfk
r2nX|ddS(Nit
SC_ARG_MAXii(RjtsysconftAttributeErrort
ValueError(R(targmax((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR�Rs	cos�t|j|||��}|j|}d}g}xn|D]f}	t|	�d}
||
|ksst|�dkr�|j|	�||
7}q;|V|	g}|
}q;W|r�|VndS(Nii(ReRrR�Rf(R(targlistRlR
Rmtcmdlentlimittbytestfltfntb((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt_limit_arglistds

"

	
cOsDx=|j||||�D]#}|j|t|�||�qWdS(N(R�R�Rc(R(R�RlR
RmR	((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytxargsus(RRR)R^R_RrRR�R~R�R�R�R�R�t
propertycacheR�R�R�(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR\s													tmapfilecBs,eZd�Zd�Zd�Zd�ZRS(cCsEtt|�j�||_||_d|_g|_|j�dS(N(	tsuperR�R)R,R-R*tfptordert_read(R(R,R-((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR)zs				cCs-|js
dSyt|jd�}Wn,tk
rQ}|jtjkrM�ndSXx�t|�D]�\}}|j�dj�}|s�q_ny|jdd�\}}Wn7t	k
r�t
jtd�|j|df��nX||kr|j
j|�ntt|�j||�q_W|j�dS(NtriRbis/syntax error in %s(%d): key/value pair expected(R-topentIOErrorterrnotENOENTt	enumerateRtrstriptrsplitR�RRRR�RfR�R�t__setitem__tclose(R(R�terrRAtlinetkeytvalue((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR��s,	
	cCs�|jdkrfyt|jd�|_Wqftk
rb}tjtd�|j|jf��qfXn|jj	d||f�|jj
�tt|�j
||�dS(Ntascould not open map file %r: %ss%s %s
(R�R*R�R-R�RRRtstrerrortwritetflushR�R�R�(R(R�R�R�((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR��s
cCs&|jr"|jj�d|_ndS(N(R�R�R*(R(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR��s	
(RRR)R�R�R�(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyR�ys			c
Cs<|s
iSi}y�|d�}x�|�D]�\}}|j�dj�}|s]q/ny4|jdd�\}}|jdd�j�}Wn4tk
r�tjt	d�||df��nXg}x*|D]"}||kr�|j
|�q�q�W|||<q/WWn+tk
r7}	|	jtj
kr8�q8nX|S(s5Parse a splicemap, return a child/parents dictionary.R�iRbit,s8syntax error in %s(%d): child parent1[,parent2] expected(R�R�RR�tsplitR:R�RRRRfR�R�R�(
R-tmR�RAR�tchildR#tppR|te((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytparsesplicemap�s0


cCs@tjj|�tjj|�}|jd|j}||fS(s;Like util.makedate() but for time t instead of current timei�(tdatetimetutcfromtimestampt
fromtimestamptdaystseconds(tttdeltattz((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pytmakedatetimestamp�s(RR�RwRjR�tcPickleRt	mercurialRtmercurial.i18nRR�RRt	ExceptionRR*RyRRtSKIPREVtobjectRR+RKR\tdictR�R�R�(((s8/sys/lib/python2.7/site-packages/hgext/convert/common.pyt<module>s"<				qYy2	

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].