Mercurial > hg
comparison mercurial/dirstateguard.py @ 33619:609606d21765
rebase: use one dirstateguard for when using rebase.singletransaction
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)
Differential Revision: https://phab.mercurial-scm.org/D135
author | Durham Goode <durham@fb.com> |
---|---|
date | Thu, 20 Jul 2017 01:30:41 -0700 |
parents | ec306bc6915b |
children | bbbbd3c30bfc |
comparison
equal
deleted
inserted
replaced
33610:658524d45af0 | 33619:609606d21765 |
---|---|
41 # for example, releasing other resources like transaction | 41 # for example, releasing other resources like transaction |
42 # may raise exception before ``dirstateguard.release`` in | 42 # may raise exception before ``dirstateguard.release`` in |
43 # ``release(tr, ....)``. | 43 # ``release(tr, ....)``. |
44 self._abort() | 44 self._abort() |
45 | 45 |
46 def __enter__(self): | |
47 return self | |
48 | |
49 def __exit__(self, exc_type, exc_val, exc_tb): | |
50 try: | |
51 if exc_type is None: | |
52 self.close() | |
53 finally: | |
54 self.release() | |
55 | |
46 def close(self): | 56 def close(self): |
47 if not self._active: # already inactivated | 57 if not self._active: # already inactivated |
48 msg = (_("can't close already inactivated backup: %s") | 58 msg = (_("can't close already inactivated backup: %s") |
49 % self._backupname) | 59 % self._backupname) |
50 raise error.Abort(msg) | 60 raise error.Abort(msg) |