37

If I svn:ignore a really big folder will it improve performance during SVN updates?

I have this really massive (>600MB) folder in my project. The files in this folder should not be changing at all. The problem is that every time I call "svn update" it takes forever. Is there a way to ignore this folder during updates to speed up the update process?

Christian Schlensker
  • 21,708
  • 19
  • 73
  • 121

5 Answers5

57

The svn:ignore is only for files that are not already in the Subversion repository. This folder already is.

You can use the svn update --set-depth exclude folderName to remove this folder from your working directory:

$ svn update --set-depth exclude bigFolder  #Removes "bigFolder" from workdir
D bigFolder

$

Next time you do an update, bigFolder won't show up in your working directory. If you want it back, you'll have to reset the depth:

$ svn update --set-depth infinity
U bigFolder
U bigFolder/File1
U bigFolder/File2
...
David W.
  • 105,218
  • 39
  • 216
  • 337
  • 11
    I don't like what it deletes the folder. I would like just to not update existing one. – Fedir RYKHTIK Jun 13 '13 at 09:27
  • This allows excluding a single directory. Is there a way to exclude multiple directories? I don't need all the old branches of a project in my local copy. – Barmar Oct 02 '18 at 17:07
  • @Barmar you can only checkout the branches that you want. It's not necessary to have all project with trunk, tags and branches in your wc. – Sergi Nov 15 '18 at 08:05
  • @Sergi In my case I might want to ignore 10 or 20 directories out of 100. So I'd have to explicitly check out those 90. And when new directories are created, I'd have to check them out manually, since I can't just update the parent directory. – Barmar Nov 15 '18 at 16:31
  • 2
    You can use the --set-depth exclude with multiple files and directories. Like svn update --set-depth exclude dir1 dir2 file1 ... – Sergi Nov 19 '18 at 10:53
  • Not working on Mac and SVN 1.13.0. When I do 'svn update' it still restores the deleted folder locally. – terreb Mar 23 '20 at 15:58
11

You could do an svn update and specifically mention every other directory, e.g.

svn update dir1 dir2 dir3

Or, grep -v out what you don't want.

svn update `ls | grep -v big_dir`

Or, svn mv the big_dir up into another folder and change your build system to get the content from the other directory.

Bill Brasky
  • 2,614
  • 2
  • 19
  • 20
10

Just do :

svn up `svn ls | grep -v big_dir`

Using "svn ls" You could update not only locally existing directories and files, but new files from repository. So, update is more complete, than just exclude. And You don't need to delete already existing files, like "--set-depth exclude" apparently does.

Fedir RYKHTIK
  • 9,844
  • 6
  • 58
  • 68
  • Parsing `ls` output is usually a bad idea [http://mywiki.wooledge.org/ParsingLs](http://mywiki.wooledge.org/ParsingLs) – Doppelganger Jun 24 '14 at 19:45
  • 1
    @Doppelganger In the article it's about `ls`. In the answer code `svn ls`. It's a little bit different. – Fedir RYKHTIK Jun 25 '14 at 08:11
  • 2
    You're correct. The common pitfall with parsing `ls` is that it does not handle filenames with newlines in their names well. `svn ls` avoids this problem because svn won't let you add files with newlines in their name. `svn add 'a b' svn: E160005: Invalid control character '0x0a' in path '/svn-test/a\012b'` – Doppelganger Jun 26 '14 at 14:22
  • You may have problems if there's another file or directory called "big_dir_something_else", so it may be good idea to filter the whole word with `-w`: `svn up $(svn ls | grep -wv big_dir)` (also changing backticks with `$(...)`) – Renato Aug 11 '15 at 22:11
3

Apart from what @Bill Brasky said, one suggestion is to move the huge folder into an external. That way you can do svn up --ignore-externals

If you don't want the huge folder in your working copy, you can have a look at sparse checkouts:

svn checkout repo . --depth empty
svn up other dirs
manojlds
  • 290,304
  • 63
  • 469
  • 417
0
svn file structure:
trunk
|___ folder1
|___ folder2
|___ folder3
|___ other_folder

first when checkout , use immediates , only checkout first level folder and files :

  • svn co svn://svn-xxxx.com/svn/develop/trunk --depth immediates trunk,

then , set some folder for update later:

  • cd trunk
  • svn up folder1 folder2 folder3 --set-depth infinity

ok, now noly folder 123 will be able to update, and other first level folder still remain in the trunk folder

Mr C
  • 41
  • 6