ó fc@sĹdZddlZddlZddlZddlZdddZdddZd„Zd „Zdd „Z d „Z e d krÁy eƒWqÁe k r˝Zejejkrž‚qžqÁXndS( 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=iMs t-ic Cs(d}d}d }tjtjddƒ\}}xt|D]l\}}|dkrYd}q8|dkrnd}q8|dkrƒ|}q8|dkr8tGHtjdƒq8q8Wg}xLttjƒ}|sĘPnt||ƒ} |ré| d=n| |t |ƒ)qąW|j ƒ|s|j ƒnt |ƒd S( s Main programiistrb:hs-ts-rs-bs-hi˙˙˙˙N( tNonetgetopttsystargvt__doc__texitt read_chunktstdint digest_chunktlentsorttreverset format_output( t truncate_lastR tbranchtoptstargstotatdatabasetchunktrecords((s./usr/lib64/python2.7/Tools/scripts/logmerge.pytmain*s6          cCs‹g}g}xx|jƒ}|s%Pn|tkrK|rG|j|ƒnPn|tkrv|rƒ|j|ƒg}qƒq|j|ƒqW|S(skRead a chunk -- data for one file, ending with sep1. Split the chunk in parts separated by sep2. (treadlinetsep1tappendtsep2(tfpRtlinestline((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyRHs      cCs5|d}d}t|ƒ}x8|D]*}|| |kr#||jƒ}Pq#q#Wd}|dkrfn"|dkr„tjdƒ}ni}d}d}x~|D]v}||kr¸d}q|r|ddkr |jƒ\} } | dd krý| d } n| || $s.0.t.t^s\.\d+$iisdate:t;t isauthor:itrevisionN( R tstripRtretcompiletsplittgettfindtreplacetescapetinserttmatchR(RRRtkeytkeylenRt working_filet revisionstfoundttagtrevRtrevlinetdatelinettexttwordstauthortdatewordttimewordtdate((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyR `sx           &    "   "  "   c Csźd}g}|jdƒxœ|D]”\}}}}}||kr•|rŒtGx+|D]#\}} } } |G| G| G| GHqRWtjj|ƒng}n|j||||fƒ|}q WdS(N(NNNNN(RRRRtstdoutt writelines( RtprevtexttprevR?R3R7R<R:tp_datetp_working_filetp_revtp_author((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyRĽs   t__main__(RRterrnoRR(RRRRRR Rt__name__tIOErrortetEPIPE(((s./usr/lib64/python2.7/Tools/scripts/logmerge.pyt#s0   E