##// END OF EJS Templates
largefiles: correctly handle dirstate status when rebasing...
largefiles: correctly handle dirstate status when rebasing When rebasing, we need to trust that the standins are always correct. The rebase operation updates the standins according to the changeset it is rebasing. We need to make the largefiles in the working copy match. If we don't make them match, then they get accidentally reverted, either during the rebase or during the next commit after the rebase. This worked previously only becuase we were relying on the behavior that largefiles with a changed standin, but unchanged contents, never showed up in the list of modified largefiles. Unfortunately, pre-commit hooks can get an incorrect status this way, and it also results in extra execution of code. The solution is to simply trust the standins when we are about to commit a rebased changeset, and politely ask updatelfiles() to pull the new contents down. In this case, updatelfiles() will also mark any files it has pulled down as dirty in the lfdirstate so that pre-commit hooks will get correct status output.

File last commit:

r15572:926bc23d stable
r15793:3ef07ecd default
Show More
test-largefiles-small-disk.t
68 lines | 1.8 KiB | text/troff | Tads3Lexer
/ tests / test-largefiles-small-disk.t
Test how largefiles abort in case the disk runs full
$ cat > criple.py <<EOF
> import os, errno, shutil
> from mercurial import util
> #
> # this makes the original largefiles code abort:
> def copyfileobj(fsrc, fdst, length=16*1024):
> 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=65536, 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
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
getting changed largefiles
abort: No space left on device
[255]
The largefile is not created in .hg/largefiles:
$ ls bob/.hg/largefiles
dirstate