A tiny script to change the Root of a CVS working copy.

#!/usr/bin/python
                                                                                
import os
import os.path
import sys
                                                                                
def usage(status):
    print "Usage: cvs-chroot [new-cvs-root]"
    sys.exit(status)
                                                                                
def chroot(newroot, dir, files):
        (path, currdir) = os.path.split(dir)
        if currdir == "CVS":
            root_file = os.path.join(dir, "Root")
            print "Modifying " + root_file
            try:
                f = open(root_file, "w")
                f.write(newroot + "\n")
                f.close()
            except IOError, msg:
                print msg
                                                                                
if len(sys.argv) != 2:
    print usage(1)
                                                                                
newroot = sys.argv[1]
os.path.walk(".", chroot, newroot)
sys.exit(0)
 
cvs-chroot-py.txt · Last modified: 2005/07/29 03:46 by vijaykumar
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
This work is licensed under the GNU Free Documentation License..