Ignore file in Subversion removes old values from svn:ignore property

血红的双手。 提交于 2019-12-11 02:38:58

问题


I have a Subversion Working Copy G:\csmdepot\Builds with diffrent files in it, some are ignored some aren't (I ignored the files with Tortoise):

  • \Build_1.wim ignored
  • \Build_2.wim ignored
  • \WimID.xml (not ignored)

Now to automate everything I'd like to do it via the command line and I tried the following (I'm writing a batch file in a vbscript and run it):

fso.MoveFile "G:\csmdepot\Builds\WimID.xml", "G:\WimID.xml"

--- Batch file start

G:
cd G:\csmdepot\Builds\
svn commit WimID.xml -m "Commit that WimID.xml is away"
svn propset svn:ignore WimID.xml .

Batch file end ---

fso.MoveFile "G:\WimID.xml", "G:\csmdepot\Builds\WimID.xml"

... But when I go back to my folder G:\csmdepot\Builds all ignored files are marked as not versioned and the only value in svn:ignore property is WimID.xml but also this file is versioned. When I manually commit at least the WimID.xml is ignored.

What can I do to append WimID.xml to the values of the svn:ignore property without removing the old ones and what is wrong with my svn commit statement?

EDIT: The fso.MoveFile statement is working. It has to do something with my svn commands.


回答1:


After reading this and the linked entry in the first answer,
I stumbled across svn propget which led me to the idea of writing this:

svn propget svn:ignore .>>.svnignore
echo WimID.xml>>.svnignore
svn propset svn:ignore -F .svnignore .

I tested it on a windows(7) console with the a 1.6.23 svn client
this worked for me in all cases, no matter if the property has been set before.

nice thing is you make the svnignores visible in the file.

not sure about the commit, maybe you could/need to tell svn to remove the file from svn?




回答2:


As you have noticed using svn propset svn:ignore will override whatever you had the svn:ignore property set to before.

Unfortunately there is no easy straightforward append command regarding this. As described here if you want a working append you need to do some kind of batch/shell script to fix it.

However if you just want to do this occasionally you might also do it with other solutions:

  1. Specifying the entire ignore set by using all the desired patterns in a file (which I call ignoredFiles) and then use svn propset svn:ignore -F ignoredFiles .
  2. You can add files on multiple lines using this command by pressing enter between the file names and having quotes around the entire argument but this may only work on certain operating systems/shells. Something like: svn propset svn:ignore ‘Build_1.wim [enter] Build_2.wim [enter] WimID.xml’ . [enter] (taken from a comment in a blog post)
  3. Use propedit instead: svn propedit svn:ignore . however this takes a little setting up using command-line svn. See svn help propedit for more details.


来源:https://stackoverflow.com/questions/19856458/ignore-file-in-subversion-removes-old-values-from-svnignore-property

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