support mutually_exclusive_group paramater in option registration

Review Request #4336 - Created Oct. 27, 2016 and submitted

Information
Yujie Chen
pants
3881, 4002
Reviewers
pants-reviews
benjyw, mateor, stuhood

The idea originates from option renaming process. To rename an option, we have to write a custom logic to prevent both options from being given and route value from "dest" of old option to "dest" of new option. With a "mutually_exclusive_group" argument in register(), old option can easily set it to be the new option. This patch implements the general "mutually exclusive" logic for options.

The way mutually_exclusive_group works is, in register() method, a user can specify "mutually_exclusive_group=XXX", then "XXX" will be the dest for this option. "XXX" can be the name of another option, or a totally new name. When more than 1 option with dest being XXX given through flags, env var or config file, pants will throw an exception.

https://travis-ci.org/pantsbuild/pants/builds/171997616

Issues

  • 0
  • 1
  • 0
  • 1
Description From Last Updated
Benjy Weinberger
Yujie Chen
Yujie Chen
Benjy Weinberger
Yujie Chen
Mateo Rodriguez
Yujie Chen
Yujie Chen
Review request changed

Status: Closed (submitted)

Change Summary:

Merged in https://github.com/pantsbuild/pants/commit/ba4269f3b1cfc0a414efde2aad8337f1251550b2.
Thanks Benjy and Mateo!

Loading...