The goal is to set the following svn property in a .bat
file:
Properties on 'logs':
svn:ignore
*
The command should be svn propset svn:ignore * logs
but the asterisk needs to be escaped somehow. I don't want to add the current list of files I really want to ignore all files in the logs directory without ignoring the logs directory itself.
However I can't figure out how to properly escape the asterisk to get a literal asterisk in the svn property.
'*'
results in the string '*'
(with the quotes) to be set as the value which does not ignore any files at all "*"
or ^*
still expands the asterisk causing svn to set a property (with the name of a file in the current directory) on all directories. \\*
or "\\*"
causes SVN to look for a (or all?) files in the root of the C:
drive for some reason %*
results in a value of %*
I can't think of any other way to escape a character in a bat file.
I've come across the same problem you described.
I am on Windows (using TortoiseSVN) and I needed to set a rule in svn:ignore
so that all files belonging to certain directories would be ignored.
I used the following command:
svn propset svn:ignore '*' dirname
And then In File Explorer, went to dirname and then: Right Click>Properties>Subversion>Properties..
.
I saw that the value set for property svn:ignore
was '*'
which didn't worked at all.
I also tried different combinations of asterisks (as you said) but without success.
Then, I tried to use a file-based approach: I created a simple svn.txt
file with just one line:
*
Then, after execution of the command:
svn propset svn:ignore -F svn.text dirname
I went to the same menu described before, and now the svn:ignore
property for the folder correctly shows the value: *
.
Of course, after committing the svn:ignore
property modification, every file which is put under dirname
is correctly ignored.
I can think of two other ways to try but sadly I cannot verify them myself without further ado...
Maybe it is a double caret ^^*
You can try to fix it by passing the asterisk as variable inside of your batch file. Example:
@echo off
[...]
set asterisk=*
call svn propset svn:ignore %asterisk% logs
[...]
This should prevent the expansion of the asterisk since the variable %asterisk% must already be expanded and there is no second expansion pass unless you activated ENABLEDELAYEDEXPANSION
somewhere in your command session (with cmd.exe /V:ON
or SETLOCAL
).
Remark to your attempt with \\*
: This behavior seems totally legit to me, since \\
stands for the root directory of the current drive in UNIX/LINUX. And svn interprets wildcards as implemented in fnmatch
on such systems [see redbook on svn:ignore]. This essentially works in Windows also this way. cd \\
will bring you to the first level of the drive and a dir \\*.*
will list the files on the first level no matter where you are in the sub directories.
Hope this helps. Good luck with your project :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.