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?
Well, I don't know if I miss something, but you can use any pattern you want:
You can check with:
Another way is to use an alias / script that can do complex parsing when committing.
The best solution I find to use myself is to completely separate the versioned tree of source files from the build tree. This way you do not generate things in your versioned tree of a directory. Then you can only use
svn:ignore
to ignore simple artefacts generated by text editors for example.EDIT:
Sorry my mistake for the first solution, I have misread your post. The two other ways seems relevant even if not exactly what you want...
Have a look at http://www.thoughtspark.org/node/38. 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:
This is what I have set on
bin
folder forsvn:ignore
property to match everything except apk files:If there would be full RegExp support you could use negative lookbehind, but that's rarely implemented anyway (e.g not in JavaScript) and is inefficient.
The following works for me and gets rid of a few quirks of the other suggestions.
A line by line explanation follows:
Limitations:
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.
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.