[PATCH 1 of 3] largefiles: fix commit of missing largefiles
Mads Kiilerich
mads at kiilerich.com
Sun Jan 17 18:32:01 UTC 2016
# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1453047812 -3600
# Sun Jan 17 17:23:32 2016 +0100
# Node ID 92c424a25cce00c7af68b3d0c489d648a967815a
# Parent 0029c2bebc23182c34f83fa22abde1d5d4aebc51
largefiles: fix commit of missing largefiles
832c98d79587 improved merging of standin files referencing missing largefiles.
It did however not test or fix commits of such merges; it would abort.
To fix that, change copytostore to skip and warn about missing largefiles
with a message similar the one for failing get from remote filestores. (It
would perhaps in both cases be better to emit a more helpful warning like
"warning: standin file for large1 references 58e24f733a which can't be found in
the local store".)
To test this, make sure commit doesn't find the "missing" largefile in the global
usercache. For further testing, verify that update and status works as expected
after this.
This will also effectively backout 63116d47cc3f.
diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -221,7 +221,12 @@ def copytostore(repo, rev, file, uploade
hash = readstandin(repo, file, rev)
if instore(repo, hash):
return
- copytostoreabsolute(repo, repo.wjoin(file), hash)
+ absfile = repo.wjoin(file)
+ if os.path.exists(absfile):
+ copytostoreabsolute(repo, absfile, hash)
+ else:
+ repo.ui.warn(_("%s: largefile %s not available from local store\n") %
+ (file, hash))
def copyalltostore(repo, node):
'''Copy all largefiles in a given revision to the store'''
diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t
--- a/tests/test-largefiles-update.t
+++ b/tests/test-largefiles-update.t
@@ -158,9 +158,17 @@ mark the non-existing file as normal in
0 largefiles updated, 0 removed
0 files updated, 2 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
- $ hg commit -m '1-2-3 testing'
+ $ hg commit -m '1-2-3 testing' --config largefiles.usercache=not
+ large1: largefile 58e24f733a964da346e2407a2bee99d9001184f5 not available from local store
+ $ hg up -C . --config largefiles.usercache=not
+ getting changed largefiles
+ large1: largefile 58e24f733a964da346e2407a2bee99d9001184f5 not available from file:/*/$TESTTMP/repo (glob)
+ 0 largefiles updated, 0 removed
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg st large1
+ ! large1
$ hg rollback -q
- $ rm 58e24f733a964da346e2407a2bee99d9001184f5
+ $ mv 58e24f733a964da346e2407a2bee99d9001184f5 .hg/largefiles/
Test that "hg revert -r REV" updates largefiles from "REV" correctly
More information about the Mercurial-devel
mailing list