Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 34074:da13616d1a92
amend: moving first assignment of newid closer to its use
newid was needlessly further away from where its intended to be used
leading to bad readability. This commit moves it to address the same. The end
goal is to remove the redundant commit in the amend code path and this commit
takes care of cleaning up some unrelated code before that change.
Test Plan:
ran the test suite
Differential Revision: https://phab.mercurial-scm.org/D597
author | Saurabh Singh <singhsrb@fb.com> |
---|---|
date | Fri, 01 Sep 2017 12:34:36 -0700 |
parents | 7e9ccb1670e3 |
children | 4059b10d7490 |
comparison
equal
deleted
inserted
replaced
34073:7e9ccb1670e3 | 34074:da13616d1a92 |
---|---|
3037 ui.username() # raise exception if username not set | 3037 ui.username() # raise exception if username not set |
3038 | 3038 |
3039 ui.note(_('amending changeset %s\n') % old) | 3039 ui.note(_('amending changeset %s\n') % old) |
3040 base = old.p1() | 3040 base = old.p1() |
3041 | 3041 |
3042 newid = None | |
3043 with repo.wlock(), repo.lock(), repo.transaction('amend'): | 3042 with repo.wlock(), repo.lock(), repo.transaction('amend'): |
3044 # See if we got a message from -m or -l, if not, open the editor | 3043 # See if we got a message from -m or -l, if not, open the editor |
3045 # with the message of the changeset to amend | 3044 # with the message of the changeset to amend |
3046 message = logmessage(ui, opts) | 3045 message = logmessage(ui, opts) |
3047 # ensure logfile does not conflict with later enforcement of the | 3046 # ensure logfile does not conflict with later enforcement of the |
3162 # | 3161 # |
3163 # This not what we expect from amend. | 3162 # This not what we expect from amend. |
3164 return old.node() | 3163 return old.node() |
3165 | 3164 |
3166 ph = repo.ui.config('phases', 'new-commit', phases.draft) | 3165 ph = repo.ui.config('phases', 'new-commit', phases.draft) |
3166 newid = None | |
3167 try: | 3167 try: |
3168 if opts.get('secret'): | 3168 if opts.get('secret'): |
3169 commitphase = 'secret' | 3169 commitphase = 'secret' |
3170 else: | 3170 else: |
3171 commitphase = old.phase() | 3171 commitphase = old.phase() |