问题
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:
- 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 .
- 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) - Use propedit instead:
svn propedit svn:ignore .
however this takes a little setting up using command-line svn. Seesvn help propedit
for more details.
来源:https://stackoverflow.com/questions/19856458/ignore-file-in-subversion-removes-old-values-from-svnignore-property