Mercurial > evolve
changeset 5917:94aed9c7ce69 stable
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).
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sat, 15 May 2021 20:40:19 +0800 |
parents | 126b9be3482d |
children | 13c406d9912c |
files | hgext3rd/evolve/__init__.py |
diffstat | 1 files changed, 1 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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