comparison mercurial/localrepo.py @ 25021:9a74b9919581

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 12 May 2015 11:44:14 -0700
parents 93e015a3d1ea
children d1d69ca78883
comparison
equal deleted inserted replaced
25020:747055706e85 25021:9a74b9919581
1460 fail(f, _("file not tracked!")) 1460 fail(f, _("file not tracked!"))
1461 1461
1462 cctx = context.workingcommitctx(self, status, 1462 cctx = context.workingcommitctx(self, status,
1463 text, user, date, extra) 1463 text, user, date, extra)
1464 1464
1465 allowemptycommit = (wctx.branch() != wctx.p1().branch() or force 1465 allowemptycommit = (wctx.branch() != wctx.p1().branch()
1466 or extra.get('close') or merge or cctx.files() 1466 or extra.get('close') or merge or cctx.files()
1467 or self.ui.configbool('ui', 'allowemptycommit')) 1467 or self.ui.configbool('ui', 'allowemptycommit'))
1468 if not allowemptycommit: 1468 if not allowemptycommit:
1469 return None 1469 return None
1470 1470