Ignore multiple specific files with svn

孤人 提交于 2020-01-02 05:37:10

问题


Our build system generates a number of files that are scattered around the source tree.

These files the show up when running svn status

In the example below all of the files with a '?' in the thirdparty directory have been generated by the build system.

e.g.

svn status
M       common/db/unit_test/src/db_payload_builder_test_suite.cpp
?       common/db/unit_test/Makefile
M       common/lib/osal/variant/linux/public_inc/osal_specific_msgq.hpp
M       common/lib/enb/public_inc/enb_service.h
?       thirdparty/lib/curl/public_inc_arm
?       thirdparty/lib/curl/public_inc_x86
?       thirdparty/lib/curl/originals/config.log
?       thirdparty/lib/curl/originals/libcurl.pc
?       thirdparty/lib/curl/originals/config.status
?       thirdparty/lib/curl/originals/libtool
?       thirdparty/lib/curl/originals/curl-config
?       thirdparty/lib/curl/originals/src/curl

I would like to tell svn to ignore these files. I cannot simply specify directories that should be ignored since many of these directories contain sources that are checked in to the repository.

The example above is a subset of the files that are generated, we cannot use an ignore pattern because some of the generated files match files that we do not wish to ignore (e.g. xxx_.h" )

I have tried using svn propset svn:ignore 'somefile' dir but I can only manage to tell svn to ignore one specific file per directory.

How can I specify multiple specific files for svn to ignore?


回答1:


You can pass it a list of files to ignore, one per line

vnix$ svn propset svn:ignore 'config.log
> libcurl.pc
> config.status
> libtool
> curl-config' thirdparty/lib/curl/originals

... where vnix$ is your shell's primary prompt and > is the secondary prompt.

Don't look scared, that's how you write multi-line strings in the shell.

Alternatively, feed it a file on stdin:

vnix$ svn propset svn:ignore -F - thirdparty/lib/curl/originals <<HERE
> config.log
> libcurl.pc
> config.status
> libtool
> curl-config
> HERE

See also the Red Book, although the example is not very explicit for your particular scenario.




回答2:


One line solution:

svn propset svn:ignore "file1"$'\n'"file2"$'\n'"file3" .



回答3:


If you starting to read docs, you'll discover, that

  • svn:ignore can be applied to folder, which contain have-to-be-ignored files, not only to parent of this folder
  • svn:ignore define pattern of files, which be ignored in future svn add and svn status by default, but only for unversioned files. Files already under version control doesn't affected by svn:ignore

Your forkflow have to be:

  1. Add all needed files in SVN
  2. For folders, which are targets of your builder, add . ignore-pattern
  3. Test patterns and completeness of blocking by test-run of build and checking output of svn st in the root of WC


来源:https://stackoverflow.com/questions/13865354/ignore-multiple-specific-files-with-svn

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!