PVCS vs. PCLI

Since my company has a lot of machine models which run different versions of our software. In my department, we use Senrena's PVCS Version Manager to keep track of the source code. PVCS has a GUI for us to use, which is quite convenient for others already, but not for me. Basically what we have to do is input the version label a couple times and check a lot of boxes. Since we have to get the code from 2 project bases, so we have to do everything twice. What if I can default all these stuff and only enter the necessary inputs once?

Actually PVCS has a command line interface called PCLI. So I skimmed the manual and quickly rough out a small batch file than can shorten the steps. Here's a comparison between how my colleagues and I get the code:

Colleagues:

  1. Input username and password for the project code base, say "\\first\code\base"
  2. Navigate to the folder in the base, say "diebond"
  3. Right Click the folder and choose Assign Label
  4. Input the new label and the version label you wanna assign on
  5. Check the box "Include files in sub-projects"
  6. Right click the folder again, choose Get
  7. Input the directory you wanna copy the code to in the new dialog
  8. Check the box "Copy out using project hierarchy instead of workfile location(s)" 
  9. Input the new version label you just assigned
  10. Check the box "Make the files writable"
  11. Check the box "Include files in subprojects"
  12. Click OK to close the dialog and let PVCS get the code
  13. Repeat above steps for second code base


Me:

  1. Input username and password
  2. Input 1 to assign label
  3. Input the new label and the version label you wanna assign on
  4. Input 3 to get code
  5. Input the version label
  6. Input the directory you wanna copy the code to
  7. Done


The batch file is still a bit rough, but it already shortens the whole procedure by at least a quarter, I just don't know why they still insist on using that approach, so I'm the only one using it.

Here is the code:



1:  @echo off  
2:    
3:  cls  
4:    
5:  set /p usrname=Enter Username:   
6:  rem echo %usrname%  
7:    
8:  set /p pw=Enter password:   
9:  rem echo %pw%  
10:    
11:  :WhileLoopStart  
12:  echo ===================================================  
13:  echo Menu:  
14:  echo 1. Assign Label  
15:  echo 2. Delete Label  
16:  echo 3. Get Code  
17:  echo 4. Lock File  
18:  echo 5. Unlock File  
19:  echo 6. Check in File (Not supported yet)  
20:  echo 999. Exit  
21:  echo ===================================================  
22:    
23:  set /p choice=Enter your choice:   
24:  echo %choice%  
25:    
26:  if %choice%==1 goto AssignLabel  
27:    
28:  if %choice%==2 goto DeleteLabel  
29:    
30:  if %choice%==3 goto GetCode  
31:    
32:  if %choice%==4 goto LockFile  
33:    
34:  if %choice%==5 goto UnlockFile  
35:    
36:  if %Choice%==999 goto Exit  
37:    
38:    
39:  :AssignLabel  
40:  echo Assign Label  
41:  set /p DesiredLabel=Enter Desired Label:   
42:  set /p NewLabel=Enter New Label:   
43:  pcli label -pr"\\FIRST\CODEBASE" -pp"/Diebond" -id"%usrname%:%pw%" -v"%NewLabel%" -r"%DesiredLabel%" -z  
44:  pcli label -pr"\\SECOND\CODEBASE" -pp"/Diebond" -id"%usrname%:%pw%" -v"%NewLabel%" -r"%DesiredLabel%" -z  
45:  goto WhileLoopStart  
46:    
47:  :DeleteLabel  
48:  set /p ByeByeLabel=Enter Label:   
49:  pcli deletelabel -pr"\\FIRST\CODEBASE" -pp"/Diebond" -id"%usrname%:%pw%" -v"%ByeByeLabel%" -z  
50:  pcli deletelabel -pr"\\SECOND\CODEBASE" -pp"/Diebond" -id"%usrname%:%pw%" -v"%ByeByeLabel%" -z  
51:  goto WhileLoopStart  
52:    
53:  :GetCode  
54:  set /p DesiredLabel=Enter Label:   
55:  set /p DesiredPath=Enter Desired Path:   
56:  pcli get -id"%usrname%:%pw%" -pr"\\FIRST\CODEBASE" -a"%DesiredPath%" -o -v"%DesiredLabel%" -w -z -bp/ "/Diebond"  
57:  pcli get -id"%usrname%:%pw%" -pr"\\SECOND\CODEBASE" -a"%DesiredPath%" -o -v"%DesiredLabel%" -w -z -bp/ "/Diebond"  
58:  goto WhileLoopStart  
59:    
60:  :LockFile  
61:  set/p DesiredArchive=Which Archive? (0=\\FIRST\CODEBASE, 1=\\SECOND\CODEBASE)   
62:  set/p DesiredPath=Enter Path of file:  
63:  set/p DesiredFile=Enter Filename:  
64:  set/p DesiredLabel=Enter Label:  
65:  set/p IsBranch=Branch or not(y=Yes, n=No):  
66:  if %DesiredArchive%==1 goto OtherStep1  
67:  pcli lock -pr"\\FIRST\CODEBASE" -pp"/Diebond/%DesiredPath%" -r"%DesiredLabel%" -%IsBranch%b -z %DesiredFile%   
68:  :OtherStep1  
69:  pcli lock -pr"\\SECOND\CODEBASE" -pp"/Diebond/%DesiredPath%" -r"%DesiredLabel%" -%IsBranch%b -z %DesiredFile%   
70:  goto WhileLoopStart  
71:    
72:    
73:    
74:  :UnlockFile  
75:  set/p DesiredArchive=Which Archive? (0=\\FIRST\CODEBASE, 1=\\SECOND\CODEBASE)   
76:  set/p DesiredPath=Enter Path of file:  
77:  set/p DesiredFile=Enter Filename:  
78:  set/p DesiredLabel=Enter Label:  
79:  if %DesiredArchive%==1 goto OtherStep2  
80:  pcli unlock -pr"\\FIRST\CODEBASE" -pp"/Diebond/%DesiredPath%" -r"%DesiredLabel" -z %DesiredFile%  
81:  :OtherStep2  
82:  pcli unlock -pr"\\SECOND\CODEBASE" -pp"/Diebond/%DesiredPath%" -r"%DesiredLabel" -z %DesiredFile%  
83:  goto WhileLoopStart  
84:    
85:  :Exit  
86:  echo End.  
It's just that simple! To get it running, you have to copy a shortcut of pcli.exe to the same directory as that batch file's.

Kev
PVCS vs. PCLI PVCS vs. PCLI Reviewed by Kevin Lai on 9:08:00 PM Rating: 5

No comments:

Powered by Blogger.