D594: cmdutil: removing redundant if condition in amend

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Sep 2 02:08:27 EDT 2017


martinvonz added inline comments.

INLINE COMMENTS

> cmdutil.py:3153-3162
>          if ((not node)
>              and newdesc == old.description()
>              and user == old.user()
>              and date == old.date()
>              and pureextra == old.extra()):
>              # nothing changed. continuing here would create a new node
>              # anyway because of the amend_source noise.

Ah, it's this stuff that makes the check unnecessary, I suppose. So the check was probably made unnecessary in commit https://phab.mercurial-scm.org/rHGa8aba292145681a23cee77f85b4376cc9b9cf0cc.

> cmdutil.py:3164-3173
>          ph = repo.ui.config('phases', 'new-commit', phases.draft)
>          try:
>              if opts.get('secret'):
>                  commitphase = 'secret'
>              else:
>                  commitphase = old.phase()
>              repo.ui.setconfig('phases', 'new-commit', commitphase, 'amend')

Since you're modifying this area, could you also clean this up using the ui.configoverride() context manager? (Obviously in a follow-up; it's not necessary for this series.)

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D594

To: singhsrb, #hg-reviewers
Cc: martinvonz, mercurial-devel


More information about the Mercurial-devel mailing list