Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
858 B

  1. import sys, re, os
  2. if len( sys.argv ) < 3:
  3. print 'p4sizes.py shows the size of the last N revisions of a file in Perforce'
  4. print 'usage: p4sizes.py filename N'
  5. print 'ex : p4size.py //valvegames/rel/hl2/game/bin/engine.dll 10'
  6. print ' (shows the sizes of the last 10 checkins to engine.dll)'
  7. sys.exit( 1 )
  8. filename = sys.argv[1]
  9. nRevisions = sys.argv[2]
  10. # Get the revisions list.
  11. f = os.popen( 'p4 changes -m %s %s' % (nRevisions, filename) )
  12. str = f.read()
  13. f.close()
  14. changelistNumbers = []
  15. myRE = re.compile( r'change (?P<num>\d+?) on (?P<date>.+?) ', re.IGNORECASE )
  16. while 1:
  17. m = myRE.search( str )
  18. if m:
  19. str = str[m.end():]
  20. changelistNumbers.append( [m.group('num'), m.group('date')] )
  21. else:
  22. break
  23. for x in changelistNumbers:
  24. sys.stdout.write( x[1] + ': ' )
  25. cmd = 'p4 sizes %s@%s' % (filename, x[1])
  26. os.system( cmd )