comparison hgext/rebase.py @ 31461:f255b1811f5e

rebase: get rid of ui.backupconfig
author Jun Wu <quark@fb.com>
date Thu, 16 Mar 2017 14:40:34 -0700
parents 406705701c2d
children 2519994d25ca
comparison
equal deleted inserted replaced
31460:03d99d08147b 31461:f255b1811f5e
849 keepbranch = keepbranches and repo[p1].branch() != ctx.branch() 849 keepbranch = keepbranches and repo[p1].branch() != ctx.branch()
850 extra = {'rebase_source': ctx.hex()} 850 extra = {'rebase_source': ctx.hex()}
851 if extrafn: 851 if extrafn:
852 extrafn(ctx, extra) 852 extrafn(ctx, extra)
853 853
854 backup = repo.ui.backupconfig('phases', 'new-commit') 854 targetphase = max(ctx.phase(), phases.draft)
855 try: 855 overrides = {('phases', 'new-commit'): targetphase}
856 targetphase = max(ctx.phase(), phases.draft) 856 with repo.ui.configoverride(overrides, 'rebase'):
857 repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase')
858 if keepbranch: 857 if keepbranch:
859 repo.ui.setconfig('ui', 'allowemptycommit', True) 858 repo.ui.setconfig('ui', 'allowemptycommit', True)
860 # Commit might fail if unresolved files exist 859 # Commit might fail if unresolved files exist
861 if date is None: 860 if date is None:
862 date = ctx.date() 861 date = ctx.date()
863 newnode = repo.commit(text=commitmsg, user=ctx.user(), 862 newnode = repo.commit(text=commitmsg, user=ctx.user(),
864 date=date, extra=extra, editor=editor) 863 date=date, extra=extra, editor=editor)
865 finally:
866 repo.ui.restoreconfig(backup)
867 864
868 repo.dirstate.setbranch(repo[newnode].branch()) 865 repo.dirstate.setbranch(repo[newnode].branch())
869 dsguard.close() 866 dsguard.close()
870 return newnode 867 return newnode
871 finally: 868 finally: