This is an archive of the discontinued Mercurial Phabricator instance.

rebase: use one dirstateguard for when using rebase.singletransaction
ClosedPublic

Authored by durham on Jul 18 2017, 11:09 AM.

Details

Summary

This was previously landed as 2519994d25ca but backed out in b63351f6a2 because
it broke hooks mid-rebase and caused conflict resolution data loss in the event
of unexpected exceptions. This new version adds the behavior back but behind a
config flag, since the performance improvement is notable in large repositories.

The old commit message was:

Recently we switched rebases to run the entire rebase inside a single
transaction, which dramatically improved the speed of rebases in repos with
large working copies. Let's also move the dirstate into a single dirstateguard
to get the same benefits. This let's us avoid serializing the dirstate after
each commit.

In a large repo, rebasing 27 commits is sped up by about 20%.

I believe the test changes are because us touching the dirstate gave the
transaction something to actually rollback.
(grafted from 9e3dc3a1638b9754b58a0cb26aaa75d868058109)
(grafted from 7d38b41d2266d9a02a15c64229fae0da5738dcec)

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

durham created this revision.Jul 18 2017, 11:09 AM
martinvonz added inline comments.
hgext/rebase.py
483

As in the previous patch, this can be None here and in the cases below

durham updated this revision to Diff 274.Jul 18 2017, 2:14 PM
durham marked an inline comment as done.Jul 18 2017, 2:15 PM
martinvonz added inline comments.Jul 18 2017, 4:41 PM
mercurial/util.py
612–617

Are these necessary? Looks like the nullcontextmanager() is now only used where a plain contextmanager is expected. That should also mean that you should be able to replace this class by:

@contextlib.contextmanager
def nullcontextmanager():
    yield
durham updated this revision to Diff 338.Jul 20 2017, 4:33 AM
durham marked an inline comment as done.Jul 20 2017, 4:34 AM
martinvonz accepted this revision.Jul 20 2017, 11:54 AM

Looks good, but we're in code freeze, so it will have to wait until after.

This revision is now accepted and ready to land.Jul 20 2017, 11:54 AM
This revision was automatically updated to reflect the committed changes.