Mercurial > hg
changeset 27947:571ba161f6be stable
largefiles: prevent committing a missing largefile
Previously, if the largefile was deleted at the time of a commit, the standin
was silently not updated and its current state (possibly garbage) was recorded.
The test makes it look like this is somewhat of an edge case, but the same thing
happens when an `hg revert` followed by `rm` changes the standin.
Aside from the second invocation of this in lfutil.updatestandinsbymatch()
(which is what triggers this test case), the three other uses are guarded by
dirstate checks for added or modified, or an existence check in the filesystem.
So aborting in lfutil.updatestandins() should be safe, and will avoid silent
skips in the future if this is used elsewhere.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 24 Jan 2016 00:10:19 -0500 |
parents | ca8d2b73155d |
children | 7cb7264cfd52 |
files | hgext/largefiles/lfutil.py tests/test-largefiles-cache.t |
diffstat | 2 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py Wed Jan 27 10:24:25 2016 -0500 +++ b/hgext/largefiles/lfutil.py Sun Jan 24 00:10:19 2016 -0500 @@ -319,6 +319,8 @@ hash = hashfile(file) executable = getexecutable(file) writestandin(repo, standin, hash, executable) + else: + raise error.Abort(_('%s: file not found!') % splitstandin(standin)) def readstandin(repo, filename, node=None): '''read hex hash from standin for filename at given node, or working
--- a/tests/test-largefiles-cache.t Wed Jan 27 10:24:25 2016 -0500 +++ b/tests/test-largefiles-cache.t Sun Jan 24 00:10:19 2016 -0500 @@ -19,6 +19,12 @@ $ hg rm large $ hg commit -m 'branchhead without largefile' large $ hg up -qr 0 + $ rm large + $ echo "0000000000000000000000000000000000000000" > .hglf/large + $ hg commit -m 'commit missing file with corrupt standin' large + abort: large: file not found! + [255] + $ hg up -Cqr 0 $ cd .. Discard all cached largefiles in USERCACHE