5

I'm creating an ignore list on a Windows machine using the following command line:

svn propset svn:ignore "bin" Fardis.Test

The directory tree structure is:

\src\
\src\Fardis.Test\
\src\Fardis.Test\bin\
\src\Fardis.Test\obj\

I'm running that command while my current directory is \src. This works fine, but I want to add another folder, \src\Fardis.Test\obj\ to the ignore list, but it fails. I tried the following:

svn propset svn:ignore "bin obj" Fardis.Test
svn propset svn:ignore "bin, obj" Fardis.Test
svn propset svn:ignore "bin; obj" Fardis.Test

After issuing which one of them, svn status shows that none of folders bin or obj are added to the ignore list.

How can I solve this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Afshar Mohebi
  • 10,479
  • 17
  • 82
  • 126

3 Answers3

25

I usually create a .svnignore file. See svn:ignore Then do:

$ svn propset svn:ignore -F .svnignore .
  property 'svn:ignore' set on '.'

.svnignore:

*.pyc
*~

EDIT: I add the .svnignore to the repo also to keep track of it.

spleeyah
  • 351
  • 2
  • 4
  • your solution seems greatly too. tnks. – Afshar Mohebi Jun 16 '10 at 09:45
  • 2
    Unfortunately this doesn't work recursively like with Git. You'd probably need to add the `-R` parameter to apply the file contents to all currently existing (not future!) subdirectories, but the patterns are probably wrong for the subdirectories. – ygoe Feb 03 '14 at 14:31
  • Or use `svn:global-ignores` if your are at subversion 1.8. – Dormouse Aug 07 '15 at 14:18
8

Use svn propedit instead of svn propset, and put each pattern on a separate line in the editor window.

Also take a look at setting global-ignores in your config for files and directories that should be ignored in any working copy. That's usually a better way to exclude debug and binary output from directories containing lots of projects.

anton.burger
  • 5,637
  • 32
  • 48
0

Method

There is flexible way without using global-ignores.

For example, you can create two files: .svn-ignore and .svn-ignore-recur.

.svn-ignore-recur

.idea
*.pyc
*.aux
*.out
*.ilg
*.toc
64bit-Debug

.svn-ignore

.idea
*.pyc
*.aux
*.out
*.ilg
*.toc
64bit-Debug
# below is difference
base
ta.txt
ta.html

Then you ought to call two commands (sequence is important).

svn propset svn:ignore -F .svn-ignore-recur . --recursive
svn propset svn:ignore -F .svn-ignore .

So, you get the way to ignore some files recursively, and some other files in the root of your repository.

To simplify a problem it is reasonably to create .sh or/and .bat files:
!svn-ignor.bat

svn propset svn:ignore -F .svn-ignore-recur . --recursive
svn propset svn:ignore -F .svn-ignore .


!svn-ignor.sh

#!/bin/sh

sh ./!svn-ignor.bat

Of course you ought to add file:

svn add .svn-ignore* !svn-ignor.*

Additional

It is clear you cat create file like .svn-ignore-some-subdir

*.dvi
*.cot
seven_doo

and call

svn propset svn:ignore -F .svn-ignore-some-subdir ./sub/sub1/sub2
Community
  • 1
  • 1
Anabar
  • 1,091
  • 9
  • 9