##// END OF EJS Templates
encoding: fix trim() to be O(n) instead of O(n^2)...
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

File last commit:

r47778:32b52741 stable
r49518:f1ed5c30 default
Show More
5.8
68 lines | 2.7 KiB | application/x-troff | GroffLexer
== New Features ==
* `hg purge` is now a core command using `--confirm` by default.
* The `rev-branch-cache` is now updated incrementally whenever changesets
are added.
* The new options `experimental.bundlecompthreads` and
`experimental.bundlecompthreads.<engine>` can be used to instruct
the compression engines for bundle operations to use multiple threads
for compression. The default is single threaded operation. Currently
only supported for zstd.
== Default Format Change ==
These changes affects newly created repositories (or new clone) done with
Mercurial 5.8.
* The `ZSTD` compression will now be used by default for new repositories
when available. This compression format was introduced in Mercurial 5.0,
released in May 2019. See `hg help config.format.revlog-compression` for
details.
* Mercurial installation built with the Rust parts will now use the
"persistent nodemap" feature by default. This feature was introduced in
Mercurial 5.4 (May 2020). However Mercurial instalation built without the
fast Rust implementation will refuse to interract with them by default.
This restriction can be lifted through configuration.
See `hg help config.format.use-persistent-nodemap` for details
== New Experimental Features ==
* There's a new `diff.merge` config option to show the changes
relative to an automerge for merge changesets. This makes it
easier to detect and review manual changes performed in merge
changesets. It is supported by `hg diff --change`, `hg log -p`
`hg incoming -p`, and `hg outgoing -p` so far.
== Bug Fixes ==
* gracefully recover from inconsistent persistent-nodemap data from disk.
== Backwards Compatibility Changes ==
* In normal repositories, the first parent of a changeset is not null,
unless both parents are null (like the first changeset). Some legacy
repositories violate this condition. The revlog code will now
silentely swap the parents if this condition is tested. This can
change the output of `hg log` when explicitly asking for first or
second parent. The changesets "nodeid" are not affected.
== Internal API Changes ==
* `changelog.branchinfo` is deprecated and will be removed after 5.8.
It is superseded by `changelogrevision.branchinfo`.
* Callbacks for revlog.addgroup and the changelog._nodeduplicatecallback hook
now get a revision number as argument instead of a node.
* revlog.addrevision returns the revision number instead of the node.
* `nodes.nullid` and related constants are being phased out as part of
the deprecation of SHA1. Repository instances and related classes
provide access via `nodeconstants` and in some cases `nullid` attributes.