3

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?

Alex B
  • 24,678
  • 14
  • 64
  • 87
Shyam Kumar Sundarakumar
  • 5,649
  • 13
  • 42
  • 69

2 Answers2

3

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,262,500
  • 529
  • 4,410
  • 5,250
2

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.