How do I create an ignore list of several items in SVN?
Asked Answered
I

3

6

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?

Irena answered 16/6, 2010 at 9:14 Comment(0)
A
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.

Ambulacrum answered 16/6, 2010 at 9:23 Comment(0)
D
26

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.

Dolmen answered 16/6, 2010 at 9:32 Comment(3)
your solution seems greatly too. tnks.Irena
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.Alterant
Or use svn:global-ignores if your are at subversion 1.8.Schlock
A
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.

Ambulacrum answered 16/6, 2010 at 9:23 Comment(0)
C
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
Compatriot answered 1/6, 2017 at 16:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.