diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /devtools/p4sizes.py | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'devtools/p4sizes.py')
| -rw-r--r-- | devtools/p4sizes.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/devtools/p4sizes.py b/devtools/p4sizes.py new file mode 100644 index 0000000..7e7a5ab --- /dev/null +++ b/devtools/p4sizes.py @@ -0,0 +1,37 @@ + +import sys, re, os + + +if len( sys.argv ) < 3: + print 'p4sizes.py shows the size of the last N revisions of a file in Perforce' + print 'usage: p4sizes.py filename N' + print 'ex : p4size.py //valvegames/rel/hl2/game/bin/engine.dll 10' + print ' (shows the sizes of the last 10 checkins to engine.dll)' + sys.exit( 1 ) + +filename = sys.argv[1] +nRevisions = sys.argv[2] + + +# Get the revisions list. +f = os.popen( 'p4 changes -m %s %s' % (nRevisions, filename) ) +str = f.read() +f.close() + + +changelistNumbers = [] +myRE = re.compile( r'change (?P<num>\d+?) on (?P<date>.+?) ', re.IGNORECASE ) +while 1: + m = myRE.search( str ) + if m: + str = str[m.end():] + changelistNumbers.append( [m.group('num'), m.group('date')] ) + else: + break + +for x in changelistNumbers: + sys.stdout.write( x[1] + ': ' ) + cmd = 'p4 sizes %s@%s' % (filename, x[1]) + os.system( cmd ) + + |