#!/usr/bin/python # # """A P4Python script that splits the verify process over the root directories of each depot $Id: //depot/python/SplitVerify.py#1 $ #******************************************************************************* # Copyright (c) 2009, Perforce Software, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #******************************************************************************* """ from __future__ import with_statement import P4 import sys p4 = P4.P4() p4.prog = "SplitVerify.py" p4.api_level = 63 # assumes that the P4 enviroment is set correctly via environment variables or P4CONFIG # otherwise, set the P4 environment here # p4.port = "server:1666" # p4.user = "super user" def main( file ): try: p4.connect() dirs = p4.run_dirs("//*/*") result = [] for d in dirs: pattern = d['dir'] + "/..." print "Verifying %s" % pattern result += ( p4.run_verify("-q", pattern)) if len(result) > 0: print >> file, "Verify reported errors:" for r in result: print >> file, r p4.disconnect() except P4Exception, err: print >> file, err if __name__ == "__main__": if len( sys.argv ) > 1: with open(sys.argv[1], "w") as filename: main(filename) else: main(sys.stdout)
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 7429 | Gabor Maghera | Integrating P4Pythonlib into my user area. | ||
//guest/sven_erik_knop/P4Pythonlib/scripts/SplitVerify.py | |||||
#3 | 7372 | Sven Erik Knop |
Rollback Rename/move file(s). To folder "perforce" is needed. |
||
#2 | 7370 | Sven Erik Knop | Rename/move file(s) again - this time to the right location inside a perforce directory. | ||
#1 | 7368 | Sven Erik Knop | Moved scripts to new P4Python lib directory. | ||
//guest/sven_erik_knop/perforce/P4Pythonlib/scripts/SplitVerify.py | |||||
#1 | 7370 | Sven Erik Knop | Rename/move file(s) again - this time to the right location inside a perforce directory. | ||
//guest/sven_erik_knop/P4Pythonlib/scripts/SplitVerify.py | |||||
#1 | 7368 | Sven Erik Knop | Moved scripts to new P4Python lib directory. | ||
//guest/sven_erik_knop/scripts/SplitVerify.py | |||||
#1 | 7118 | Sven Erik Knop |
Added ScriptVerify.py, a simple Python script that trails through the top level directory of each depot and verifies all files in that directory. This prevents the server from running out of memory. |