Mercurial > hg-stable
comparison hgext/fix.py @ 47793:e69c82bf3a01 stable
fix: use obsolete.isenabled() to check for experimental.allowdivergence
Now that obsolete.isenabled() can also check if divergence is allowed, let's
use it for consistency. Other experimental.evolution options are already
checked via this function.
Differential Revision: https://phab.mercurial-scm.org/D11222
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Wed, 28 Jul 2021 13:47:21 +0300 |
parents | 66ad7e32011f |
children | 86a60679cf61 155a2ec8a9dc |
comparison
equal
deleted
inserted
replaced
47792:16c60e90a496 | 47793:e69c82bf3a01 |
---|---|
146 error, | 146 error, |
147 match as matchmod, | 147 match as matchmod, |
148 mdiff, | 148 mdiff, |
149 merge, | 149 merge, |
150 mergestate as mergestatemod, | 150 mergestate as mergestatemod, |
151 obsolete, | |
151 pycompat, | 152 pycompat, |
152 registrar, | 153 registrar, |
153 rewriteutil, | 154 rewriteutil, |
154 scmutil, | 155 scmutil, |
155 util, | 156 util, |
450 | 451 |
451 def checkfixablectx(ui, repo, ctx): | 452 def checkfixablectx(ui, repo, ctx): |
452 """Aborts if the revision shouldn't be replaced with a fixed one.""" | 453 """Aborts if the revision shouldn't be replaced with a fixed one.""" |
453 if ctx.obsolete(): | 454 if ctx.obsolete(): |
454 # It would be better to actually check if the revision has a successor. | 455 # It would be better to actually check if the revision has a successor. |
455 allowdivergence = ui.configbool( | 456 if not obsolete.isenabled(repo, obsolete.allowdivergenceopt): |
456 b'experimental', b'evolution.allowdivergence' | |
457 ) | |
458 if not allowdivergence: | |
459 raise error.Abort( | 457 raise error.Abort( |
460 b'fixing obsolete revision could cause divergence' | 458 b'fixing obsolete revision could cause divergence' |
461 ) | 459 ) |
462 | 460 |
463 | 461 |