简体   繁体   中英

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. ie I need to set the svn:ignore property for certain patterns.

How do I do that using SVNKit?

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, eg:

a\n
b\n
*.bin

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM