end-user
end-user

Reputation: 2947

is it possible for subversion to ignore all directory contents except one file?

I have a /packages directory with one file in it that I want to commit and watch. However, if new things are added, I'd like to ignore them. Is that possible?

Upvotes: 2

Views: 1036

Answers (5)

G J
G J

Reputation: 517

I am using Tortoise git and i have ignored the packages via. .gitignore file as below. If I make changes in repositories.config file, the changes window shows it:

# Visual Studio Nuget package directory
packages/*/

Upvotes: 0

Ashwin Bhargava
Ashwin Bhargava

Reputation: 76

Add a custom hook which will work only on that file. You may code that as a batch file or a perl file. Put the file in your subversion custom hooks folder or hooks folder and the code may be running on post commit that you get notified only for that file not the others in that folder.

Upvotes: 0

Ben
Ben

Reputation: 8905

If a file matches the ignore pattern, nothing prevents you from manually adding that file to SVN. Then SVN will track that file as normal, you can commit changes and see modifications without difficulty. The only thing the ignore list affects, is new files that are not under revision control.

Upvotes: 2

gbjbaanb
gbjbaanb

Reputation: 52659

You could always try using the changelists feature - place all the other files on your ignore-on-commit changelist and they won't bother you again. This might not be quite what you want though.

You can however exclude files using the sparse directory feature, setting the depth to "exclude". This works with individual files (well, it does using TortoiseSVN and the 'make depth sticky' option - the file will disappear from your working copy, not coming back if you update, unless you reset the directory depth)

Be careful to set the depth on the files, not the directory. Any files subsequently added will appear in your directory and you'll have to exclude them too. It's probably possible to set the directory to exclude everything and then re-include just the 1 file you want - I haven't tried that, let us know if it works.

Upvotes: 0

Satii
Satii

Reputation: 1

It can be done using pre-commit hook feature. You can ignore all the file names other than that file to get committed. See this link for more information http://pear.php.net/manual/en/package.php.php-codesniffer.svn-pre-commit.php

Upvotes: 0

Related Questions