Mercurial > hg-stable
changeset 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 | 747055706e85 |
children | 10bbdcd89164 |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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: