changeset 27903:512a814c5595

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.
author Mads Kiilerich <madski@unity3d.com>
date Sun, 17 Jan 2016 17:23:32 +0100
parents 51b6ce257e0a
children ee3123e19db9
files hgext/largefiles/lfutil.py tests/test-largefiles-update.t
diffstat 2 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Thu Jan 14 10:22:55 2016 -0800
+++ b/hgext/largefiles/lfutil.py	Sun Jan 17 17:23:32 2016 +0100
@@ -221,7 +221,12 @@
     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'''
--- a/tests/test-largefiles-update.t	Thu Jan 14 10:22:55 2016 -0800
+++ b/tests/test-largefiles-update.t	Sun Jan 17 17:23:32 2016 +0100
@@ -158,9 +158,17 @@
   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