Using Subdirectories as Old Versions

Suppose you have an existing version with several subdirectories with different things in them. You can use one of these subdirectories as the old version (with the -o option) when creating a new package, branch, or checkout.

This works because the old version can be any immutable directory. Subdirectories inside immutable directories are also immutable directories.

Branch Example

Suppose /vesta/example.com/play/pkg is a package, and it has a version 1 with a subdirectory named sub1. Here's an example of creating a branch this way:

% vbranch -o 1/sub1 /vesta/example.com/play/pkg/1.sub1
Creating branch /vesta/example.com/play/pkg/1.sub1

After this, version 0 in the new branch (pkg/1.sub1/0) will be the same as the subdirectory in version 1 of the package (pkg/1/sub1).

Non-exclusive Checkout Example

Doing a non-exclusive checkout with a subdirectory as an old version is a little more difficult. vcheckout defaults the session directory name based on the old version. If you try to do this without specifying a session directory, you'll get an error:

% vcheckout -N -o 1/sub1 /vesta/example.com/play/pkg
vcheckout: can't find /vesta/example.com/play/pkg/1/checkout (tried vesta.example.com:21776)

To get around this, you can specify a session directory with the -s flag. If you use -s for a non-exclusive checkout, it's a good idea to also use -u to have vcheckout automatically add ".N" to make the session directory name unique, so we'll do that here.

vcheckout -N -o 1/sub1 -s checkout/1.sub1 -u /vesta/example.com/play/pkg
Creating session /vesta/example.com/play/pkg/checkout/1.sub1.1
Making working directory /vesta-work/jsmith/subdir_oldver