hgext/rebase.py
changeset 36929 cc2bfc7d5362
parent 36928 9457c395fcbb
child 36930 36de8a3c429c
--- a/hgext/rebase.py	Thu Mar 08 14:17:24 2018 -0800
+++ b/hgext/rebase.py	Fri Mar 09 12:45:50 2018 -0800
@@ -1054,9 +1054,9 @@
 
     destphase = max(ctx.phase(), phases.draft)
     overrides = {('phases', 'new-commit'): destphase}
+    if keepbranch:
+        overrides[('ui', 'allowemptycommit')] = True
     with repo.ui.configoverride(overrides, 'rebase'):
-        if keepbranch:
-            repo.ui.setconfig('ui', 'allowemptycommit', True)
         # Replicates the empty check in ``repo.commit``.
         if wctx.isempty() and not repo.ui.configbool('ui', 'allowemptycommit'):
             return None
@@ -1096,9 +1096,9 @@
 
         destphase = max(ctx.phase(), phases.draft)
         overrides = {('phases', 'new-commit'): destphase}
+        if keepbranch:
+            overrides[('ui', 'allowemptycommit')] = True
         with repo.ui.configoverride(overrides, 'rebase'):
-            if keepbranch:
-                repo.ui.setconfig('ui', 'allowemptycommit', True)
             # Commit might fail if unresolved files exist
             if date is None:
                 date = ctx.date()