Multiple depots

Is is possible to have multiple depots in a single user's SVK configuration. Of course, you need to have at least one depot in order to use SVK, and after SVK was first installed you created this depot before doing anything else. This is the depot that you have been using throughout the book up to this point, and is called the Default Depot.

The default depot

The default depot is special because it has no DEPOTNAME. Or rather, its DEPOTNAME is the empty string. By default its REPOPATH is $SVKROOT/local.

The Default Depot is created using the depotmap --init command. This is the only time that the --init switch is used with the depotmap command

Named depots

For many users, the default depot is all that is needed. However, some users find it useful to be able to create additional named depots.

You can create as many additional named depots as you like. Depots are created using svk depotmap command.

For example, to create a new depot with DEPOTNAME 'test' and REPOPATH /tmp/test-depot, you can use this command:

$ svk depotmap test /tmp/test-depot
New depot map saved.
Repository /tmp/test-depot does not exist, create? (y/n)y

Note that depotmap prompts you to create the REPOPATH if it does not already exist. This allows you to create more than one DEPOTNAME pointing at the same REPOPATH if you want:

$ svk depotmap test2 /tmp/test-depot
New depot map saved.

In Depot Paths

Why use multiple depots?

At this point you may be wondering why you'd want to use multiple depots. After all, a depot is just a Subversion repository, and that means you are free to structure your depot in any way you wish, with the root folder perhaps containing a folder for each project you're working on, with each project possibly containing a mirror for that project.

Indeed, many people do use SVK just like this: with everything placed in the default depot, and often never even realizing that it is possible to have more than one depot.

There are however some good reasons why you might want to use more than one depot:

Separating interests

Imagine that you are mirroring two repositories: an Open Source project and also a project for your employer. You might want to keep the two mirrors in separate depots so that the two projects can't affect each other.

Disk space

You are free to create depots anywhere you have permission to. You may want to create a depot on a partition that has a lot of space, for example if you are mirroring a particularly large repository.

Easy disposal

A project in its own depot can easily be thrown away completely without having any effect on other projects. If the projects were in the same depot you could of course delete the relevant paths in the depot, but the history of the deleted paths would remain, which may be precisely what you are trying to remove.

Different purposes

You may want to use different depots for different purposes. For example, you might have one depot for mirrors, and another for your personal depot containing your local repository that only you commit to.

Network sharing

If you are using the fsfs Subversion filesystem for your depot, it is possible to host a depot on a remote filesystem mounted via NFS. This allows you to share the same depot with other developers.

Why not use multiple depots?

While using multiple depots has many advantages, there are a few things that you should consider before using them. Different depots really are completely separate entities: you can't create a branch in one depot that is a copy of a directory in another, and you can't do merging between them.