- # IronPython and P4.Net
- import clr
- from System import Array, String
- clr.AddReferenceToFile('P4API.dll')
- import P4API
- p4 = P4API.P4Connection()
- p4.Connect()
- lname = 'P4NetTestingSample'
- # build my label
- labelForm = p4.Fetch_Form('label', lname)
- labelForm['Description'] = 'Created for P4.Net sample'
- view = Array[String](['//guest/shawn_hladky/...'])
- labelForm.ArrayFields['View'] = view
- res = p4.Save_Form(labelForm)
- if res.HasErrors():
- for e in res.Errors: print e
- # My list of changes. This is totally arbitrary
- changes=['5774', '5680', '5636', '5444']
- sorted_changes = changes.sort()
- # dictionary: keyed by file, value = revision
- filerevs = {}
- # spin the description on each file
- for chg in p4.Run('describe', '-s', *changes):
- depotFiles = chg.ArrayFields['depotFile']
- revisions = chg.ArrayFields['rev']
- for i in range(0, len(depotFiles)):
- key,value = depotFiles[i], revisions[i]
- filerevs[key]=value
- # convert the dictionary to a list
- flist = []
- for k,v in filerevs.items():
- flist.append("%s#%s" % (k,v))
- out = p4.RunUnParsed('labelsync', '-l', lname, *flist)
- for s in out: print s
- # delete the label to keep the public depot clean :-)
- p4.RunUnParsed('label', '-d', lname)
- p4.Disconnect()
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 7889 | Johan Nilsson | Branch from Shawn Hladky's original P4.Net (main branch). Changed file type for StandardT...est.cs and UnicodeTest.cs in order to be able to check them in. « |
14 years ago | |
//guest/shawn_hladky/P4.Net/main/doc/pythonsample/ironpyton.py | |||||
#1 | 5830 | Shawn Hladky | P4.Net: reorg to support release branches | 18 years ago | |
//guest/shawn_hladky/P4.Net/doc/pythonsample/ironpyton.py | |||||
#1 | 5799 | Shawn Hladky | p4.net missing doc files | 18 years ago |