# HG changeset patch # User Jun Wu # Date 1489700358 25200 # Node ID 03d99d08147b473a1a21fe58c5b2b4257888964c # Parent f84fbd27b6d38c539f1ae8b7af712ec658210204 mq: get rid of ui.backupconfig diff -r f84fbd27b6d3 -r 03d99d08147b hgext/mq.py --- a/hgext/mq.py Thu Mar 16 14:36:35 2017 -0700 +++ b/hgext/mq.py Thu Mar 16 14:39:18 2017 -0700 @@ -405,18 +405,12 @@ if phase is None: if repo.ui.configbool('mq', 'secret', False): phase = phases.secret + overrides = {('ui', 'allowemptycommit'): True} if phase is not None: - phasebackup = repo.ui.backupconfig('phases', 'new-commit') - allowemptybackup = repo.ui.backupconfig('ui', 'allowemptycommit') - try: - if phase is not None: - repo.ui.setconfig('phases', 'new-commit', phase, 'mq') + overrides[('phases', 'new-commit')] = phase + with repo.ui.configoverride(overrides, 'mq'): repo.ui.setconfig('ui', 'allowemptycommit', True) return repo.commit(*args, **kwargs) - finally: - repo.ui.restoreconfig(allowemptybackup) - if phase is not None: - repo.ui.restoreconfig(phasebackup) class AbortNoCleanup(error.Abort): pass