Mercurial > hg
view tests/test-fix-pickle.t @ 46893:3d32b9759047
contrib: restore the `hg fix` configuration in the examples
After decc3bd3f20d, running `black` will DTRT, but running `hg fix` did nothing
(unless the example config file was %included, in which case it truncated the
file instead of formatting it). I'm not sure why that was happening, but let's
not leave a code shredder laying around.
Differential Revision: https://phab.mercurial-scm.org/D10311
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 05 Apr 2021 13:02:51 -0400 |
parents | 7d24201b6447 |
children |
line wrap: on
line source
A script that implements uppercasing all letters in a file. $ UPPERCASEPY="$TESTTMP/uppercase.py" $ cat > $UPPERCASEPY <<EOF > import sys > from mercurial.utils.procutil import setbinary > setbinary(sys.stdin) > setbinary(sys.stdout) > sys.stdout.write(sys.stdin.read().upper()) > EOF $ TESTLINES="foo\nbar\nbaz\n" $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY FOO BAR BAZ This file attempts to test our workarounds for pickle's lack of support for short reads. $ cat >> $HGRCPATH <<EOF > [extensions] > fix = > [fix] > uppercase-whole-file:command="$PYTHON" $UPPERCASEPY > uppercase-whole-file:pattern=set:** > EOF $ hg init repo $ cd repo # Create a file that's large enough that it seems to not fit in # pickle's buffer, making it use the code path that expects our # _blockingreader's read() method to return bytes. $ echo "some stuff" > file $ for i in $($TESTDIR/seq.py 13); do > cat file file > tmp > mv -f tmp file > done $ hg commit -Am "add large file" adding file Check that we don't get a crash $ hg fix -r . saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-fix.hg (glob)