# Task: determine which client specs use compression. # # num of calls to 'p4': 1 # status: tested on Win/2000 using P4Ruby API, # tested on Darwin Mac OS X using P4Ruby API # room for optimization/improvement: add getopts call # # Copyright 2004 Perforce Corporation, Inc. All rights reserved. require "P4" p4 = P4.new # p4.port = "localhost:1666" p4.user = "arthur" p4.client = "dent.development" p4.tagged p4.parse_forms p4.connect begin #----------------------------------------------------------- # only call to P4: 'p4 clients' #----------------------------------------------------------- clientList = p4.run_clients clientList.each { |c| optionList = c['Options'] if optionList =~ /nocompress/ puts "#{c['client']}: *no* compression of data" else puts "#{c['client']}: compression of data (default)" end } rescue P4Exception p4.errors.each { |e| $stderr.puts( e ) } raise end p4.disconnect
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 4312 | Jeff Bowles |
Adding a number of example scripts that show how to get to Perforce data for a variety of scripting languages and variety of simple tasks. Note that Perl/Python/Ruby (and variants) are included, but shell/batch/DCL/applescript are not. (Am trying to stick with somewhat-portable approaches, to make comparisons easier.) Each program is written in the following languages/configurations: 1. Perl, calling "p4 -Ztag" for data 2. Perl, calling Tony Smith's "P4Perl" module 3. Python, calling "p4 -G" for data 4. Ruby, calling "p4 -R" for data 5. Ruby, calling Tony Smith's "P4Ruby" module The programs do the following: a. compare client specs to users (find old clients) b. compare two labels c. determine which client specs use compression. d. determine which files need to be "p4 add'ed." e. output list of 'opened' files, using local pathnames. |