README.html #5

  • //
  • guest/
  • perforce_software/
  • utils/
  • vsstop4/
  • 2006-06-special-chars/
  • README.html
  • View
  • Commits
  • Open Download .zip Download (20 KB)
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>VSSToP4 - Conversion Script Readme</title>
</head>

<body>

<h1>Microsoft Visual SourceSafe (VSS) to Perforce converter</h1>
<h2>Summary</h2>
<p>Please read this whole document through carefully and install and setup 
configuration files carefully.</p>
<p>Then test with a test Perforce repository (<b>do not start importing into 
your live Perforce repository!!</b>). Note that an unlicensed Perforce test 
server is fine for this.</p>
<p>Only when you have a working version should you consider re-running with your 
live repository... Apart from anything else, at this point you know it will work 
and also you will have a rough idea of how long it will take.</p>
<p>Recommended practice is to import into an area of your repository such as:
</p>
<blockquote>
	<p>//depot/import/vss/projectA/... </p>
</blockquote>
<p>and then branch afterwards into your new structure for use in Perforce, e.g.
</p>
<blockquote>
	<p>//depot/main/projectA/... </p>
</blockquote>
<p>This gives you all the history (if you follow back branching history) and 
allows
you to restructure things and get a better structure than perhaps you were 
forced to
use in VSS (you can branch different projects to different levels). </p>
<p><b><font size="5">Contents</font></b></p>
<ul>
	<li><a href="#requirements">Requirements</a></li>
	<li><a href="#running">Running the Conversion</a></li>
	<li><a href="#vss_corruptions">VSS Corruptions</a></li>
	<li><a href="#troubleshooting">Troubleshooting</a></li>
	<li><a href="#performance">Improving Performance</a></li>
	<li><a href="#differences">Differences between VSS and Perforce</a></li>
	<li><a href="#restrictions">Restrictions and limitations</a></li>
	<li><a href="#how_it_works">How does the converter work?</a></li>
	<li><a href="#check_result">How do I check the end result, and what does it all mean?</a></li>
	<li><a href="#rerunning">Re-running the converter</a></li>
</ul>
<h2><a name="requirements"></a>Requirements</h2>
<ul>
	<li>Obtain and install a version of Perl for your machine. This script 
	assumes you are running on Windows (as it reads registry settings for date and time). You can download a precompiled binary from
	<a href="http://www.activestate.com/">http://www.activestate.com/</a> . Note 
	that this script has been mostly tested with Perl 5.6. One recent customer 
	tried using Perl 5.8 and had problems which went away when he went back to 
	5.6. We never did find out quite why - life is too short sometimes...</li>
	<li>Install P4Perl from
	<a href="http://public.perforce.com//guest/tony_smith/perforce/API/Perl/index.html">http://public.perforce.com//guest/tony_smith/perforce/API/Perl/index.html</a> 
	. This is the Perl interface to Perforce and is required because it is 
	significantly faster than executing p4.exe at the command line. </li>
</ul>
<blockquote>
	<p>The following versions of P4Perl are required for the current 
	release of these scripts (version number is hard-coded and checked in module utils.pm). This readme will be updated when later versions 
	are tested and known to work. <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<a href="http://public.perforce.com/guest/tony_smith/perforce/API/Perl/released/p4perl56-setup-3.5708.exe">p4perl56-setup.exe</a>&nbsp;
	or&nbsp;
	<a href="http://public.perforce.com/guest/tony_smith/perforce/API/Perl/released/p4perl58-setup-3.5708.exe">p4perl58-setup.exe</a><br>depending on your Perl version.&nbsp; 
	</p>
	<p>Just double-click on Windows installer and run it (no real need to download 

and save). 

</blockquote>
</p>
<ul>
	<li>You must use Visual SourceSafe version 5.0 or 6.0 - <b>note that VSS 
	2005 is not currently supported.</b> VSS 6.0 and 2005 both share the same 
	archive format, so please install the earlier version (2005 has been used by 
	some people successfully but not reliably - for now don't waste your time). 
	If you have 2005 you can install 6.0 in parallel - just make sure the 
	correct version is found in the path - see next point.</li>
	<li>Ensure both Perforce's &quot;p4&quot; and SourceSafe's &quot;SS&quot; command can execute 
correctly.<br>Add the directory containing SS.EXE to your path, then try running &quot;ss 
	about -Y&lt;user&gt;,&lt;password&gt;&quot;.<br>(see setenv.bat for example setting 
	of environment) 
	</li>
	<li>Test Perforce by running &quot;p4 info&quot;. The Perforce depot can be empty or not.<br>The Perforce server need not run on the same machine you are running
the converter on, however it may be wise to do so to avoid network
traffic. <br>
	Accessing the VSS repository over a slowish network will definitely
slow things down - <b>SEE IF YOU CAN COPY VSS REPOSITORY LOCALLY FOR CONVERSION</b>. 
	</li>
</ul>
<h2><a name="running"></a>Running the Conversion</h2>
<ul>
	<li>Unzip the converter vsstop4.zip on a disk large enough to hold all files
stored in VSS, plus the space required for the &quot;metadata&quot;.<br>The directory you put the converter in must not be under the Perforce
server root!<br>I strongly advise not having spaces in the path (use 
	&quot;c:\work\vsstop4&quot; rather than &quot;c:\work\some path to vss\&quot; for example).</li>
	<li>If you do not configure (in config.ini) a Perforce user that has 
	superuser rights in your depot then you will get error messages since the 
	script tries to update date/time and username in changelists and labels - 
	this action is limited to superusers. </li>
	<li>Change directory to the directory the converter was installed into and
edit the file &quot;config.ini&quot; to setup for your environment.<br>Please note that you can specify the name of this file by setting a DOS 
Environment variable: VSSTOP4_CONFIG <br>
	(Default assumes &quot;config.ini&quot;)
	<p>You <b>must</b> fill in at least the following values in config.ini:<ul>
	<li>root</li>
	<li>p4port/p4client/p4user</li>
	<li>depot/depot_root</li>
	<li>vss_user</li>
	<li>vss_password</li>
</ul>
	<p>Other values are more optional but please read through the file carefully 
	and make sensible choices!&nbsp;</li>
	<li>Make sure that you do not have a client workspace called &quot;vss&quot; or whatever 
you specified
as p4client in config.ini since it will be overwritten by the script. Make sure 
	your Perforce user exists.</li>
	<li>Then run &quot;perl convert.pl&quot; (note Performance tips below before doing this). 
	</li>
	<li>Examine sumlogfile.log for summary info and logfile.log for gory detalis</li>
</ul>
<h2><a name="vss_corruptions"></a>VSS Corruptions</h2>
<p>Note that many sites have reported failures mid-way through conversions
due to corruption in the SourceSafe database. The only way around this used to 
be to determine what files SourceSafe has corrupted and fix them somehow (by 
running analyze.exe with -f flag).</p>
<p>You can now use the &quot;exclude&quot; option in Config.ini file to ignore some 
directories
if that makes your life easier, especially if used in conjunction with the 
&quot;vsscorrupt&quot;
flag. </p>
<p>You can also use the &quot;skip_ss_get_errors&quot; option to ignore failures to get 
individual files.</p>
<p>In addition, please note that different versions of VSS are more reliable in 
some circumstances. Thus I have had a problem getting a file using VSS 6.0d and 
yet and older version (6.0c or even 6.0) gets the file without problems. This is 
one of the reasons VSS is so unreliable - they couldn't make changes without 
introducing bugs. Hence, you may find it worth while trying an older version. 
(Also please note there are more than one version of 6.0d!).</p>
<h2><a name="troubleshooting"></a>Troubleshooting</h2>
<p>There are a number of scenarios that work-arounds have been found for. 
However, this is somewhat of a black art, and VSS is rather fragile so there are 
occasions when you just have to accept the corruptions and leave those files 
behind. If you have a support contract or MSDN support calls with Microsoft then 
it may be worth while asking for help.</p>
<p>If you get an error message:</p>
<pre>Project $Some_project has been destroyed, and cannot be rebuilt. 
Continue anyway?(Y/N) N </pre>
<p>then try setting ss_options in config.ini to include &quot;-I-Y&quot; rather than just 
&quot;-I-&quot;. This will ignore the error and carry on. (As mentioned above 
6.0d seems particularly susceptibel to this problem - older versions often don't 
give this error message).</p>
<p>If you get an error message: </p>
<pre>***** Failed to run command: perl mkdepot.pl </pre>
<p>Then: </p>
<p>Look in logfile.log for the last command executed. Try and run the 
same command from the command
line. Note that the flag &quot;-vN&quot; is the version that is trying to be extracted. It 
is also worth trying
to get this version out using the VSS GUI. Also make sure that analyze.exe runs 
without errors. In the
worst case you may need to ignore that particular file (or version). </p>
<p>If you get an error message:</p>
<pre>ERROR: VSS file not found: $/some/path/somefile.ext#2
get_vss_file() revision 2 to D:/vsstop4/data/main/depot/some/path/somefile.ext
 failed at mkdepot.pl line XXX, <CHANGES> line NNN.
</pre>
<p>Then try the following:</p>
<ul>
	<li>Find the &quot;get command&quot; at the end of logfile.log and execute it yourself 
	from the command line and see if that works. </li>
<li>If not, try getting the same version of the same file using the VSS GUI. 
Otherwise, google the error message and see if that helps.</li>
	<li>If the GUI works (and command line doesn't), then one option may be to 
	revert to using VSS 6.0c rather than 6.0d - this has fixed the problem for 
	some people.</li>
</ul>
<p>Note that setting the flag &quot;skip_ss_get_errors&quot; to &quot;yes&quot; in the 
config.ini file 
might work to get around a particular error.</p>
<p>You can contact the curator if the above doesn't help, but be warned that 
some VSS repositories are
corrupted in a way that certain files are not retrievable... </p>
<p>If contacting the curator, please send sumlogfile.log and the end of 
logfile.log.</p>
<h2><a name="performance"></a>Improving Performance</h2>
<p>The script can take a long time (many hours) to run if you have a large VSS 
repository. The
script needs to parse the history of VSS and then get individual versions of 
each file out
and check them in to Perforce. This by its nature takes time (and driving VSS 
from the command
line is slow).</p>
<p>To ensure the fastest possible conversion: </p>
<ul>
	<li>Copy VSS repository locally (and use a fast machine! - some machines can 
take 50% less time than others) </li>
	<li>Try setting the config.ini option &quot;vss_use_ole&quot; to yes - this uses VSS OLE 
Automation instead
of ss.exe from the command line. It can be faster (but not always). Note that 
this requires the
full VSS to be installed locally, and in particular the OLE interface which is 
usually to be found
in &quot;C:\Program Files\Microsoft Visual Studio\Common\VSS\win32\SSAPI.DLL&quot; to be 
installed and
registered.<br>
	<br>****WARNING****: if you get OLE Exceptions using this option (e.g. it can be 
more sensitive to VSS repository
corruptions than &quot;ss get&quot;), then just turn this option off.<br>
	</li>
</ul>
<p>It is highly recommended, that you read the following before
attempting to do the conversion.<br>
</p>
<h2><a name="differences"></a>Differences between VSS and Perforce</h2>
<p>VSS defines a hierarchy of files using the concept of a &quot;project&quot;,
which is essentially just a versioned directory. The current<br>
project must be set specifically before any VSS operation. The
information stored by VSS is stored in a proprietary format. </p>
<p>Perforce stores an arbitrary tree of files which can be mapped to
multiple clients independently using any 1:1 mapping. Perforce<br>
uses RCS format files to store revisions, but all metadata
is stored in a single, central database. </p>
<p>Perforce uses the notion of an atomic change which may consist of many
add, edit, and/or delete operations. It is guaranteed that either all<br>
of a change is visible, or none of it is. VSS does not provide atomic
change transactions.</p>
<p>VSS implements branching by &quot;sharing&quot; files among projects, then &quot;branching&quot;
them by breaking this link. There is no record of merging activity. </p>
<p>In Perforce when you wish to create a &quot;branch&quot;, you simply copy the files,
typically to another directory. The recommended convention<br>
is to make the second component of the depot pathname
the branchname. Thus, when it is time for the main line of development<br>
to be released as v7, you would typically do a
&quot;p4 integrate //depot/main/... //depot/v7/...&quot;
which (since there aren't any files in //depot/v7 currently) would create
copies of all files in //depot/main in //depot/v7. To refer to the mainline
version of foo.c use //depot/main/foo.c; for the v7 branched copy, use
//depot/v7/foo.c </p>
<p>This works well because Perforce implements a lazy copy. Archive files
are never duplicated; only the metadata changes. </p>
<p>Merging operations are recorded in Perforce - if, for example, patches
were made to v7 code these patches could be merged back into the main line
of development with &quot;p4 integrate //depot/v7/... //depot/main/...&quot;.
Only files which have changes that have not been previously integrated<br>
into main will be integrated, and the integration will be recorded so
that next time those changes will not have to be revisited. </p>
<p>Because VSS lacks information on merging operations, the converter
simply imports files as they existed in VSS. Because the branching<br>
models are quite different and adjustments will have to be made
after moving to Perforce, the converter does not attempt to infer<br>
any branching relationships. It is highly recommended that the first
step after conversion is to identify directories which have a branching<br>
relationship and establish this relationship in Perforce. Contact
Perforce Technical Support ([email protected]) for help with this. </p>
<p>Labels are commonly used in VSS; they are available in Perforce but not
usually needed. Perforce uses atomic change transactions, and thus the<br>
state of the depot or any part of it is easy to specify.</p>
<h2><a name="restrictions"></a>Restrictions and limitations</h2>
<p>Filenames may not contain ASCII unprintable characters, at signs (@) or 
hashes (#) (please note an experimental version of the converter supports this).<br>
Note that the converter changes things like German umlauts in filenames. </p>
<p>VSS files cannot start with a dollar sign ($) or contain colons
(:) - these restrictions do not exist under Perforce. </p>
<p>Userids and labels may not contain spaces or ASCII unprintable characters.
These characters will be mapped to underscores. </p>
<p>VSS version used must be English not Italian/French or any other version.</p>
<p>Time format separator should be colon e.g. hh:mm:ss rather than say hh.mm.ss 
(may be fixed in future).</p>
<p>The converter currently does not record any file deletions or renames, 
partially because
it's extra effort to do that but also because it's impossible to do it
properly; Visual SourceSafe simply will not give any history information
for files which are currently deleted. </p>
<p>Sort order is based on time but VSS does not output seconds; it is thus
possible that two checkins will appear to be at the same time when they<br>
weren't. This may result in two revisions of a file appearing to be out
of order. There is a
<a href="http://public.perforce.com/guest/robert_cowham/perforce/utils/vss_rev_date_problems.rb">
utility script</a> to check for revisions with out-of-order checkin date/times 
which will cause problems.</p>
<p>Corrupt dates (later revisions newer than earlier) may cause problems with
labels since the converter takes the label to refer to the next real<br>
revision (not a label revision) rather than the closest revision in time. </p>
<p>The converter is not regularly tested against old server versions, and thus
it is not guaranteed to always work against all older versions. Unless<br>
you have a good reason to use an old server version, you should run the
converter against the latest version of Perforce. </p>
<h1><a name="how_it_works"></a>How does the converter work?</h1>
<p>The converter works in four phases:</p>
<ul>
	<li>Phase I: extract VSS metadata</li>
	<li>Phase II: improve the metadata (sort and compact changes using a heuristic)</li>
	<li>Phase III: execute appropriate VSS and p4 commands
to construct Perforce database</li>
	<li>Phase IV: niceties after the fact </li>
</ul>
<p>The &quot;ss properties&quot; and &quot;ss history&quot; commands are used to extract the
metadata from VSS. Hierarchical &quot;ss dir&quot; commands are used if vss is indicated 
as
being corrupt since corrupt directories can be avoided. </p>
<p>When the converter runs it reads configuration values from the file 
&quot;config.ini&quot;.
See the comments in &quot;config.ini&quot; for a description of each option.</p>
<h2><a name="check_result"></a>How do I check the end result, and what does it all mean?</h2>
<p>If you want to be certain that the revisions stored in Perforce are
correct, answer yes to the question &quot;Do you wish to verify the result?&quot;<br>
(If you say no and then change your mind, just run &quot;perl verify.pl&quot;). </p>
<p>The verification step isn't done by default because it takes a long
time, and because there is no portable way to determine whether earlier<br>
phases of the converter succeeded. </p>
<p>You can verify that all changes were successfully submitted by running
&quot;p4 changes -s pending&quot;; it should produce no output. Look in<br>
the directory &quot;metadata&quot; for files containing a mapping of all VSS
files and revision numbers to the associated Perforce filename and<br>
change number. The sorted, more human readable version is in the file
&quot;mapping&quot;; the tabular version is in &quot;mapping.ns&quot; (ns for &quot;not sorted&quot;). </p>
<p>Change numbers should not be confused with version numbers. To see the
files and versions affected by a particular change, type </p>
<blockquote>
	<p>p4 describe -s &lt;change_number&gt; </p>
</blockquote>
<p>(Without the -s all differences between files involved in the change are
displayed as well). </p>
<p>To see the list of all changes (you may want to pipe this through more):</p>
<blockquote>
	<p>p4 changes </p>
</blockquote>
<p>To see the list of labels:</p>
<blockquote>
	<p>p4 labels </p>
</blockquote>
<p>To see the list of changes affecting a particular file:</p>
<blockquote>
	<p>p4 filelog filename </p>
</blockquote>
<p>To list revisions associated with the label &quot;labelname&quot;:</p>
<blockquote>
	<p>p4 files @labelname<br></p>
</blockquote>
<h2><a name="rerunning"></a>Re-running the converter</h2>
<p>If you want to re-run the converter it would be best to erase the directory
tree &quot;data&quot;, so that there cannot be any conflicts between runs. If you<br>
don't want to keep the results of the previous conversion, delete all
files in the server root and directories below it.</p>
<p>You should normally also obliterate all the imported data from the previous 
run (e.g. p4 obliterate //depot/import/proj/... - use &quot;-y&quot; to really do it &quot;p4 
help obliterate&quot;). <b>Be careful about this </b>since obliterate can do nasty 
things to your Perforce repository!!</p>
<p>Also delete &quot;logfile.log&quot; if it exists before re-running. Note that 
sumlogfile.log is automatically deleted and recreated each time.</p>
<h2>Resources</h2>
<p>See some possibly useful
<a href="http://public.perforce.com/guest/robert_cowham/perforce/utils/index.html">
utility scripts</a>.</p>
<p><br>
</p>
<p>originally by James Strickland ([email protected])<br>
Modified by Robert Cowham ([email protected])<br>
Modified by Peter Steiner ([email protected])</p>
<p>$Id: //guest/perforce_software/utils/vsstop4/2006-06-special-chars/README.html#5 $</p>

</body>

</html>
# Change User Description Committed
#5 6070 Robert Cowham Merge in latest changes from main (hopefully!)
Need to create .zip though...
#4 5683 Robert Cowham Merge main stuff in.
#3 5653 Robert Cowham Merge changes from Main
#2 5559 Robert Cowham - Now copes with previously illegal chars %, *, #, @
- Not generalised for other servers yet
#1 5557 Robert Cowham Create new branch
//guest/perforce_software/utils/vsstop4/main/README.html
#7 5439 Robert Cowham Reiterate version of P4Perl to use.
#6 5387 Robert Cowham - Update troubleshooting notes.
#5 5342 Robert Cowham Document that VSS 2005 not supported yet - use 6.0
#4 5334 Robert Cowham Point out config.ini values to set
#3 5331 Robert Cowham Updated readme
#2 5316 Robert Cowham Change filetype
#1 5315 Robert Cowham - Output script version. Changed warning message.
- Converted README.txt to README.html