Mercurial > hg
comparison tests/test-update-branches.t @ 29947:e1f0ec0b7d2d
flags: allow specifying --no-boolean-flag on the command line (BC)
This makes it much easier to enable some anti-foot-shooting features
(like update --check) by default, because now all boolean flags can be
explicitly disabled on the command line without having to use HGPLAIN
or similar. Flags which don't deserve this treatment can be removed
from consideration by adding them to the nevernegate set in fancyopts.
This doesn't make it any easier to identify when a flag is set: opts
still always gets filled in, either with the user-specified flag value
or with the default from the flags list in the command
table. Improving that would probably clean things up a bit, but for
now if you want a boolean flag and care if it was explicitly false or
default false (or true, but nobody uses that functionality because
before now it was nonsense) you need to use None as your default
rather than True or False.
This doesn't (yet) update help output, because I'm not quite sure how
to do that cleanly.
author | Augie Fackler <augie@google.com> |
---|---|
date | Tue, 13 Sep 2016 22:57:57 -0400 |
parents | d0210a35c81a |
children | 40f845537dca |
comparison
equal
deleted
inserted
replaced
29946:285a8c3e53f2 | 29947:e1f0ec0b7d2d |
---|---|
377 | 377 |
378 Test experimental revset support | 378 Test experimental revset support |
379 | 379 |
380 $ hg log -r '_destupdate()' | 380 $ hg log -r '_destupdate()' |
381 2:bd10386d478c 2 (no-eol) | 381 2:bd10386d478c 2 (no-eol) |
382 | |
383 Test that boolean flags allow --no-flag specification to override [defaults] | |
384 $ cat >> $HGRCPATH <<EOF | |
385 > [defaults] | |
386 > update = --check | |
387 > EOF | |
388 $ hg co 2 | |
389 abort: uncommitted changes | |
390 [255] | |
391 $ hg co --no-check 2 | |
392 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |