diff hgext/largefiles/lfutil.py @ 15317:41f371150ccb stable

largefiles: make the store primary, and the user cache secondary This uses the now-properly-named functions and methods from the previous patch to actually deliver the desired behavior
author Benjamin Pollack <benjamin@bitquabit.com>
date Thu, 20 Oct 2011 13:24:11 -0400
parents c65f5b6e26d4
children 9da7e96cd5c2
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Thu Oct 20 13:24:09 2011 -0400
+++ b/hgext/largefiles/lfutil.py	Thu Oct 20 13:24:11 2011 -0400
@@ -100,11 +100,12 @@
 def findfile(repo, hash):
     if instore(repo, hash):
         repo.ui.note(_('Found %s in store\n') % hash)
-        return storepath(repo, hash)
-    if inusercache(repo.ui, hash):
+    elif inusercache(repo.ui, hash):
         repo.ui.note(_('Found %s in system cache\n') % hash)
-        return usercachepath(repo.ui, hash)
-    return None
+        link(usercachepath(repo.ui, hash), storepath(repo, hash))
+    else:
+        return None
+    return storepath(repo, hash)
 
 class largefiles_dirstate(dirstate.dirstate):
     def __getitem__(self, key):