Updating VcsRoot checkout rules from a TeamCity plugin

Hi,

I am writing a TeamCity plugin that needs to update the checkout rules for a VcsRoot. I see the current checkout rules by using CheckoutRules server side object.
But I would like to know what are the steps to actually change them. For example modify an IncludeRule. Do I need to recreate the entire CheckoutRules object and
use VcsSettingsBean to save it or is there another way to do it?

Thank you!

Best Regards,

Horace


2 comments

Checkout rules are bound to BuildType and VcsRoot. To set new checkout rules for a VcsRoot in a BuildType, use SBuildType::setCheckoutRules() method. CheckoutRules is a value object, so you can't update IncludeRules only. You need to recreate the whole object.

Note that there is no need to use VcsSettingsBean unless you do some unusual things. It is enough to call setCheckoutRules for a build type and then call SBuildType::persist() method to store configuration on disk.

0

Thank hou!

Best Regards,

Horace

0

Please sign in to leave a comment.