How do I create an ignore list of several items in SVN?
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 b开发者_如何学Cin or obj are added to the ignore list.
How can I solve this?
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.
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.
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
精彩评论