#!/usr/bin/env python import os, ansi __doc__ = ''' Usage: Just type 'cvsstat' in a CVS directory. Color codes which files aren't in the repository and any files that have been changed. Needs the ansi package (http://py.vaults.ca/apyllo.py?i=49314128) ''' __author__ = 'David McClosky ' __version__ = 1.0 def colorize(line, color): print color + line[:-1] + ansi.RESET # cvs_out is really out+err cvs_in, cvs_out = os.popen4('cvs status', 'r') for l in cvs_out.readlines(): if l[0] == '?': colorize(l, ansi.REDBG) if l.find('Status') > 0: if l.find('Up-to-date') < 0: if l.find('Locally Added') > 0: colorize(l, ansi.BLUE) elif l.find('Locally Removed') > 0: colorize(l, ansi.YELLOW) else: colorize(l, ansi.RED) else: print l[:-1] if l.startswith('cvs server'): colorize(l, ansi.GREEN)