Mercurial > hg-stable
view tests/test-largefiles-small-disk.t @ 46386:d6fa9fbd375d stable
commit: reorder if-else conditional to give mergestate info priority
Looking at the code now, I was unable to find a good reason as why we only rely
on mergestate extras info after checking whether a filelog parent is ancestor of
other or not.
I mean if we have stored in mergestate that `other` was chosed, we should
blindly pick that one.
This cleanup will also help introduce more cases when both `fparent1` and
`fparent2` are non-null but using info from mergestate, we can fastpath.
The test change actually demonstrates the point of the patch. During merge we
were getting the other side of the file but on commit we were marking that as
merged.
Differential Revision: https://phab.mercurial-scm.org/D10147
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 04 Mar 2021 17:35:58 +0530 |
parents | c70bdd222dcd |
children | 42d2b31cee0b |
line wrap: on
line source
Test how largefiles abort in case the disk runs full $ cat > criple.py <<EOF > from __future__ import absolute_import > import errno > import os > import shutil > from mercurial import util > # > # this makes the original largefiles code abort: > _origcopyfileobj = shutil.copyfileobj > def copyfileobj(fsrc, fdst, length=16 * 1024): > # allow journal files (used by transaction) to be written > if b'journal.' in fdst.name: > return _origcopyfileobj(fsrc, fdst, length) > fdst.write(fsrc.read(4)) > raise IOError(errno.ENOSPC, os.strerror(errno.ENOSPC)) > shutil.copyfileobj = copyfileobj > # > # this makes the rewritten code abort: > def filechunkiter(f, size=131072, limit=None): > yield f.read(4) > raise IOError(errno.ENOSPC, os.strerror(errno.ENOSPC)) > util.filechunkiter = filechunkiter > # > def oslink(src, dest): > raise OSError("no hardlinks, try copying instead") > util.oslink = oslink > EOF $ echo "[extensions]" >> $HGRCPATH $ echo "largefiles =" >> $HGRCPATH $ hg init alice $ cd alice $ echo "this is a very big file" > big $ hg add --large big $ hg commit --config extensions.criple=$TESTTMP/criple.py -m big abort: No space left on device [255] The largefile is not created in .hg/largefiles: $ ls .hg/largefiles dirstate The user cache is not even created: >>> import os; os.path.exists("$HOME/.cache/largefiles/") False Make the commit with space on the device: $ hg commit -m big Now make a clone with a full disk, and make sure lfutil.link function makes copies instead of hardlinks: $ cd .. $ hg --config extensions.criple=$TESTTMP/criple.py clone --pull alice bob requesting all changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files new changesets 390cf214e9ac updating to branch default getting changed largefiles abort: No space left on device [255] The largefile is not created in .hg/largefiles: $ ls bob/.hg/largefiles dirstate