[Cvsshell-devel] CVS: cvsshell/src cvs_cmds.py,1.15,1.16 cvs_shell.py,1.31,1.32
Status: Beta
Brought to you by:
stefanheimann
From: Stefan H. <ste...@us...> - 2002-08-15 21:42:20
|
Update of /cvsroot/cvsshell/cvsshell/src In directory usw-pr-cvs1:/tmp/cvs-serv28124/src Modified Files: cvs_cmds.py cvs_shell.py Log Message: last changes needed for release 0.3 Index: cvs_cmds.py =================================================================== RCS file: /cvsroot/cvsshell/cvsshell/src/cvs_cmds.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** cvs_cmds.py 4 Aug 2002 17:28:42 -0000 1.15 --- cvs_cmds.py 15 Aug 2002 21:42:17 -0000 1.16 *************** *** 545,546 **** --- 545,591 ---- newRoot = app.readCvsRootFromFile() if newRoot is not None: app.setCvsRoot(newRoot) + + def replace(app, name, args): + """Replaces a file with a given revision. + + replace rev file + + rev : the revision to replace the file with + file: the file to replace""" + try: + (globOpts, opts, + myOpts, rest) = app.parseArgs(args, + app.getCmdToAllowedOpts().get(name, '')) + except getopt.GetoptError, msg: + app.printErr(msg) + return + l = rest.split() + if len(l) != 2: + app.printErr("Illegal arguments.") + return + rev, file = l[0], l[1] + def __doIt(e, filename): + e.status = Entry.S_MODIFIED + return filename + try: + ids = app.applyOnEntryList(file, __doIt) + if len(ids) != 1: + app.printErr("Illegal arguments.") + return + file = ids[0] + except utils.ParseError: pass + except AppError, msg: + app.printErr(msg) + return + opts = opts + ' -p -r %s %s' % (rev, file) + try: + content = app.runCvsCmd('update', globOpts=globOpts, args=opts) + except CvsError: return + if not content: + app.printErr('empty file from repository.') + return + try: + open(file,'w').writelines(content) + except IOError, msg: + app.printErr(msg) + Index: cvs_shell.py =================================================================== RCS file: /cvsroot/cvsshell/cvsshell/src/cvs_shell.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** cvs_shell.py 7 Aug 2002 21:37:12 -0000 1.31 --- cvs_shell.py 15 Aug 2002 21:42:17 -0000 1.32 *************** *** 145,148 **** --- 145,152 ---- except ShellException: pass return + for c in cmd.split(';'): + self.evalSingleCommand(c) + + def evalSingleCommand(self, cmd): try: notEnclosed, enclosed = utils.split(cmd, '`') |