# HG changeset patch # User Pierre-Yves David # Date 2015-05-12 18:44:14 # Node ID 9a74b991958174460bf113ec5ddc74f85ee5a640 # Parent 747055706e857b245cf6ed6a29b9614b2163c3d8 commit: no longer allow empty commit with the 'force' argument (API) The new way to allow empty commit is to temporarily set the 'ui.allowemptycommit' config option. allowemptyback = repo.ui.backupconfig('ui', 'allowemptycommit') try: repo.ui.setconfig('ui', 'allowemptycommit', True) repo.commit(...) finally: repo.ui.restoreconfig(allowemptyback) All known uses of force for allowing empty commits have been removed, so let's remove it from the allowemptycommits condition. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1462,7 +1462,7 @@ class localrepository(object): cctx = context.workingcommitctx(self, status, text, user, date, extra) - allowemptycommit = (wctx.branch() != wctx.p1().branch() or force + allowemptycommit = (wctx.branch() != wctx.p1().branch() or extra.get('close') or merge or cctx.files() or self.ui.configbool('ui', 'allowemptycommit')) if not allowemptycommit: