Shyam Kumar Sundarakumar
Shyam Kumar Sundarakumar

Reputation: 5787

Setting svn:ignore flag using svnkit

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?

Upvotes: 3

Views: 1758

Answers (2)

olivieramblet
olivieramblet

Reputation: 21

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.

Upvotes: 2

VonC
VonC

Reputation: 1324733

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.

Upvotes: 3

Related Questions