DZone 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

Snippets has posted 5883 posts at DZone. View Full User Profile

Automatic CVS Add

08.30.2005
| 4475 views |
  • submit to reddit
        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])