mò 3ÜLPc@sÏdkZdklZdklZlZlZdfd„ƒYZdfd„ƒYZdfd„ƒYZ d fd „ƒYZ d fd „ƒYZ d fd„ƒYZ d„Z ed„Zdeeed„ZdS(N(sTemplate(sPopensPIPEsSTDOUTt RepositorySetcBs)tZdZd„Zd„Zd„ZRS(s½Represents a collection of SVN repositories. Examples include all the individual student repositories for the course, or the set of team repositories for a particular project.cCs||_||_||_dS(N(tnametselft reposPrefixtprefixt reposSuffixes(RRRR((t>/afs/rose-hulman.edu/class/cs/csse120/scripts/batchSVNTypes.pyt__init__s  ccs,x%|iD]}t|i||ƒVq WdS(N(RRtst RepositoryR(RR((Rtreposs cCsd|i|i|ifS(NsRepositorySet(%s,%s,%s)(RRRR(R((Rt__repr__s(t__name__t __module__t__doc__RR R (((RR s   R cBs tZdZd„Zd„ZRS(sRepresents a single repository.cCs||_||_dS(N(tlongNameRt shortName(RRR((RRs cCsd|i|ifS(NsRepository(%s,%s)(RRR(R((RR s(R R RRR (((RR s  tProjectcBs tZdZd„Zd„ZRS(s<Represents a project and associated JUnit test case classes.cGs||_||_dS(sŠConstructs a Project instance. Optional arguments are strings giving fully qualified names of JUnit test classes.N(RRt testClasses(RRR((RR$s cCs=t|iƒ}|id|iƒdi|ƒ}d|dS(Nit,sProject(t)(tlistRRtargstinsertRtjoin(RR((RR +s(R R RRR (((RR"s  tMenuItemcBs tZdZd„Zd„ZRS(sBRepresents a menu item to be added to the main menu of the script.cCs||_||_dS(sÒConstructs a new menu item. itemFunction is a one-argument function that will be executed when a user selects the menu item. It will be passed a DataBlob object whose fields are the relevant "global" variables from the main application. See batchSVN.py for details on the included values. The function should return True if the program should exit after executing the function, or False otherwise. N(titemTextRttextt itemFunctiontfunction(RRR((RR3s  cCsd||ifGH|dS(sxDisplays this menu item with the given item number. Returns the appropriate number for the item after this one.s%2d - %siN(tnextItemNumberRR(RR((Rtdisplay?s(R R RRR(((RR1s  t MenuSeparatorcBs#tZdZdd„Zd„ZRS(s/Represents a separator between items in a menu.s----cCs ||_dS(N(t separatorTextRR(RR!((RRGscCs |iGH|S(sDisplays this menu separator without an item number. Returns the appropriate number for the item after this one, that is, nextItemNumberN(RRR(RR((RRIs(R R RRR(((RR Es  tDataBlobcBstZdZRS(s•Contains fields representing the relevant "global" variables from the main application. Used to pass data into menu item functions. (R R R(((RR"Os cCsF|d}t|ƒ|jo|Sn|| d||d| SdS(seReturns a truncated version of d by omitting characters in the middle if d is longer then length.is...iN(tlengthtsplitLentlentd(R&R#R$((RttruncateMiddleXs  c Cst|dtƒo0xet|ƒD]\}}d||fGHq!Wn9d}x|D]}|i|ƒ}qQWt d„|ƒ}Hd}x|djot |ƒi ƒ}yt|ƒ}||}Wq†tj o)|o|}d}qdGHd}q†tj o dGHq†Xq†W||fS(s^ Displays a numbered menu consisting of the given list menu items. Returns a tuple consisting of the chosen item number (or None if other text is entered) and the text of the choice. items may be a list of strings or a list of MenuItem and MenuSeparator objects. Presents the given prompt. Continues presenting the prompt until the user picks an item from the list. If allowOthers is True, then also lets user enter a non-numeric string which is the text returned to the caller. Otherwise the element of 'items' corresponding to the entered number is returned. is%2d - %scCs t|tƒS(N(t isinstancetxR(R)((Rtvsts5*** you must choose a number from the list above ***s1*** only numbers in the list above are valid ***N(R(titemststrt enumeratetitttnumtmiRtfiltertchoicet raw_inputtprompttstript inputValuetintt ValueErrort allowOtherstNonet IndexError( R6R,R;R/R2R4R1R0R8((Rt displayMenubs6      R+c Cs5h}|i|d<|ii|d s <--tshelltstdintstdouttstderrt close_fdss: s..(6t replacementstdataR?t activeProjectRRBRCt workingDirRRtTemplatetcommandtcommandTemplatetfindR%tcreatetostaccesstF_OKtmkdirtsuppressOutputRFt withCapturetopentbatchLogFileNamet captureFilet activeRepoSetR RHRRt substitutetcmdt menuWidthtshortNameLengtht padRepeattupperR'tchdirtPopentTruetPIPEtSTDOUTtpRJRKtcmdInputt cmdOutputt readlinest outputTexttclosetlineR7twrite(RSRORBRVR\R[RTRpRNRdRmRnReRHRrRbRlR_RF((Rt forEachRepoŽsl    /     $*    (RWtstringRRt subprocessRhRjRkRR RRR R"R'tFalseR>Rt(R>RR'RtR RkRhRjR"RRRRR RW((Rt?s    ,