# HG changeset patch # User Anton Shestakov # Date 1621082419 -28800 # Node ID 94aed9c7ce6904add95f4851c6195ba31c12494a # Parent 126b9be3482d849c08c82cd32e0a42f6d49eeec3 next: refactor two if blocks into an if-elif block We already checked the value of `needevolve and opts['evolve']` in the first if block above. In the first one it need to be True, in the second it needs to be False for the statements to execute. Since not(a or b) = not a and not b, we can join the second if block to the first one with an elif while dropping the explicit check. For me, this works better, because we're doing the same thing in both of these blocks (checking if working copy is dirty or not). diff -r 126b9be3482d -r 94aed9c7ce69 hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Sat May 15 20:27:53 2021 +0800 +++ b/hgext3rd/evolve/__init__.py Sat May 15 20:40:19 2021 +0800 @@ -882,8 +882,7 @@ if needevolve and opts['evolve']: hint = _(b'use `hg amend`, `hg revert` or `hg shelve`') cmdutil.bailifchanged(repo, hint=hint) - - if not (opts['merge'] or (needevolve and opts['evolve'])): + elif not opts['merge']: # we only skip the check if noconflict is set if ui.config(b'commands', b'update.check') == b'noconflict': pass