Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """\
- Modify CVSROOT recursively.
- Usage:
- %s <new CVSROOT> <top directory>
- """
- import os, sys
- __author__ = 'Gabriel Genellina'
- CVSROOT=''
- def changeCVSROOT(basepath):
- path = os.path.join(basepath, 'CVS', 'Root')
- if os.access(path, os.W_OK):
- print basepath
- open(path, 'wt').write('%s\n' % CVSROOT)
- for dir in os.listdir(basepath):
- path = os.path.join(basepath, dir)
- if dir!='CVS' and os.path.isdir(path):
- changeCVSROOT(path)
- if __name__=='__main__':
- if len(sys.argv)==3:
- CVSROOT, basepath = sys.argv[1:]
- print 'Change CVSROOT -> %s starting from %s' % (CVSROOT, basepath)
- changeCVSROOT(basepath)
- else:
- print __doc__ % os.path.basename(sys.argv[0])
- CVSROOT = raw_input('New CVSROOT: ')
- if CVSROOT:
- basepath = raw_input('Starting from: ')
- if basepath:
- print 'Change CVSROOT -> %s starting from %s' % (CVSROOT, basepath)
- changeCVSROOT(basepath)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement