V Qc@sdZddlZddlZddlZddlZddlZddlZddlmZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZddZdZdZi de fd6de fd6de fd6de fd6defd6defd6defd6de fd6de fd6defd6defd6Zedkre ndS( s$Remote RCS -- command line interfaceiN(t openrcsclientc Csntjt_ytjtjdd\}}|s=d}n|d|d}}tj|sptjdnt|\}}tj||\}}WnZtjk r}|GHdGHdGHdGHd GHd GHd GHd GHd GHdGHdGHtjdnXt |}|s|j }nxP|D]H} y|||| Wqt t jfk re}d| |fGHqXqWdS(Nis h:p:d:qvLtheadisunknown commands2usage: rrcs [options] command [options] [file] ...swhere command can be:s+ ci|put # checkin the given filess co|get # checkouts% info # print header infos1 head # print revision of head branchs* list # list filename if valids" log # print full logs/ diff # diff rcs file and work files7if no files are given, all remote rcs files are assumedis%s: %s( tsyststderrtstdouttgetopttargvtcommandsthas_keyterrortexitRt listfilestIOErrortos( toptstresttcmdtcoptsettfunctcoptstfilestmsgtxtfn((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pytmain s>    cCst|}|j}|j|j| }| r[t||||r[d|GHdSdG|GdGHt|}|j|||}|r|GHndS(Ns %s: unchanged since last checkins Checking ins...(topentreadtclosetisvalidtsamet asklogmessagetput(RRRtftdatatnewtmessagetmessages((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pytcheckin/s      cCs9|j|}t|d}|j||jdS(Ntw(tgetRtwriteR(RRRR!R ((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pytcheckout=s cCs|j|dS(N(tlock(RRR((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pyR*CscCs|j|dS(N(tunlock(RRR((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pyR+FscCsT|j|}|j}|jx|D]}|dG||GHq,WddGHdS(Nt:t=iF(tinfotkeystsort(RRRtdictR/tkey((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pyR.Is    cCs|j|}|G|GHdS(N(R(RRRR((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pyRQscCs|j|r|GHndS(N(R(RRR((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pytlistUscCsTd}x&|D]\}}|d||}q W|d}|j||}|GHdS(Ntt i(tlog(RRRtflagstotaR$((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pyR6Ys  c Cst|||rdSd}x&|D]\}}|d||}q#W|d}|j|}tj}|j||jd||j||fGHtjd||j |f}|rddGHndS(NR4R5isdiff %s -r%s %ss diff %s %s %sR-iF( RR'ttempfiletNamedTemporaryFileR(tflushRR tsystemtname( RRRR7R8R9R!ttftsts((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pytdiffas    cCs_|dkr1t|}|j}|jntj|j}|j|}||kS(N(tNoneRRRtmd5R"tdigesttsum(RRRR!R tlsumtrsum((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pyRqs    cCs|r dGndGdGH|r$dGHnd}xPtjjdtjjtjj}| sl|dkrpPn||}q-|S(Nsenter description,senter log message,s)terminate with single '.' or end of file:s"NOTE: This is NOT the log message!R4s>> s. (RRR(R<tstdintreadline(R"R#tline((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pyRzs  cCs,ytj|Wntjk r'nXdS(N(R tunlinkR (R((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pytremovesR4tciRtcoR'R.RR3R*R+sbhLRtd:l:r:s:w:V:R6tcRAt__main__(t__doc__RR RtstringRCR:t rcsclientRRR%R)R*R+R.RR3R6RARBRRRLRt__name__(((s'/usr/lib64/python2.7/Demo/pdist/rrcs.pytsD       "