Mercurial > hg
comparison hgext/rebase.py @ 36929:cc2bfc7d5362
rebase: also restore "ui.allowemptycommit" value
It looks like this was lost when the code was converted to the
ui.configoverride() context manager in f255b1811f5e (rebase: get rid
of ui.backupconfig, 2017-03-16). (And then the bad example was
duplicated in 228916ca12b5 (rebase: add concludememorynode(), and call
it when rebasing in-memory, 2017-12-07).)
Differential Revision: https://phab.mercurial-scm.org/D2760
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 09 Mar 2018 12:45:50 -0800 |
parents | 9457c395fcbb |
children | 36de8a3c429c |
comparison
equal
deleted
inserted
replaced
36928:9457c395fcbb | 36929:cc2bfc7d5362 |
---|---|
1052 if extrafn: | 1052 if extrafn: |
1053 extrafn(ctx, extra) | 1053 extrafn(ctx, extra) |
1054 | 1054 |
1055 destphase = max(ctx.phase(), phases.draft) | 1055 destphase = max(ctx.phase(), phases.draft) |
1056 overrides = {('phases', 'new-commit'): destphase} | 1056 overrides = {('phases', 'new-commit'): destphase} |
1057 if keepbranch: | |
1058 overrides[('ui', 'allowemptycommit')] = True | |
1057 with repo.ui.configoverride(overrides, 'rebase'): | 1059 with repo.ui.configoverride(overrides, 'rebase'): |
1058 if keepbranch: | |
1059 repo.ui.setconfig('ui', 'allowemptycommit', True) | |
1060 # Replicates the empty check in ``repo.commit``. | 1060 # Replicates the empty check in ``repo.commit``. |
1061 if wctx.isempty() and not repo.ui.configbool('ui', 'allowemptycommit'): | 1061 if wctx.isempty() and not repo.ui.configbool('ui', 'allowemptycommit'): |
1062 return None | 1062 return None |
1063 | 1063 |
1064 if date is None: | 1064 if date is None: |
1094 if extrafn: | 1094 if extrafn: |
1095 extrafn(ctx, extra) | 1095 extrafn(ctx, extra) |
1096 | 1096 |
1097 destphase = max(ctx.phase(), phases.draft) | 1097 destphase = max(ctx.phase(), phases.draft) |
1098 overrides = {('phases', 'new-commit'): destphase} | 1098 overrides = {('phases', 'new-commit'): destphase} |
1099 if keepbranch: | |
1100 overrides[('ui', 'allowemptycommit')] = True | |
1099 with repo.ui.configoverride(overrides, 'rebase'): | 1101 with repo.ui.configoverride(overrides, 'rebase'): |
1100 if keepbranch: | |
1101 repo.ui.setconfig('ui', 'allowemptycommit', True) | |
1102 # Commit might fail if unresolved files exist | 1102 # Commit might fail if unresolved files exist |
1103 if date is None: | 1103 if date is None: |
1104 date = ctx.date() | 1104 date = ctx.date() |
1105 newnode = repo.commit(text=commitmsg, user=ctx.user(), | 1105 newnode = repo.commit(text=commitmsg, user=ctx.user(), |
1106 date=date, extra=extra, editor=editor) | 1106 date=date, extra=extra, editor=editor) |