ó ¿œ^c@sYdZddlZddlZddlZddlZddlZddd„ƒYZdS(sŒRCS interface module. Defines the class RCS, which represents a directory with rcs version files and (possibly) corresponding work files. iÿÿÿÿNtRCScBseZdZejejdZd„Zd„Zdd„Z d„Z d„Z d„Z d „Z d dd „Zddd „Zdd „Zd„Zd„Zd„Zd„Zd„Zddd„Zd„Zd„Zd„Zdd„Zd„Zd„ZRS(s7RCS interface class (local filesystem version). An instance of this class represents a directory with rcs version files and (possible) corresponding work files. Methods provide access to most rcs operations such as checkin/checkout, access to the rcs metadata (revisions, logs, branches etc.) as well as some filesystem operations such as listing all rcs version files. XXX BUGS / PROBLEMS - The instance always represents the current directory so it's not very useful to have more than one instance around simultaneously s-_=+cCsdS(s Constructor.N((tself((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pyt__init__&scCsdS(s Destructor.N((R((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pyt__del__*stcCsi|j|d|ƒ}|jƒ}|j|ƒ}|rH|d|}n|ddkre|d }n|S(smReturn the full log text for NAME_REV as a string. Optional OTHERFLAGS are passed to rlog. srlog s%s: %siÿÿÿÿs (t_opentreadt _closepipe(Rtname_revt otherflagstftdatatstatus((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pytlog0s  cCs|j|ƒ}|dS(s%Return the head revision for NAME_REVthead(tinfo(RRtdict((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pyR?sc Cs½|j|dƒ}i}x}|jƒ}|s1Pn|ddkrGqntj|dƒ}|dkr|| tj||dƒ}}|||" if None); or the file description if this is a new file. The optional OTHERFLAGS argument is passed to ci without interpretation. Any output from ci goes to directly to stdout. siÿÿÿÿs s-usci %s%s -t%s %s %ss([\"$`])s\\\1sci %s%s -m"%s" %s %s( t _unmangletisvalidttempfiletNamedTemporaryFiletwritetflushRtretsubR( RRtmessageR RRtnewR#R R((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pytcheckins"      cCs†tjtjƒ}t|j|ƒ}tjjdƒrdtjdƒ}t|j|ƒ}||}nt|j|ƒ}|j ||ƒS(s=Return a list of all version files matching optional PATTERN.R( tostlistdirtcurdirtfiltert_isrcstpathtisdirtmaptrealnamet_filter(Rtpattfilestfiles2((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pyt listfiles s cCs@|j|ƒ}tjj|ƒp?tjjtjjd|ƒƒS(s0Test whether NAME has a version file associated.R(trcsnameR0R5tisfiletjoin(RRtnamev((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pyR&«scCsœ|j|ƒr|}n |d}tjj|ƒr8|Stjjdtjj|ƒƒ}tjj|ƒro|Stjjdƒr”tjjd|ƒS|SdS(sýReturn the pathname of the version file for NAME. The argument can be a work file name or a version file name. If the version file does not exist, the name of the version file that would be created by "ci" is returned. s,vRN(R4R0R5R?R@tbasenameR6(RRRA((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pyR>±s  !cCsN|j|ƒr|d }n|}tjj|ƒr8|Stjj|ƒ}|S(sôReturn the pathname of the work file for NAME. The argument can be a work file name or a version file name. If the work file does not exist, the name of the work file that would be created by "co" is returned. iþÿÿÿ(R4R0R5R?RB(RRAR((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pyR8Ãs cCs‚|j|dƒ}|jƒ}|j|ƒ}|r?t|‚n|sIdS|ddkrf|d }n|j|ƒ|j|ƒkS(såTest whether FILE (which must have a version file) is locked. XXX This does not tell you which revision number is locked and ignores any revision you may pass in (by virtue of using rlog -L -R). s rlog -L -Riÿÿÿÿs N(RRRRtNoneR8(RRR RR ((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pytislockedÑs   cCsD|j|ƒ\}}|j|ƒs:tjd|f‚n||fS(s}Normalize NAME_REV into a (NAME, REV) tuple. Raise an exception if there is no corresponding version file. snot an rcs file %r(R%R&R0terror(RRRR((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pyRãssco -ps-rcCsV|j|ƒ\}}|j|ƒ}|r?|d||}ntjd||fƒS(sINTERNAL: open a read pipe to NAME_REV using optional COMMAND. Optional FLAG is used to indicate the revision (default -r). Default COMMAND is "co -p". Return a file object connected by a pipe to the command's output. t s%s %r(RR>R0tpopen(RRRtrflagRRRA((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pyRðs cCsmt|ƒtdƒkr1|df}\}}n |\}}x)|D]!}||jkrDtd‚qDqDW|S(s÷INTERNAL: Normalize NAME_REV argument to (NAME, REV) tuple. Raise an exception if NAME contains invalid characters. A NAME_REV argument is either NAME string (implying REV='') or a tuple of the form (NAME, REV). Rsbad char in rev(ttypetokcharst ValueError(RRRRtc((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pyR%s   cCs|jƒ}|sd St|dƒ\}}|dkrAd|fS|d@}|dkrfd}|}nd}|d@rƒ|d}n||fS( s:INTERNAL: Close PIPE and print its exit status if nonzero.iitexititstoppedtkilledi€s (coredump)N(tcloseRCtdivmod(RR tststdetailtreasontsignaltcode((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pyRs       cCs3|d}tj|ƒ}|r/td|‚ndS(s{INTERNAL: run COMMAND in a subshell. Standard input for the command is taken from /dev/null. Raise IOError when the exit status is not zero. Return whatever the calling method should return; normally None. A derived class may override this method and redefine it to capture stdout/stderr of the command and return it. s R8RDRRR%RRR9R]R4(((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pyRs0       !          ((R`RXR0R+RR'R(((s)/usr/lib64/python2.7/Demo/pdist/rcslib.pyts