Mercurial > hg
view tests/test-convert-identity.t @ 50366:a445194f0a4d stable
backup: fix issue when the backup end up in a different directory
Because of store encoding, we might end up with the backup in a different
directory than the initial copy (for example if the backup path make it cross
the 120 char limit).
This can create crash, especially since 6.4 where backup are used during revlog
split.
Making sure the directory exists fixes these crash We added a test covering this
case.
Strictly speaking, this has always been broken, however the new code in 6.4
triggers it more easily.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 03 May 2023 00:16:38 +0200 |
parents | 6c56277317c2 |
children |
line wrap: on
line source
Testing that convert.hg.preserve-hash=true can be used to make hg convert from hg repo to hg repo preserve hashes, even if the computation of the files list in commits change slightly between hg versions. $ cat <<'EOF' >> "$HGRCPATH" > [extensions] > convert = > EOF $ cat <<'EOF' > changefileslist.py > from mercurial import (changelog, extensions, metadata) > def wrap(orig, clog, manifest, files, *args, **kwargs): > files = metadata.ChangingFiles(touched=[b"a"]) > return orig(clog, manifest, files, *args, **kwargs) > def extsetup(ui): > extensions.wrapfunction(changelog.changelog, 'add', wrap) > EOF $ hg init repo $ cd repo $ echo a > a; hg commit -qAm a $ echo b > a; hg commit -qAm b $ hg up -qr 0; echo c > c; hg commit -qAm c $ hg merge -qr 1 $ hg commit -m_ --config extensions.x=../changefileslist.py $ hg log -r . -T '{node|short} {files|json}\n' c085bbe93d59 ["a"] Now that we have a commit with a files list that's not what the current hg version would create, check that convert either fixes it or keeps it depending on config: $ hg convert -q . ../convert $ hg --cwd ../convert log -r tip -T '{node|short} {files|json}\n' b7c4d4bbacd3 [] $ rm -rf ../convert $ hg convert -q . ../convert --config convert.hg.preserve-hash=true $ hg --cwd ../convert log -r tip -T '{node|short} {files|json}\n' c085bbe93d59 ["a"] $ rm -rf ../convert