| 1 |
== Introduction == |
|---|
| 2 |
|
|---|
| 3 |
ssphys is an application to read and ouput the content of the archive files |
|---|
| 4 |
created from Visual Source Safe 6.0. Additionally it can rebuild old versions of |
|---|
| 5 |
the archived files. |
|---|
| 6 |
|
|---|
| 7 |
ssphys was created in order to fully convert the from a Visual Source Safe |
|---|
| 8 |
archive to other source control systems, esp. subversion. The reason for the |
|---|
| 9 |
exitence of this tool is due to the buggyness of the VSS tool chain provided |
|---|
| 10 |
from Microsoft. With the provided commandline tool ss.exe it was impossible to |
|---|
| 11 |
retrieve deleted or renamed files. |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
== Visual Source Safe == |
|---|
| 15 |
|
|---|
| 16 |
Visual Source Safe is a source control application provided from Microsoft. |
|---|
| 17 |
|
|---|
| 18 |
=== 5.0 === |
|---|
| 19 |
|
|---|
| 20 |
not tested yet |
|---|
| 21 |
|
|---|
| 22 |
=== 6.0 === |
|---|
| 23 |
|
|---|
| 24 |
provided with Visual Studio. COmes in different version. The last known is V6.0d |
|---|
| 25 |
|
|---|
| 26 |
=== 7.0 === |
|---|
| 27 |
|
|---|
| 28 |
provided with Whidebey Studio not tested yet. |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
=== Archive Format === |
|---|
| 32 |
|
|---|
| 33 |
VSS differntiates between two different types of '''items''': '''Files''' and |
|---|
| 34 |
'''Projects''' Project are like directories and can contain different other |
|---|
| 35 |
Projects or Files. To differntiate between Projects and Files, Projects are |
|---|
| 36 |
written with a leading dollar sign like $/Project. |
|---|
| 37 |
|
|---|
| 38 |
VSS stores both types of items (Projects and Files) in seperate physical files |
|---|
| 39 |
within the archive. During all activities the name of the physical never |
|---|
| 40 |
changes, even throughout renames or deletes. If two items with the same name are |
|---|
| 41 |
stored within one Project, these two items are represented in two different |
|---|
| 42 |
physical files. |
|---|
| 43 |
|
|---|
| 44 |
The name of the physical file used for an item is build from an increasing list |
|---|
| 45 |
of 8 characters (aaaaaaaa...zzzzzzzz). The name of the file has no relation to |
|---|
| 46 |
the name of the Item. The last name that was used is recorded in the file |
|---|
| 47 |
aaaaaaaa.cnt in the data directory of the archive. |
|---|
| 48 |
|
|---|
| 49 |
The data directory of the archive is made up of several different files: |
|---|
| 50 |
|
|---|
| 51 |
1. physical data files: |
|---|
| 52 |
|
|---|
| 53 |
these are all those files, that can be found in the data directory. Starting |
|---|
| 54 |
from v6.0 the data directory is organized in different subfolders from "a" |
|---|
| 55 |
to "z". The physical datafiles are sorted into these folders from their |
|---|
| 56 |
first letter: data\[a..z]\[aaaaaaaa...zzzzzzzz] |
|---|
| 57 |
|
|---|
| 58 |
2. project information files: |
|---|
| 59 |
|
|---|
| 60 |
special files in data\[a..z] that tell VSS which Files make up a Project |
|---|
| 61 |
|
|---|
| 62 |
3. names.dat |
|---|
| 63 |
|
|---|
| 64 |
names cache to convert from a short representation of a File or Project name |
|---|
| 65 |
to the real name. |
|---|
| 66 |
|
|---|
| 67 |
4. um.dat |
|---|
| 68 |
|
|---|
| 69 |
User Management |
|---|
| 70 |
|
|---|
| 71 |
5. CRC.dat |
|---|
| 72 |
|
|---|
| 73 |
6. Rights.dat |
|---|
| 74 |
|
|---|
| 75 |
7. srcsafe.ini |
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
Most of these files are made from special records that contain a header with |
|---|
| 79 |
length, type and crc information. The type is a two character code like "EL", |
|---|
| 80 |
"MC" or "FD", e.g names.dat and all physical files. |
|---|
| 81 |
|
|---|
| 82 |
Others files are simply binary files, without a special record structure, e.g |
|---|
| 83 |
status.dat |
|---|
| 84 |
|
|---|
| 85 |
Additionally sveral files have a specific file header (SSHeaderFile), and others |
|---|
| 86 |
that only contain these special records (SSPlainFile) |
|---|
| 87 |
|
|---|
| 88 |
The basic building of ssphys is based on these records (SSRecord). The records |
|---|
| 89 |
are read without any interpretation from a SSFile and can be wrapped by higher |
|---|
| 90 |
level special objects, depending on the type. The SSObject::MakeObject factory |
|---|
| 91 |
function builds a special SSObject derived object depending on the type. |
|---|
| 92 |
|
|---|
| 93 |
The binary layout for all special records can be found in the SSTypes.h header. |
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 |
=== Reverse Delta === |
|---|
| 97 |
|
|---|
| 98 |
VSS stores all checkins as reverse deltas in "FD" records. Reverse delta means, |
|---|
| 99 |
that the last version of the file is kept and delta to the previous version is |
|---|
| 100 |
stored. The last version is stored in a file named from the physical item plus |
|---|
| 101 |
an extension ".A" or ".B". These two extensions are used alternately. |
|---|
| 102 |
|
|---|
| 103 |
Rebuilding an older item is possible by retrieving the last version, and reverse |
|---|
| 104 |
apply all deltas up to the required version. |
|---|
| 105 |
|
|---|
| 106 |
The delta format is a very easy stream with only three commands with the |
|---|
| 107 |
following layout {<command> <start> <len> data} {<command> <start> <len> data} |
|---|
| 108 |
... <stop> |
|---|
| 109 |
|
|---|
| 110 |
command: 0 = take <len> bytes from the stream and append them to the output file |
|---|
| 111 |
1 = take <len> bytes from the last file, starting at offset <start> and append |
|---|
| 112 |
them to the output file 2 = <stop> |
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
== VSS Actions == |
|---|
| 116 |
|
|---|
| 117 |
=== Shares === |
|---|
| 118 |
|
|---|
| 119 |
SS support shares, but only for files. Shares are implemented in the way, that |
|---|
| 120 |
the reference count for the item is increased and the same physical entry is |
|---|
| 121 |
refrenced in another project. Additionally a shared flag is set. For each share |
|---|
| 122 |
a special "PF" record is appended tothe data file. There is no version |
|---|
| 123 |
information attached to these "PF" records. So the item can't tell when a share |
|---|
| 124 |
was made (only implicitly by the linear order of the history activity). |
|---|
| 125 |
|
|---|
| 126 |
Shares are only supported for files. If you recursivly share a project a new |
|---|
| 127 |
subproject is created in the share target project and all subitems are really |
|---|
| 128 |
shared into this new project. This means e.g. that the shared project does not |
|---|
| 129 |
have the same history. |
|---|
| 130 |
|
|---|
| 131 |
In each project record the ("last") specification of the parent record is stored |
|---|
| 132 |
and the physical item for the parent. The fact, that shares are not supported |
|---|
| 133 |
for projects allows us to exactly specify the parent path specification. |
|---|
| 134 |
|
|---|
| 135 |
=== Renames === |
|---|
| 136 |
|
|---|
| 137 |
Renaming an item in VSS mainly done in tne parent project. There is a name |
|---|
| 138 |
variable in the item physical file that always carries the last name, but all |
|---|
| 139 |
historic activities are recorded in the parent. |
|---|
| 140 |
|
|---|
| 141 |
Sadly, the project structure is not recorded with FD records. As with files, the |
|---|
| 142 |
last state is stored in a special file, but no reverse deltas exits. To get the |
|---|
| 143 |
correct names for older items, one have to reverse apply all actions beginning |
|---|
| 144 |
from the last state. |
|---|
| 145 |
|
|---|
| 146 |
Renaming a project item will have additional effects. Since all sub projects |
|---|
| 147 |
will exactly record the parent specification, all parent specifications within |
|---|
| 148 |
the subprojects of the renamed parent have to be renamed also. Therefor the |
|---|
| 149 |
items will only know the last valid full parent specification (and the physical |
|---|
| 150 |
name), but no historic information. |
|---|
| 151 |
|
|---|
| 152 |
=== Branches === |
|---|
| 153 |
|
|---|
| 154 |
When branching a file VSS creates a new physical file and links it to the branch |
|---|
| 155 |
source file. The new branch is recorded in a special BF record in the branch |
|---|
| 156 |
source. This information is used in the properties dialog on the Paths page. |
|---|
| 157 |
|
|---|
| 158 |
A branch can only be performed on a file that was previously shared. During the |
|---|
| 159 |
branch the share is broken at the pinned version and a new physical file is |
|---|
| 160 |
created. |
|---|
| 161 |
|
|---|
| 162 |
The following changes are made: |
|---|
| 163 |
|
|---|
| 164 |
branch source:: |
|---|
| 165 |
|
|---|
| 166 |
addition of a new BF record with the information about the new physical files. |
|---|
| 167 |
All BF records are linked from the last to the first. The last BF records and |
|---|
| 168 |
the number of records is stored in the DH File information record. |
|---|
| 169 |
|
|---|
| 170 |
branch target:: |
|---|
| 171 |
|
|---|
| 172 |
The branch target starts as a new physical file with the following excpetions: |
|---|
| 173 |
|
|---|
| 174 |
1. The Item Information Record (DH) records the branch source physical file |
|---|
| 175 |
|
|---|
| 176 |
2. The first version is a RollBack action (in contrast to a Created File action) |
|---|
| 177 |
|
|---|
| 178 |
3. version numbering starts with one greater the version number from where the |
|---|
| 179 |
branch was created |
|---|
| 180 |
|
|---|
| 181 |
parent folder:: |
|---|
| 182 |
|
|---|
| 183 |
A new EL (History Record) with the ActionID ''Branch_File'' is created. The |
|---|
| 184 |
name of the item, the old physical and the new physical files names are |
|---|
| 185 |
recorded. No information about the branch version is recorded. |
|---|
| 186 |
|
|---|
| 187 |
path:: the source safe name for the history of exactly one branch. |
|---|
| 188 |
|
|---|
| 189 |
example: |
|---|
| 190 |
|
|---|
| 191 |
A file Readme.txt (INEAAAAA) was branched at version 19 and the newly created "path" |
|---|
| 192 |
will live in the new physical file AJGAAAAA. The first version in this file is a |
|---|
| 193 |
RollBack action, that points back to the branch parent. The branchpoint can be |
|---|
| 194 |
calculated from the version number of the RollBack action, since the version number |
|---|
| 195 |
after the branch continues counting from the branchpoint, namely version 20. |
|---|
| 196 |
|
|---|
| 197 |
Since the Rollback action is only for internal bookeeping, no file change is |
|---|
| 198 |
associated with this action, that means, that the file INEAAAAA;19 is the same as the |
|---|
| 199 |
file AJGAAAAA;20. |
|---|
| 200 |
|
|---|
| 201 |
<Version offset="1116"> |
|---|
| 202 |
<VersionNumber>20</VersionNumber> |
|---|
| 203 |
<UserName>Dirk</UserName> |
|---|
| 204 |
<Date>1094815584</Date> |
|---|
| 205 |
<Comment> </Comment> |
|---|
| 206 |
<Action ActionId="RollBack"> |
|---|
| 207 |
<Physical>AJGAAAAA</Physical> |
|---|
| 208 |
<SSName offset="89324" type="file">Readme.txt</SSName> |
|---|
| 209 |
<Parent>INEAAAAA</Parent> |
|---|
| 210 |
</Action> |
|---|
| 211 |
</Version> |
|---|
| 212 |
|
|---|
| 213 |
The specifc RollBack version is reconstructable from the physical file AJGAAAAA. All |
|---|
| 214 |
further versions must be taken from the branch parent INEAAAAA. The version history |
|---|
| 215 |
for this branched file is therefor: |
|---|
| 216 |
|
|---|
| 217 |
... |
|---|
| 218 |
readme.txt;21 = AJGAAAAA;21 |
|---|
| 219 |
readme.txt;20 = AJGAAAAA;20 |
|---|
| 220 |
readme.txt;19 = INEAAAAA;19 |
|---|
| 221 |
readme.txt;18 = INEAAAAA;18 |
|---|
| 222 |
... |
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 |
=== Rollback === |
|---|
| 226 |
|
|---|
| 227 |
==== Rollback Action vs. Rollback Activities ==== |
|---|
| 228 |
|
|---|
| 229 |
The term Rollback is a bit misleading in VSS. There is a properties command where |
|---|
| 230 |
you can perform "Rollback" activities and, there is the "Rollback action" reported |
|---|
| 231 |
in the history. Both have nothing in common. |
|---|
| 232 |
|
|---|
| 233 |
The first one is available from the command line ot the history dialog of the |
|---|
| 234 |
SSExplorer. This one will let you "constantly" delete some content of your history |
|---|
| 235 |
by completly removing it out of the physical file. There are no remains left over |
|---|
| 236 |
and there is no entry in the item history, that you performed this action. |
|---|
| 237 |
|
|---|
| 238 |
The second one is implicitly triggered by the branch command. The branch will force |
|---|
| 239 |
the creation of a new physical file. In order to follow the history to the point |
|---|
| 240 |
before the branch, the first action in this new file is a "RollBack Action", with |
|---|
| 241 |
the information about the parent physical file and the branchpoint. See under Branches |
|---|
| 242 |
for an example. It is like saying "from now on continue with the history in a different |
|---|
| 243 |
file at a specific version number" |
|---|
| 244 |
|
|---|
| 245 |
If you see a "Roolback to version" action in the history of a file, this is always |
|---|
| 246 |
due to a branch action. |
|---|
| 247 |
|
|---|