Changeman version manager workstation 8.1 command line quick check inout
import os,sys,datetime
file_in = sys.argv[1]
Mode = {}
Mode[1] = “Get”
Mode[2] = “Check out”
Mode[3] = “Check in”
mode = raw_input(Mode)
mode = int(mode)
if mode<1 or mode>3:
print “Invalid mode:”, mode
exit(0)
versionLabel = raw_input(“\n\nInput version label:[Latest Version for get, and Null for put]”)
if len(versionLabel)==0:
if mode == 1 or mode == 2:
versionLabel = “Latest Version”
description = “[Enhancement]%s[Compatiblilty]Link”%(raw_input(“\n\npls input description:”))
print
print
print “mode:”, Mode[mode]
print “versionLabel:”, versionLabel
print “description:”, description
os.system(“pause”)
dst_folder = “pvcsGet“+file_in+”“+datetime.datetime.now().strftime(‘%Y%m_%d_%H_%M_%S’)
fp = open(file_in,’r’)
lines = fp.readlines()
fp.close()
fileNum = 1
for line in lines:
src=line.replace(‘\r’,’’).replace(‘\n’,’’).strip() #delete \r\n
if len(src) == 0 : continue #skip empty line
if src[0] in [’#’, ‘;’]: continue #skip comment
dst=src
p = src.find(‘:’) #delete x:<br /> if p>=0:
dst=dst[p+2::]
else:
dst = src
while dst[0]==’\’: dst=dst[1::]
src = dst.replace(‘\’,’/’)
dst = dst_folder + ‘\’ + dst
#make folder
if False:
dstFdr = dst[:dst.rfind(‘\’):]
if not os.path.isdir(dstFdr):
cmd = ‘mkdir “%s”’ %dstFdr
os.system(cmd)
#get source
exe = r”\aaants240.aaatest.com\SerenaClnt\vm\win32\bin\pcli “
userPwd = r’ -pr”\vis\eagleapp” -id”USR:PWD” ‘
if mode==1: #get
cmd= exe + r’ Get ‘ + userPwd + r’ -v”%s” -a”%s” -z /Diebond/%s’%(versionLabel,dst, src)
elif mode==2: #check out
cmd= exe + r’ Get ‘ + userPwd + r’ -v”%s” -l -a”%s” -z /Diebond/%s’%(versionLabel,dst, src)
elif mode==3: #put, Use default source path
if len(versionLabel)>0:
cmd= exe + r’ Put ‘ + userPwd + r’ -v”%s” -m”%s” -z /Diebond/%s’%(versionLabel, description, src)
else:
cmd= exe + r’ Put ‘ + userPwd + r’ -m”%s” -z /Diebond/%s’%(description, src)
status = os.system(cmd)
print ‘**‘,fileNum , status#, src, dst
if status!=0:
os.system(“pause”)
fileNum += 1
- 上一篇 Testprintseq
- 下一篇 Python for symbian6