D7984: clean: check that there are no conflicts after

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Jan 24 17:36:53 UTC 2020


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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).

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7984

AFFECTED FILES
  mercurial/hg.py

CHANGE DETAILS

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -1040,10 +1040,10 @@
 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()



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list