Other Useful Commands

While not as frequently used as the commands previously discussed in this chapter, you will occasionally need these commands.

svk cleanup

When SVK modifies your working copy, it tries to do so as safely as possible. Before changing the working copy, SVK writes its intentions to a log file. Next it executes the commands in the log file to apply the requested change. Finally, SVK removes the log file. Architecturally, this is similar to a journaled filesystem. If a SVK operation is interrupted (if the process is killed, or if the machine crashes, for example), the log files remain on disk. By re-executing the log files, SVK can complete the previously started operation, and your working copy can get itself back into a consistent state.

And this is exactly what svk cleanup does: it searches your working copy and runs any leftover logs, removing locks in the process. If SVK ever tells you that some part of your working copy is “locked”, then this is the command that you should run:

$ svk status
/Users/sally/bread/sandwich.txt already locked, use 'svk cleanup' if lock is stalled
$ svk cleanup
$ svk status
M   sandwich.txt

svk import

The svk import command is a quick way to copy an unversioned tree of files into a depot, creating intermediate directories as necessary.

$ svk import mytree //some/project --message "Initial import"
Committed revision 1.
Directory /Users/sally/mytree imported to depotpath //some/project as revision 1.

The previous example copied the contents of directory mytree under the directory some/project in the default depot:

$ svk list //some/project

Note that after the import is finished, the original tree is not converted into a working copy. To start working, you still need to svk checkout a fresh working copy of the tree.


If you wish to convert the directory from which the import is done to a working copy right away, simply pass the --to-checkout (t) switch to the svk import command:

$ svk import mytree //some/project --message "Initial import" --to-checkout
Committed revision 1.
Directory /Users/sally/mytree imported to depotpath //some/project as revision 1.
$ svk status --verbose mytree
           1        1 sally        mytree/bar.c
           1        1 sally        mytree/foo.c
           1        1 sally        mytree/subdir/quux.h
           1        1 sally        mytree/subdir
           1        1 sally        mytree