# 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 | 7341 | Erik Purins |
p4.net --- pull p4.net#head |
||
//guest/shawn_hladky/P4.Net/release/1.0/doc/pythonsample/ironpyton.py | |||||
#1 | 6106 | Shawn Hladky | P4.Net: Branching release 1.0 | ||
//guest/shawn_hladky/P4.Net/main/doc/pythonsample/ironpyton.py | |||||
#1 | 5830 | Shawn Hladky | P4.Net: reorg to support release branches | ||
//guest/shawn_hladky/P4.Net/doc/pythonsample/ironpyton.py | |||||
#1 | 5799 | Shawn Hladky | p4.net missing doc files |