# Task: compare client specs to users, and flag the # client specs owned by users that don't exist anymore. from readp4marshal import runp4cmd # num of calls to 'p4': 2 # status: tested on Darwin Mac OS X using Python 2.3 # room for optimization/improvement: add getopts call # # Copyright 2004 Perforce Corporation, Inc. All rights reserved. # #----------------------------------------------------------- # first call to P4: 'p4 users' #----------------------------------------------------------- userList = runp4cmd("p4 -G users") userHash = {} for u in userList: userName = u['User'] userHash[userName] = u #----------------------------------------------------------- # second call to P4: 'p4 clients' #----------------------------------------------------------- clientList = runp4cmd("p4 -G clients") print "List of clients:" for c in clientList: [clientName,clientOwner] = [c['client'], c['Owner']] if userHash.has_key(clientOwner): print "%s owned by %s OK" % (clientName, clientOwner) else: print "%s owned by %s ** unknown user **" % (clientName, clientOwner)