# HG changeset patch # User Raphaël Gomès # Date 2024-02-12 15:22:47 # Node ID 508fd40dc86aa0b81b24181331e0b1fc52043bad # Parent 99869dcf3ba06679d73db591a87e739d035770be # Parent 5f62d45e5289d3a4808b6f173ca3847adbe3ecea branching: merge stable into default diff --git a/.hgsigs b/.hgsigs --- a/.hgsigs +++ b/.hgsigs @@ -255,3 +255,4 @@ 27055614b68538576fb0439007009acf93fe0a49 26c57e7a0890b96e2c473b394de380d6753c9230 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmVcykAZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmRldgAKCRChHgHNDgXZVoGeC/0Uvynfd4xJMSa3ef4lOrw3l0PsOMzLwcITC5b4SlMfo8sHDq1Vr169z/IvI/FhJ8LmK/Spg7OK6TkqJ33fOmpnKZji8oCstM8q0P6xZh55RIE4St8Px/TuC99HvB41sPgcBDQf/dfvXqUKHImxH5C21p93AkvdCie9sdeYzy23VSn1URBBRkfToB6U7QDvktiKE4Hy/mJolNd0FlTOrRiD7K4bzstaLZP8kO1gJQPCPBjqN8glXN/arebcdu8zD7sE22JZA87pJljY7Wy3P6O1zRol2qDPCBshK2zDbrljyOaKR10ciHUBJV0V11nK6xIZ4XE2N4xes3fYlBNsudHXvLutCv40e1VDVjRe2X6ayRZCnKkYI0s4oTl9oFo5olrsfeC5+b/exqB8oTCCqmMFdz3/QFO7/pQ3xck2XaWucG+o3R/y91t6Uy+5LPtIOsR5IevvPIiebpQgIMJkOIRrz5j59U+MafTSGfaDel/niPISQPWZ9T0ORS6q9uNRHCo= 71bd09bebbe36a09569cbfb388f371433360056b 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmVxxyYZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmRldgAKCRChHgHNDgXZVrr4C/9UvrFMEo1DOzFP6RpGDnRUEl6ejUBy2cjQ1HXCLZV8zYQxpBK9dMqoLwjv1FKgIwCXEJCWs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O1hlY3NVpk01F2w= +3fd1efb3ad124e6686c0fb66e6943cd8aeea5681 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmXKNjoZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmRldgAKCRChHgHNDgXZVhW9DACokMQuCQ6QzyrgXmAFwcg0czClQ7lJBfV+IHKk1oRmVWUj1jifKI2S3+BU1RgBO7FiG9r6NFOdCiL78VJN0W3YlBPW+Mp8joBkXGOyFiob4MI0w7Up04LLdVtvms2eEuAH7XVcRgbgWOcU6aTwcenYXMVkenhGShbKJBZU7ogAbu/y156bTmhuj3SVxUvmgtvXEACwHnPgdEdIPlssf7dDm6XHWhAU+60I2L5ECl7dEYZe2b5NwEvaHdWVjY+BEeVzrPvAjTaOP18HBtzawhf4PAEpBOwy5hX+k/EVaMMWLzCeF56vWfZXl+2AXDNQ3KIfmgZbRfJSGBA/VAxVob6bt/qRwj0vDIy52wgceITyZVnpynp9MS0sQ5rslyzNoPA6v4nWSPYXyorp22TY6hL5TyyF9cyyXoyNgtwvIzjFUqNnLQK1Qxqo1Pq0Au5nT2eJVWzUTD9znsYNuMKunlSyQwM9shjP78tLmVE/5IplcXq1cEXBwjyk30u6cBziPS8= diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -271,3 +271,4 @@ 27055614b68538576fb0439007009acf93fe0a49 26c57e7a0890b96e2c473b394de380d6753c9230 6.6 71bd09bebbe36a09569cbfb388f371433360056b 6.6.1 136902b3a95db38854ebaf5198a627641065c2ea 6.6.2 +3fd1efb3ad124e6686c0fb66e6943cd8aeea5681 6.6.3 diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3680,7 +3680,7 @@ def grep(ui, repo, pattern, *pats, **opt wopts = logcmdutil.walkopts( pats=pats, - opts=opts, + opts=pycompat.byteskwargs(opts), revspec=opts['rev'], include_pats=opts['include'], exclude_pats=opts['exclude'], diff --git a/relnotes/6.6 b/relnotes/6.6 --- a/relnotes/6.6 +++ b/relnotes/6.6 @@ -1,4 +1,13 @@ -= Mercurial 6.6.2 = += Mercurial 6.6.3 = + + * tests: don't use "status" operand of dd in test-censor.t (issue6858) + * tests: make sha256line.py available for all tests + * tests: use sha256line.py instead of /dev/random in test-censor.t (issue6858) + * tests: fix nondeterministic test failure in test-contrib-perf.t + * rust-changelog: don't panic on empty file lists + * grep: restore usage of --include/--exclude options + + = Mercurial 6.6.2 = * histedit: remove superfluous echo() and endwin() calls (issue6859) * persistent-nodemap: avoid writing nodemap for empty revlog diff --git a/rust/hg-core/src/revlog/changelog.rs b/rust/hg-core/src/revlog/changelog.rs --- a/rust/hg-core/src/revlog/changelog.rs +++ b/rust/hg-core/src/revlog/changelog.rs @@ -5,10 +5,11 @@ use crate::revlog::{Revlog, RevlogEntry, use crate::utils::hg_path::HgPath; use crate::vfs::Vfs; use crate::{Graph, GraphError, RevlogOpenOptions, UncheckedRevision}; -use itertools::Itertools; +use itertools::{Either, Itertools}; use std::ascii::escape_default; use std::borrow::Cow; use std::fmt::{Debug, Formatter}; +use std::iter; /// A specialized `Revlog` to work with changelog data format. pub struct Changelog { @@ -230,9 +231,15 @@ impl<'changelog> ChangelogRevisionData<' /// The files changed in this revision. pub fn files(&self) -> impl Iterator { - self.bytes[self.timestamp_end + 1..self.files_end] - .split(|b| b == &b'\n') - .map(HgPath::new) + if self.timestamp_end == self.files_end { + Either::Left(iter::empty()) + } else { + Either::Right( + self.bytes[self.timestamp_end + 1..self.files_end] + .split(|b| b == &b'\n') + .map(HgPath::new), + ) + } } /// The change description. @@ -360,4 +367,12 @@ message", ); Ok(()) } + + #[test] + fn test_empty_files_list() { + assert!(ChangelogRevisionData::null() + .files() + .collect_vec() + .is_empty()); + } } diff --git a/tests/sha256line.py b/tests/sha256line.py new file mode 100755 --- /dev/null +++ b/tests/sha256line.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# +# A tool to help producing large and poorly compressible files +# +# Usage: +# $TESTDIR/seq.py 1000 | $TESTDIR/sha256line.py > my-file.txt + + +import hashlib +import sys + + +for line in sys.stdin: + print(hashlib.sha256(line.encode('utf8')).hexdigest()) diff --git a/tests/test-censor.t b/tests/test-censor.t --- a/tests/test-censor.t +++ b/tests/test-censor.t @@ -316,7 +316,7 @@ Can censor enough revision to move back rev-count data-size inl type target 8 ??? no file target (glob) (revlogv2 !) 8 ??? yes file target (glob) (revlogv1 !) - $ cat /dev/rand?m | dd status=none count=200 | f --hexdump > target + $ $TESTDIR/seq.py 4000 | $TESTDIR/sha256line.py > target $ hg ci -m 'add 100k passwords' $ H2=`hg id --debug -i` $ C5=$H2 diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -525,6 +525,23 @@ Test wdir port2:2147483647:deport port2:2147483647:wport +Testing include/exclude + + $ hg cp port tort + $ hg grep port -X tort + port:export + port:vaportight + port:import/export + port2:export + port2:vaportight + port2:import/export + port2:deport + port2:wport + $ hg grep port -I tort + tort:export + tort:vaportight + tort:import/export + $ cd .. $ hg init t2 $ cd t2 diff --git a/tests/test-revlog-delta-find.t b/tests/test-revlog-delta-find.t --- a/tests/test-revlog-delta-find.t +++ b/tests/test-revlog-delta-find.t @@ -10,20 +10,13 @@ basic setup > [debug] > revlog.debug-delta=yes > EOF - $ cat << EOF >> sha256line.py - > # a way to quickly produce file of significant size and poorly compressable content. - > import hashlib - > import sys - > for line in sys.stdin: - > print(hashlib.sha256(line.encode('utf8')).hexdigest()) - > EOF $ hg init base-repo $ cd base-repo create a "large" file - $ $TESTDIR/seq.py 1000 | $PYTHON $TESTTMP/sha256line.py > my-file.txt + $ $TESTDIR/seq.py 1000 | $TESTDIR/sha256line.py > my-file.txt $ hg add my-file.txt $ hg commit -m initial-commit DBG-DELTAS: FILELOG:my-file.txt: rev=0: delta-base=0 * (glob) @@ -32,7 +25,7 @@ create a "large" file Add more change at the end of the file - $ $TESTDIR/seq.py 1001 1200 | $PYTHON $TESTTMP/sha256line.py >> my-file.txt + $ $TESTDIR/seq.py 1001 1200 | $TESTDIR/sha256line.py >> my-file.txt $ hg commit -m "large-change" DBG-DELTAS: FILELOG:my-file.txt: rev=1: delta-base=0 * (glob) DBG-DELTAS: MANIFESTLOG: * (glob) @@ -273,7 +266,7 @@ We build a very different file content t $ hg -R peer-bad-delta-with-full update 'desc("merge")' --quiet $ ($TESTDIR/seq.py 2000 2100; $TESTDIR/seq.py 500 510; $TESTDIR/seq.py 3000 3050) \ - > | $PYTHON $TESTTMP/sha256line.py > peer-bad-delta-with-full/my-file.txt + > | $TESTDIR/sha256line.py > peer-bad-delta-with-full/my-file.txt $ hg -R peer-bad-delta-with-full commit -m 'trigger-full' DBG-DELTAS: FILELOG:my-file.txt: rev=4: delta-base=4 * (glob) DBG-DELTAS: MANIFESTLOG: * (glob)