With the svn:ignore property, is there a way I can specify what I want to ignore based on patterns which I don't want to ignore? In other words, I want to ignore everything but files ending in .xyz. How would I go about doing that (if it's even possible)?
One option I've explored is committing everything I want to be versioned, then setting the svn:ignore property on the directory to be '*', thus meaning no other files but what I've already committed will be versioned. This is the best I can come up with, but it feels dirty in that if I ever did need to add another file to be version, I'd have to make multiple commits... one to remove the svn:ignore property, another to add/commit the new file(s), and then a third to change svn:ignore back to '*'.
Your thoughts?
Use the following command to create a list not under version control files. Then edit the file to leave just the files you want actually to ignore. Then use this one to ignore the files listed in the file: svn propset svn:ignore -F ignoring.
The svn:ignore property is a good way to tell Subversion to ignore files that are likely to be present in every user's working copy of that directory, such as compiler output or—to use an example more appropriate to this book—the HTML, PDF, or PostScript files generated as the result of a conversion of some source ...
To ignore files in subversion you want to set the svn:ignore property. You can see more here http://svnbook.red-bean.com/en/1.8/svn.advanced.props.special.ignore.html about half way down. svn propset svn:ignore target . svn propedit svn:ignore .
Have a look at Using negative patterns for Subversion's svn:ignore property. Obviously you can use "!" in character groups to negate its meaning. So if you want to ignore everything except files ending with .java, set the following pattern to svn:ignore:
*[!j][!a][!v][!a]
*.java?*
No, there is no exclusive matching like you described. This article lists the possibilities for pattern matching. It's limited to:
?
- Matches any single character*
- Matches any string of characters, including the empty string[
- Begins a character class definition terminated by ]
, used for matching a subset of charactersA similar question was asked already here.
That's the only solution I know of. You can explicitly add files even if they are ignored though.
You would need to add that setting on all subdirectories though.
# Create a repository with property ignore *
[wlynch@orange ~] cd /tmp
[wlynch@orange /tmp] svnadmin create foo
[wlynch@orange /tmp] svn co file:///tmp/foo co
Checked out revision 0.
[wlynch@orange /tmp] cd co
[wlynch@orange co] svn propset svn:ignore \* .
property 'svn:ignore' set on '.'
# Create 3 files
[wlynch@orange co] touch a
[wlynch@orange co] touch b
[wlynch@orange co] touch c
# We can add all 3 of these files in one transaction
[wlynch@orange co] svn status
M .
[wlynch@orange co] svn add a
A a
[wlynch@orange co] svn add b
A b
[wlynch@orange co] svn status
M .
A a
A b
[wlynch@orange co] svn add c
A c
[wlynch@orange co] svn ci
Sending .
Adding a
Adding b
Adding c
Transmitting file data ...
Committed revision 1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With