python script for tortoise cvs

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Jun 25 18:58:48 EDT 2008


En Tue, 24 Jun 2008 12:16:07 -0300, sandeep <shiningsandy at gmail.com>  
escribió:

> i think ur suggestions do formulate my problem.now since i know some
> commands i wanted to know how can i execute cvs commands from python
> or we can say how can i capture the output from the cvs command ?.

Use the subprocess module  
<http://docs.python.org/lib/module-subprocess.html>

py> cvsexe = r"c:\Archivos de programa\CVSNT\cvs.exe"
py> import subprocess
py> p = subprocess.Popen([cvsexe, "status", "dinglob.pas"],  
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
py> output = p.communicate()[0]
py> print output
===================================================================
File: dinglob.pas       Status: Up-to-date

    Working revision:    1.102
    Repository revision: 1.102   /.../DINW/dinglob.pas,v
    Expansion option:    kv
    Commit Identifier:   484474257304f18
    Sticky Tag:          (none)
    Sticky Date:         (none)
    Sticky Options:      (none)
    Merge From:          (none)


-- 
Gabriel Genellina




More information about the Python-list mailing list