Mercurial > hg
view tests/test-patch.t @ 41247:a89b20a49c13
rust-cpython: using MissingAncestors from Python code
As precedently done with LazyAncestors on cpython.rs, we test for the
presence of the 'rustext' module.
incrementalmissingrevs() has two callers within the Mercurial core:
`setdiscovery.partialdiscovery` and the `only()` revset.
This move shows a significant discovery performance improvement
in cases where the baseline is slow: using perfdiscovery on the PyPy
repos, prepared with `contrib/discovery-helper <repo> 50 100`, we
get averaged medians of 403ms with the Rust version vs 742ms without
(about 45% better).
But there are still indications that performance can be worse in cases
the baseline is fast, possibly due to the conversion from Python to
Rust and back becoming the bottleneck. We could measure this on
mozilla-central in cases were the delta is just a few changesets.
This requires confirmation, but if that's the reason, then an
upcoming `partialdiscovery` fully in Rust should solve the problem.
Differential Revision: https://phab.mercurial-scm.org/D5551
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Fri, 30 Nov 2018 14:35:57 +0100 |
parents | 5abc47d4ca6b |
children | 42d2b31cee0b |
line wrap: on
line source
$ cat > patchtool.py <<EOF > from __future__ import absolute_import, print_function > import sys > print('Using custom patch') > if '--binary' in sys.argv: > print('--binary found !') > EOF $ echo "[ui]" >> $HGRCPATH $ echo "patch=\"$PYTHON\" ../patchtool.py" >> $HGRCPATH $ hg init a $ cd a $ echo a > a $ hg commit -Ama -d '1 0' adding a $ echo b >> a $ hg commit -Amb -d '2 0' $ cd .. This test checks that: - custom patch commands with arguments actually work - patch code does not try to add weird arguments like --binary when custom patch commands are used. For instance --binary is added by default under win32. check custom patch options are honored $ hg --cwd a export -o ../a.diff tip $ hg clone -r 0 a b adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files new changesets 8580ff50825a updating to branch default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg --cwd b import -v ../a.diff applying ../a.diff Using custom patch applied to working directory Issue2417: hg import with # comments in description Prepare source repo and patch: $ rm $HGRCPATH $ hg init c $ cd c $ printf "a\rc" > a $ hg ci -A -m 0 a -d '0 0' $ printf "a\rb\rc" > a $ cat << eof > log > first line which can't start with '# ' > # second line is a comment but that shouldn't be a problem. > A patch marker like this was more problematic even after d7452292f9d3: > # HG changeset patch > # User lines looks like this - but it _is_ just a comment > eof $ hg ci -l log -d '0 0' $ hg export -o p 1 $ cd .. Clone and apply patch: $ hg clone -r 0 c d adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files new changesets 7fadb901d403 updating to branch default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd d $ hg import ../c/p applying ../c/p $ hg log -v -r 1 changeset: 1:cd0bde79c428 tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 files: a description: first line which can't start with '# ' # second line is a comment but that shouldn't be a problem. A patch marker like this was more problematic even after d7452292f9d3: # HG changeset patch # User lines looks like this - but it _is_ just a comment Error exit (issue4746) $ cat >> exit1.py <<EOF > import sys > sys.exit(1) > EOF $ hg import ../c/p --config ui.patch="\"$PYTHON\" \"`pwd`/exit1.py\"" applying ../c/p abort: patch command failed: exited with status 1 [255] $ cd ..