# HG changeset patch # User Matt Harbison # Date 2021-04-17 04:28:21 # Node ID d9531094cf8ef7098a2120160e22ad33acb7709f # Parent 2c843ad6852812eb1de9be7f1a03c81c631866d3 cmdutil: fix an uninitialize variable usage in clearunfinished() I happened to notice that PyCharm flagged this while looking for something else. I'm pretty sure it meant to check the current state in the iteration, and not keep reusing the last one in the previous iteration. Differential Revision: https://phab.mercurial-scm.org/D10459 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3776,7 +3776,7 @@ def clearunfinished(repo): raise error.StateError(state.msg(), hint=state.hint()) for s in statemod._unfinishedstates: - if s._opname == b'merge' or state._reportonly: + if s._opname == b'merge' or s._reportonly: continue if s._clearable and s.isunfinished(repo): util.unlink(repo.vfs.join(s._fname))