Changeman version manager workstation 8.1 command line quick check in/out

Source: Internet
Author: User
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 :\
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.aaaex.asmpt.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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.