[Cvsshell-devel] CVS: cvsshell/src entry_parser.py,NONE,1.1
Status: Beta
Brought to you by:
stefanheimann
From: Stefan H. <ste...@us...> - 2002-07-27 15:34:15
|
Update of /cvsroot/cvsshell/cvsshell/src In directory usw-pr-cvs1:/tmp/cvs-serv12224/src Added Files: entry_parser.py Log Message: just a try... --- NEW FILE: entry_parser.py --- import sys, re, os, stat dirname = os.path.dirname from time import * lineRe = re.compile(r'(?P<isdir>D?)/(?P<name>[^/]*)/(?P<revision>[^/]*)/(?P<mtime>[^/]*)//') def parse(filename): dir = dirname(dirname(filename)) f = open(filename) for line in f.readlines(): result = lineRe.match(line) if not result: continue if result.group('isdir'): print 'directory:', result.group('name') else: name = result.group('name') revision = result.group('revision') repTime = mktime(strptime(result.group('mtime'))) localTime = mktime(gmtime(os.stat(os.path.join(dir, name))[stat.ST_MTIME])) # this is bit dirty if repTime == localTime: print name, 'with revision', revision, 'was NOT modified.' else: print name, 'with revision', revision, 'was modified.' if __name__ == '__main__': if len(sys.argv) < 2: print 'error' sys.exit(1) parse(sys.argv[1]) |