commit: no longer allow empty commit with the 'force' argument (API)
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 12 May 2015 11:44:14 -0700
changeset 25021 9a74b9919581
parent 25020 747055706e85
child 25022 10bbdcd89164
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.
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Mon May 11 20:15:41 2015 -0700
+++ b/mercurial/localrepo.py	Tue May 12 11:44:14 2015 -0700
@@ -1462,7 +1462,7 @@
             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: