##// END OF EJS Templates
amend: use context manager for config override...
Martin von Zweigbergk -
r34083:5dc6ac65 default
parent child Browse files
Show More
@@ -35,7 +35,6 b' from . import ('
35 obsolete,
35 obsolete,
36 patch,
36 patch,
37 pathutil,
37 pathutil,
38 phases,
39 pycompat,
38 pycompat,
40 registrar,
39 registrar,
41 revlog,
40 revlog,
@@ -3162,16 +3161,13 b' def amend(ui, repo, commitfunc, old, ext'
3162 # This not what we expect from amend.
3161 # This not what we expect from amend.
3163 return old.node()
3162 return old.node()
3164
3163
3165 ph = repo.ui.config('phases', 'new-commit', phases.draft)
3166 try:
3167 if opts.get('secret'):
3164 if opts.get('secret'):
3168 commitphase = 'secret'
3165 commitphase = 'secret'
3169 else:
3166 else:
3170 commitphase = old.phase()
3167 commitphase = old.phase()
3171 repo.ui.setconfig('phases', 'new-commit', commitphase, 'amend')
3168 overrides = {('phases', 'new-commit'): commitphase}
3169 with ui.configoverride(overrides, 'amend'):
3172 newid = repo.commitctx(new)
3170 newid = repo.commitctx(new)
3173 finally:
3174 repo.ui.setconfig('phases', 'new-commit', ph, 'amend')
3175
3171
3176 # Reroute the working copy parent to the new changeset
3172 # Reroute the working copy parent to the new changeset
3177 repo.setparents(newid, nullid)
3173 repo.setparents(newid, nullid)
General Comments 0
You need to be logged in to leave comments. Login now