comparison hgext/rebase.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 a0192a03216d
children 0ecb3b11fcad
comparison
equal deleted inserted replaced
45086:ab33782deb84 45087:83f75f1efdcc
1425 1425
1426 1426
1427 def commitmemorynode(repo, wctx, editor, extra, user, date, commitmsg): 1427 def commitmemorynode(repo, wctx, editor, extra, user, date, commitmsg):
1428 '''Commit the memory changes with parents p1 and p2. 1428 '''Commit the memory changes with parents p1 and p2.
1429 Return node of committed revision.''' 1429 Return node of committed revision.'''
1430 # Replicates the empty check in ``repo.commit``. 1430 # FIXME: make empty commit check consistent with ``repo.commit``
1431 if wctx.isempty() and not repo.ui.configbool(b'ui', b'allowemptycommit'): 1431 if wctx.nofilechanges() and not repo.ui.configbool(
1432 b'ui', b'allowemptycommit'
1433 ):
1432 return None 1434 return None
1433 1435
1434 # By convention, ``extra['branch']`` (set by extrafn) clobbers 1436 # By convention, ``extra['branch']`` (set by extrafn) clobbers
1435 # ``branch`` (used when passing ``--keepbranches``). 1437 # ``branch`` (used when passing ``--keepbranches``).
1436 branch = None 1438 branch = None