Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 45087:83f75f1efdcc
overlayworkingctx: rename misleadingly named `isempty()` method
This method is only about whether there are file changes, not about whether the
commit will be empty or not.
One user of the method was incorrectly assuming the latter meaning, leading to
the bug for which a test case was added in D8727. I?ve added a FIXME to the
code.
The original motivation for the rename was that I want to add
`committablectx.isempty()`, that properly checks if a commit will be empty,
using the exact same logic as in `repo.commit()`, and I wanted to avoid a name
clash.
Differential Revision: https://phab.mercurial-scm.org/D8728
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sat, 11 Jul 2020 00:53:34 +0200 |
parents | a56ba57c837d |
children | 3e40abe0a170 |
comparison
equal
deleted
inserted
replaced
45086:ab33782deb84 | 45087:83f75f1efdcc |
---|---|
2517 ) | 2517 ) |
2518 | 2518 |
2519 def isdirty(self, path): | 2519 def isdirty(self, path): |
2520 return path in self._cache | 2520 return path in self._cache |
2521 | 2521 |
2522 def isempty(self): | 2522 def nofilechanges(self): |
2523 # We need to discard any keys that are actually clean before the empty | 2523 # We need to discard any keys that are actually clean before the empty |
2524 # commit check. | 2524 # commit check. |
2525 self._compact() | 2525 self._compact() |
2526 return len(self._cache) == 0 | 2526 return len(self._cache) == 0 |
2527 | 2527 |