#!/p4/common/python/bin/python3 import sys import re from P4 import P4, P4Exception p4 = P4() p4.user='bruno' p4.port='8223' p4.client='bruno_jam.test_cbd.ugnldptperforce01' p4.connect() import P4 #cspec = p4.fetch_client('bruno_jam.test_cbd.ugnldptperforce01') #cspec = p4.fetch_client('bruno_ws') cspec = p4.fetch_client('earl_jams') for f in cspec['View']: print("View Entry = %s" % f) map = P4.Map() for f in cspec['View']: map.insert(f) print ("Map = %s" % map) rootDir = re.sub (r'\\', r'/', cspec['Root']) root = P4.Map() for f in cspec['View']: tmpMap = P4.Map() tmpMap.insert(f) tmpL = tmpMap.lhs()[0] tmpR = tmpMap.rhs()[0] tmpR2 = re.sub ('//.*?/', rootDir + '/', tmpR) print ("L=[%s]\nR=[%s]\nR2=[%s]\n" % (tmpL, tmpR, tmpR2)) root.insert (tmpR, tmpR2) local_map = P4.Map.join (map, root) depotPath = '//jam/rel2.1/src/command.c' localPath = local_map.translate(depotPath) print ("D = %s\nL = %s\n" % (depotPath, localPath)) localPath = 'c:/p4/CT/pb/somewhere/under/here/command.c' depotPath = local_map.translate(localPath, 0) print ("D = %s\nL = %s\n" % (depotPath, localPath))
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 22191 | C. Thomas Tyler | Copy Up using 'p4 copy -r -b perforce_software-cbd-dev'. | ||
//guest/perforce_software/cbd/dev/scraps/map_fun.py | |||||
#1 | 21806 | C. Thomas Tyler |
Moved non-essential R&D and sample scripts to a scraps directory to keep them separate from components of the real system. |
||
//guest/perforce_software/cbd/dev/scripts/map_fun.py | |||||
#2 | 19253 | C. Thomas Tyler | Routine merge-down from main to dev. | ||
#1 | 15275 | C. Thomas Tyler | Added R&D script for playing with P4.Map(). |