ó x”ž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}xKttjƒ}|sŹPnt||ƒ} |ré| d=n| |t |ƒ)q±|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}xw|jƒ}|s%Pn|tkrK|rG|j|ƒnPn|tkrv|rƒ|j|ƒg}qƒq|j|ƒq|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      c Cs5|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