Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Automatic CVS add (See related posts)

Spider a directory using:

find . -type d ! \( -name "*CVS" \) -exec python cvsAdd.py {} \;
find . -name "*.py" -exec python cvsAdd.py {} \;


in cvsAdd.py, put the following:

import sys, pexpect, getpass

PASS='myPass'

def cvsAdd(fname):
    global PASS
    if not PASS:
        PASS = getpass.getpass()
    
    child = pexpect.spawn('cvs add "%s"' % fname)
    child.expect("me@my-cvs-host password:")
    child.sendline(PASS)

    for line in child:
        print line

cvsAdd(sys.argv[1])

You need to create an account or log in to post comments to this site.


Click here to browse all 5137 code snippets

Related Posts