27

I have a huge repository where I want to add/remove a folder. I haven't checked out anything yet. There is any way to do it fast?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Jader Dias
  • 88,211
  • 155
  • 421
  • 625

5 Answers5

43

If you have the svn command line client then check out the commands svn mkdir and svn delete.

Full documentation is available by typing

svn help mkdir

and

svn help delete

Noel Walters
  • 1,843
  • 1
  • 14
  • 20
  • note: nowadays both `svn mkdir` and `svn delete` work remotely (i.e. without a local working copy), so you may do exactly what the OP asked for (and under any OS). – rsenna Jul 22 '13 at 14:05
18

svn delete can operate either on a working copy or on a URL. When you specify a URL, the operation causes an instant commit - so be careful.

If you want to delete multiple, disjoint directories in a single commit, you can use the --depth argument to svn checkout to make a shallow (and therefore fast) checkout, on which you can operate locally and then commit.

Of course, this answer assumes that you only want to delete the file from the HEAD of the URL in question - if you want to completely erase a file/folder from the repository, you have more work to do.

(edit to add information about adding follows)

To add directories, you have to have a working copy. But it doesn't have to be a complete working copy: you can use --depth, as mentioned above, to only check out the directory to which you want to add your new directory, then svn add the new directory, then commit.

If the directory you're adding exists elsewhere in the repository, you could copy it with history using svn copy from one URL to another.

Dan Davies Brackett
  • 9,811
  • 2
  • 32
  • 54
7

If you're using Tortoise SVN, on Windows, this is easy. You can just do "View Repository" and add the folder on the server, all through the GUI.

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
  • 2
    if you can do that via tortoise, there must be also a command line option to do that. – txwikinger Jul 20 '09 at 18:45
  • Yeah, but I'm not too familiar with the option to do it. svn delete works on a URL, but svn add (to my knowledge, and in the docs), only works on the local repo. – Reed Copsey Jul 20 '09 at 19:02
  • you mean local working copy, Reed =) and yes, that's correct. you can add to sparse checkouts, but you do have to have something checked out. – Dan Davies Brackett Jul 20 '09 at 19:27
5
  1. svn mkdir to create directory on svn repository eg : svn mkdir http://svn.xxx.com/repo/new_project
  2. svn import to upload local directory to svn repository eg : svn import ./new_project http://svn.xxx.com/repo/new_project
zxshi
  • 357
  • 3
  • 8
-4

Yes. You can use e.g. TortoiseSVN client for that.

bohdan_trotsenko
  • 5,167
  • 3
  • 43
  • 70
  • 10
    For anybody coming from Google like I did, in Windows with TortoiseSVN, do a right-click and select "Repo-Browser". You can create the directory from there. – Tarka Oct 17 '11 at 16:36
  • 12
    And if you are on unix machine? This answer is "correct" only in the sense that the OP happened to be using windows, and was willing to google the way to do it with tortoiseSVN. – Jukka Dahlbom Feb 13 '12 at 11:49
  • Strange. When I click "delete" I get "You cannot delete this accepted answer" error. @Jader-dias, would you please re-accept the most voted up answer? – bohdan_trotsenko Oct 13 '14 at 20:01