diff -r 2bac2d836ce0 -r 228916ca12b5 mercurial/context.py --- a/mercurial/context.py Thu Dec 07 16:07:06 2017 -0800 +++ b/mercurial/context.py Thu Dec 07 22:35:43 2017 -0800 @@ -2102,6 +2102,12 @@ def isdirty(self, path): return path in self._cache + def isempty(self): + # We need to discard any keys that are actually clean before the empty + # commit check. + self._compact() + return len(self._cache) == 0 + def clean(self): self._cache = {}