Mercurial > hg
view tests/test-relink.t @ 49781:f4a363b25859 stable
extensions: load help from hgext.__index__ as a fallback this time
Prior to 843418dc0b1b, `hgext.__index__` was consulted first if present, which
caused the longer help from the extension modules to be ignored, even when
available. But that change causes a bunch of test failures when the pyoxidized
binary bundles *.pyc in the binary, saying the there's no help topic for
`hg help $disabled_extension` and suggesting the use of `--keyword`, rather than
showing a summary and indicating that it is disabled. Current failures were in
test-check-help.t, test-extension.t, test-help.t, and test-qrecord.t.
Ideally, we would read the various *.pyc files from memory and slurp in the
docstring, but I know that they used to not be readable as resources, and I
can't figure out how to make it work now. So maybe 3.9 and/or the current
PyOxidizer doesn't support it yet. I got closer in py2exe with
`importlib.resources.open_binary("hgext", "rebase.pyc")`, but `open_binary()` on
*.pyc fails in pyoxidizer.[1] Either way, the *.pyc can't be passed to
`ast.parse()` as `extensions._disabledcmdtable()` is doing, so I'm setting that
aside for now.
[1] https://github.com/indygreg/PyOxidizer/issues/649
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 05 Dec 2022 16:05:04 -0500 |
parents | 42d2b31cee0b |
children | dcaa2df1f688 |
line wrap: on
line source
#require hardlink $ echo "[extensions]" >> $HGRCPATH $ echo "relink=" >> $HGRCPATH $ fix_path() { > tr '\\' / > } $ cat > arelinked.py <<EOF > import os > import sys > from mercurial import ( > pycompat, > util, > ) > path1, path2 = sys.argv[1:3] > if util.samefile(pycompat.fsencode(path1), pycompat.fsencode(path2)): > print('%s == %s' % (path1, path2)) > else: > print('%s != %s' % (path1, path2)) > EOF create source repository $ hg init repo $ cd repo $ echo a > a $ echo b > b $ hg ci -Am addfile adding a adding b $ cat "$TESTDIR/binfile.bin" >> a $ cat "$TESTDIR/binfile.bin" >> b $ hg ci -Am changefiles make another commit to create files larger than 1 KB to test formatting of final byte count $ cat "$TESTDIR/binfile.bin" >> a $ cat "$TESTDIR/binfile.bin" >> b $ hg ci -m anotherchange don't sit forever trying to double-lock the source repo $ hg relink . relinking $TESTTMP/repo/.hg/store to $TESTTMP/repo/.hg/store there is nothing to relink Test files are read in binary mode $ "$PYTHON" -c "open('.hg/store/data/dummy.i', 'wb').write(b'a\r\nb\n')" $ cd .. clone and pull to break links $ hg clone --pull -r0 repo clone adding changesets adding manifests adding file changes added 1 changesets with 2 changes to 2 files new changesets 008c0c271c47 updating to branch default 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd clone $ hg pull -q $ echo b >> b $ hg ci -m changeb created new head $ "$PYTHON" -c "open('.hg/store/data/dummy.i', 'wb').write(b'a\nb\r\n')" relink #if no-reposimplestore $ hg relink --debug --config progress.debug=true | fix_path relinking $TESTTMP/repo/.hg/store to $TESTTMP/clone/.hg/store tip has 2 files, estimated total number of files: 3 collecting: 00changelog.i 1/3 files (33.33%) collecting: 00manifest.i 2/3 files (66.67%) collecting: a.i 3/3 files (100.00%) collecting: b.i 4/3 files (133.33%) collecting: dummy.i 5/3 files (166.67%) collected 5 candidate storage files not linkable: 00changelog.i not linkable: 00manifest.i pruning: data/a.i 3/5 files (60.00%) not linkable: data/b.i pruning: data/dummy.i 5/5 files (100.00%) pruned down to 2 probably relinkable files relinking: data/a.i 1/2 files (50.00%) not linkable: data/dummy.i relinked 1 files (1.36 KB reclaimed) $ cd .. check hardlinks $ "$PYTHON" arelinked.py repo/.hg/store/data/a.i clone/.hg/store/data/a.i repo/.hg/store/data/a.i == clone/.hg/store/data/a.i $ "$PYTHON" arelinked.py repo/.hg/store/data/b.i clone/.hg/store/data/b.i repo/.hg/store/data/b.i != clone/.hg/store/data/b.i #endif