ok
Direktori : /lib64/python2.7/Tools/scripts/ |
Current File : //lib64/python2.7/Tools/scripts/logmerge.pyc |
� iцdc @ s� d Z d d l Z d d l Z d d l Z d d l Z d d d Z d d d Z d � Z d � Z d d � Z d � Z e d k r� y e � Wq� e k r� Z e j e j k r� � q� q� Xn d S( s� Consolidate a bunch of CVS or RCS logs read from stdin. Input should be the output of a CVS or RCS logging command, e.g. cvs log -rrelease14: which dumps all log messages from release1.4 upwards (assuming that release 1.4 was tagged with tag 'release14'). Note the trailing colon! This collects all the revision records and outputs them sorted by date rather than by file, collapsing duplicate revision record, i.e., records with the same message for different files. The -t option causes it to truncate (discard) the last revision log entry; this is useful when using something like the above cvs log command, which shows the revisions including the given tag, while you probably want everything *since* that tag. The -r option reverses the output (oldest first; the default is oldest last). The -b tag option restricts the output to *only* checkin messages belonging to the given branch tag. The form -b HEAD restricts the output to checkin messages belonging to the CVS head (trunk). (It produces some output if tag is a non-branch tag, but this output is not very useful.) -h prints this message and exits. XXX This code was created by reverse engineering CVS 1.9 and RCS 5.7 from their output. i����Nt =iM s t -i c C s' d } d } d } t j t j d d � \ } } xt | D]l \ } } | d k rY d } q8 | d k rn d } q8 | d k r� | } q8 | d k r8 t GHt j d � q8 q8 Wg } xK t t j � } | s� Pn t | | � } | r� | d =n | | t | � )q� | j � | s| j � n t | � d S( s Main programi i s trb:hs -ts -rs -bs -hi����N( t Nonet getoptt syst argvt __doc__t exitt read_chunkt stdint digest_chunkt lent sortt reverset format_output( t truncate_lastR t brancht optst argst ot at databaset chunkt records( ( s. /usr/lib64/python2.7/Tools/scripts/logmerge.pyt main* s6 c C s� g } g } xw | j � } | s% Pn | t k rK | rG | j | � n Pn | t k rv | r� | j | � g } q� q | j | � q | S( sk Read a chunk -- data for one file, ending with sep1. Split the chunk in parts separated by sep2. ( t readlinet sep1t appendt sep2( t fpR t linest line( ( s. /usr/lib64/python2.7/Tools/scripts/logmerge.pyR H s c C s5 | d } d } t | � } x8 | D]* } | | | k r# | | j � } Pq# q# Wd } | d k rf n"| d k r� t j d � } ni } d } d } x~ | D]v } | | k r� d } q� | r� | d d k r | j � \ } } | d d k r� | d } n | | | <qd } q� q� W| j | � } t j d � } | r�| j d � d k r�| j d d � } t j d t j | � d � } q�n g } x�| d D]�} | d } | d } | d } | j � } d } t | � d k r| d d k r| d } | d } | d d k r"| d } n | d | } t | � d k r�| d d k r�| d } | d d k r|| d } q|q�n d } | j d | � | j � } t | � d k r�| d d k r�| d } n d } | j d | � | r| d k s�| j | � rq�qn | j | | | | | f � q�W| S( s9 Digest a chunk -- extract working file name and revisionsi s Working file:t HEADs ^\d+\.\d+$s symbolic names: i s i����t :s ^<>$s .0.t .t ^s \.\d+$i i s date:t ;t i s author:i t revisionN( R t stripR t ret compilet splitt gett findt replacet escapet insertt matchR ( R R R t keyt keylenR t working_filet revisionst foundt tagt revR t revlinet datelinet textt wordst authort datewordt timewordt date( ( s. /usr/lib64/python2.7/Tools/scripts/logmerge.pyR ` sx & " " " c C s� d } g } | j d � x� | D]� \ } } } } } | | k r� | r� t Gx+ | D]# \ } } } } | G| G| G| GHqR Wt j j | � n g } n | j | | | | f � | } q Wd S( N( NNNNN( R R R R t stdoutt writelines( R t prevtextt prevR? R3 R7 R<