dirstate: use a context manager when writing the dirstate
This make sure the file is closed in a timely manner.
We define a lambda for the file opening. It might seems a bit overkill here but
a future changeset will need to do more of those.
Differential Revision: https://phab.mercurial-scm.org/D12122
Added signature for changeset
75676122c2bf
Added tag 6.0.2 for changeset
75676122c2bf
relnotes: add 6.0.1 and 6.0.2 notes
Differential Revision: https://phab.mercurial-scm.org/D12130
branchmap: stop writing cache for uncommitted data
If we are about to write the branch while a transaction is active. we delay
that write. After the transaction is closed, we flush all the write we delayed
(unless they have been written in between).
Differential Revision: https://phab.mercurial-scm.org/D12128
transaction: add a way to know a transaction has been finalized
This will be useful to fix the timing of the branchmap on disk caching.
Differential Revision: https://phab.mercurial-scm.org/D12127
branchmap: Add a test about writing branchmap and aborted transaction
It turn out that we update the branchmap on disk whenever we recompute it…
including in a middle of a transaction. This means writing the new branchmap too
early (the changeset are not visible yet) and worse… it mean writing branchmap
for transaction we rollback.
so we introduce a test to highlight the issue (and prevent it to regress in the
future).
Differential Revision: https://phab.mercurial-scm.org/D12126
dirstate-v2: rename the configuration to enable the format
The rename of the old experimental name was overlooked before the 6.0 release.
We rename everything to use the new name (and keep the released name as an alias
for compatibility).
Differential Revision: https://phab.mercurial-scm.org/D12129
arbitraryfilectx: use our existing helpers for reading and writing files
Differential Revision: https://phab.mercurial-scm.org/D12090
fix: remove unnecessary and overly strict check for divergence
`rewriteutil.precheck()` checks for divergence these days, so we can
remove the redundant check in `hg fix`.
Differential Revision: https://phab.mercurial-scm.org/D12088
encoding: fix trim() to be O(n) instead of O(n^2)
`encoding.trim()` iterated over the possible lengths smaller than the
input and created a slice for each. It then calculated the column
width of the result, which is of course O(n), so the overall algorithm
was O(n). This patch rewrites it to iterate over the unicode
characters, keeping track of the length so far. Also, the old
algorithm started from the end of the string, which made it much worse
when the input is large and the limit is small (such as the typical 72
we pass to it).
You can time it by running something like this:
```
time python3 -c 'from mercurial.utils import stringutil; print(stringutil.ellipsis(b"
0123456789" * 1000, 5))'
```
That drops from 4.05 s to 83 ms with this patch (and most of that is
of course startup time).
Differential Revision: https://phab.mercurial-scm.org/D12089