[PATCH 1 of 2 RFC] largefiles: ensure that the standin files are available in getlfilestoupload()

Matt Harbison mharbison72 at gmail.com
Thu Dec 18 04:18:14 UTC 2014


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1418871069 18000
#      Wed Dec 17 21:51:09 2014 -0500
# Node ID f1d5d04478cd32550b4005a51f1ab10ab0093135
# Parent  495bc1b65d25872324a0220354f048b220304bd1
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.

diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -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()


More information about the Mercurial-devel mailing list