summaryrefslogtreecommitdiff
path: root/devtools/p4EditChangelist.py
blob: a640908b1ddf08c859d098c78a755b60b09d735f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import sys
import os
import re



def PrintUsage():
	print "p4EditChangelist.py [changelist #]"
	print "    - Checks out all the files in the specified changelist."


if len( sys.argv ) < 2:
	PrintUsage()
	sys.exit( 1 )


sChangelist = sys.argv[1]
f = os.popen2( 'p4 describe -s %s' % sChangelist )
allText = f[1].read()
#f.close()
#print allText
	
# Now match an RE to get each filename.
testRE = re.compile( r'\.\.\. (?P<fn>//.+)#\d+ ', re.IGNORECASE )
startPos = 0
while 1:
	m = testRE.search( allText, startPos )
	if not m:
		break
		
	filename = m.group('fn')
	startPos = m.end()

	os.system( 'p4 edit "%s"' % filename )