3160 # anyway because of the amend_source noise. |
3159 # anyway because of the amend_source noise. |
3161 # |
3160 # |
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) |
3164 if opts.get('secret'): |
3166 try: |
3165 commitphase = 'secret' |
3167 if opts.get('secret'): |
3166 else: |
3168 commitphase = 'secret' |
3167 commitphase = old.phase() |
3169 else: |
3168 overrides = {('phases', 'new-commit'): commitphase} |
3170 commitphase = old.phase() |
3169 with ui.configoverride(overrides, 'amend'): |
3171 repo.ui.setconfig('phases', 'new-commit', commitphase, '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) |
3178 mapping = {old.node(): (newid,)} |
3174 mapping = {old.node(): (newid,)} |
3179 if node: |
3175 if node: |