subversion

Deleting files using TortoiseSVN

Book page

When using TortoiseSVN (which, BTW, uses Drupal as it's website CMS, YAY!) as your interface to subversion, deleting files from the repository may not be obvious. To delete the files on your local checkout, first you indicate you want the files deleted, then you commit the deletion to the repository.

If you use the command line, the steps are:

% ls
dir1/           a-file.txt
% svn rm dir1
D         dir1/another-file-to-delete.txt
D         dir1/file-to-delete.txt
D         dir1
% svn ci -m "Removed the directory" dir1
Deleting       dir1

Committed revision 92.

With TortoiseSVN, you'll execute these same commands with the GUI, using your mouse instead.

First, select the file, files, directory or directories you want to delete.

Then, go to the menu: File > TortoiseSVN > Delete

You've now indicated to the subversion repository that you want to delete the selected files. To actually delete them, you need to commit your change.

Go to the menu File > SVN Commit

Don't forget to provide a good comment for your change! If you can, succinctly explain why you made your change, as well as the change you made.

svn: import in place

Book page

You have a set of files you want to import into an existing repository, but you want to keep them in place (say, a live website, where you want to create the repository without stopping the web services, or a working copy you want to keep working on).

These are the steps to import said files into an existing repository, keeping the files as a working copy (that is to say, import in place). They work because you can check out a (sub)directory from the existing repository directly into an existing directory.

Start by creating an empty directory in the repository, checking out this empty repository directory into the file system directory to be imported (making it now a working directory), then adding all of the files to the repository.

Steps:

  1. Create a URL in the the repository that matches the top level of the files to be imported


    % svn mkdir file:///path/to/svn-repository/some/path/top-level-dir -m "Make dir in the repository corresponding to top-level-dir"

  2. Change to the top level directory of the files to be imported


    % cd top-level-dir

  3. Check out the top level directory just created in the repository


    % svn checkout file:///path/to/svn-repository/some/path/top-level-dir .

    This will create a .svn directory (with supporting files!) in the top-level-dir, since you just checked out the top of that path from the repository.

  4. Add all the remaining files to the repository


    % svn add file1 file2 dir1 dir2 ...

  5. And commit!


    % svn commit -m "Initial import of top-level-dir"

subversion

Book page

Subversion (svn) notes