This is an archive of the discontinued Mercurial Phabricator instance.

cmdutil: remove the redundant commit during amend
ClosedPublic

Authored by singhsrb on Sep 5 2017, 8:56 PM.

Details

Summary

There was an extra commit made during the amend operation to track the
changes to the working copy. However, this logic was written a long time back
and newer API's make this extra commit redundant. Therefore, I am removing the
extra commit. After this change, I noticed that

  • Execution time of the cmdutil.amend improved by over 40%.
  • Execution time of "hg commit --amend" improved by over 20%.
Test Plan

I ensured that the all the hg tests passed after the change. I had
to fix a few tests which were aware of the extra commit made during the amend.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

singhsrb created this revision.Sep 5 2017, 8:56 PM

I fixed a few nits in flight and queued this. Thanks for cleaning this up!

mercurial/cmdutil.py
3074–3078

Looks like this loses the dirstateguard from cmdutil.commit() (and duplicates the message). Perhaps it will be easier to let the caller do the addremove() call and the locking (it already does the locking, so the locking above seems unnecessary). Anyway, this seems fine for now.

3080

nit: No need to make a list and then a set, you should be able to just drop the brackets

3104

nit: usually written "path not in filestoamend"

3195–3196

nit: i think we usually write "a & b" instead of "a.intersection(b)"

This revision was automatically updated to reflect the committed changes.
singhsrb marked 4 inline comments as done.Dec 5 2017, 3:28 PM