Camp names

As far as camp is concerned, names are a non-empty sequence of ASCII digits, upper and lower case letters, dots and dashes. This makes them base 64 values.

Names will be given a "P-" or "N-" prefix, depending on whether they are positive or negative, which means that signed names can be used as filenames without having to worry about leading dots or dashes being interpreted specially by any programs. Note that case-insensitive file systems will have problems using names as filenames, so if you need to make filenames then replace A with _a etc.

The way we actually generate names is as follows.

First, when a repository is created (by init, get or put) we call System.Time.getClockTime, which gives us a value like TOD 1221077558 958838000000. We then convert these values to base 62 and combine them with a dash, giving 1kDw3k-gSC6x2g. We store this value, the repo name, in the repository.

Then, when the patch is recorded, we do the same thing to get a second string, say 1kDw6G-eR4aJ2.

We also take a hash, in a format and with an algorithm to be decided, of the patch meta data, and convert it into base 62, say d3R0pK84.

Finally, we combine these three parts with dots, giving 1kDw3k-gSC6x2g.1kDw6G-eR4aJ2.d3R0pK84. If this patch is already in our repository then we increment the picoseconds component of the patch creation time and try again. Otherwise we are done.

Thus in order to get a name clash, you must create two repos at the same time, create a patch in each at the same time, and use the same patch meta-data (or hit a hash collision). The only time this is likely to happen is when running tests involving multiple repos on the same machine. You can fix this by manually specifying the repo name for each repo.

Repo conversion

There is one case where you want to generate the same name: when you are converting a repository from, for example, CVS to camp. If you convert a CVS repo to camp, and I convert the same CVS repo to camp, then it would be nice if we created the same repo, and thus could use each other's patches.

There are two ways of creating patch names when doing this. One is to coerce the name format of the other VCS into camp's name format. Both parties will get the same patch creation date and metadata from the other VCS, which only leaves the repo name to create. If the tool makes a random repo name, like camp does by default, then the patch names will differ; however, by using toolname as the repo name, or asking the user what the reponame should be, patches will get the same names.

Alternatively, recall that camp doesn't care about the structure of names (beyond restricting the set of characters that they use), so a tool may use any scheme that it wishes.

Of course, whatever scheme a tool uses, it must be careful not to end up generating two identical names during a repository conversion!