# HG changeset patch # User Martin von Zweigbergk # Date 2020-01-24 17:33:02 # Node ID abcc82bf0717ddedb4d268471410c788759fecdf # Parent df2162672d2441d971312179c3afa08bb2272290 clean: check that there are no conflicts after As noted by Pulkit, there should never be any conflicts after doing a clean update, so `hg.clean()` should never return `True`. Let's check that assertion instead to clarify the code. The callers will now get a `None` instead of a `False` returned, but that should be fine (both result in a 0 exit status). Differential Revision: https://phab.mercurial-scm.org/D7984 diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -1040,10 +1040,10 @@ def update(repo, node, quietempty=False, def clean(repo, node, show_stats=True, quietempty=False): """forcibly switch the working directory to node, clobbering changes""" stats = updaterepo(repo, node, True) + assert stats.unresolvedcount == 0 repo.vfs.unlinkpath(b'graftstate', ignoremissing=True) if show_stats: _showstats(repo, stats, quietempty) - return stats.unresolvedcount > 0 # naming conflict in updatetotally()