views:

387

answers:

2

I am using SVNKit in my application. I have a scenario wherein certain files should be ignored when doing svn operations. i.e. I need to set the svn:ignore property for certain patterns.

How do I do that using SVNKit?

+2  A: 

You could use the ISVNOptions class.

It has a addIgnorePattern() function which should allow you to ignore file based on a given pattern.

If you want to ignore "ignore" within a specific directory, you have to set svn:ignore property on its parent directory, not on the file itself (as being ignored that file will never be added to repository).

File dir = file.getParentFile().getAbsoluteFile();
ourClientManager.getWCClient().doSetProperty(dir, SVNProperty.IGNORE,
    file.getName(), false, false, null);

To ignore more than one file in a directory, svn:ignore property value should contain a line for each ignored file, e.g:

a\n
b\n
*.bin

As soon as property is set, commit directory to make new property value be stored in repository.

VonC
+1  A: 

The argument list is (file, propName, propValue, force, recursive, IPropertyHandler).

So if you want to recursively apply a property, just set it 5th argument(recursive) to true.

olivieramblet