largefiles: ensure that the standin files are available in getlfilestoupload()
authorMatt Harbison <matt_harbison@yahoo.com>
Wed, 17 Dec 2014 21:51:09 -0500
changeset 23657 95f238cafb32
parent 23656 d3e137c91f94
child 23658 55c92618fdd4
largefiles: ensure that the standin files are available in getlfilestoupload() The function only adds the hash content of the file to the set to upload if the file in the ctx is a standin. It is called by overrides.summaryremotehook(), which is called in the summary method. The largefiles extension switches 'lfstatus' on in summary, so the standins shouldn't be visible when obtaining a context there. The reason this wasn't noticed before is that the 'lfstatus' attribute is only being set on the unfiltered repo because of how repoview delegates attribute assignment. Therefore any filtered view will return a context containing standins, whether or not 'lfstatus' was set in the various overrides methods. That will be fixed in the next patch. But without this change, the next patch would have test failures for 'summary --large' stating there are no files to upload.
hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py	Thu Dec 18 09:22:09 2014 -0800
+++ b/hgext/largefiles/lfutil.py	Wed Dec 17 21:51:09 2014 -0500
@@ -422,7 +422,14 @@
 def getlfilestoupload(repo, missing, addfunc):
     for n in missing:
         parents = [p for p in repo.changelog.parents(n) if p != node.nullid]
-        ctx = repo[n]
+
+        oldlfstatus = repo.lfstatus
+        repo.lfstatus = False
+        try:
+            ctx = repo[n]
+        finally:
+            repo.lfstatus = oldlfstatus
+
         files = set(ctx.files())
         if len(parents) == 2:
             mc = ctx.manifest()