[PATCH 2 of 2 RFC] largefiles: look at unfiltered().lfstatus to allow status() to be filtered

Matt Harbison mharbison72 at gmail.com
Wed Dec 17 22:18:15 CST 2014


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1417933950 18000
#      Sun Dec 07 01:32:30 2014 -0500
# Node ID 988b29c94eed8f5aabe1063535f2d4eec4716c50
# Parent  f1d5d04478cd32550b4005a51f1ab10ab0093135
largefiles: look at unfiltered().lfstatus to allow status() to be filtered

The comment about status being buggy with a repo proxy seems to be that status
wasn't being redirected to testing the largefiles themselves- lfstatus was
always False, and so the original status method was being called instead of
doing the largefiles processing.  This is because when the various largefile
command overrides call 'repo.lfstatus = True', __setattr__() in repoview is in
turn setting the value on the unfiltered repo, and the value in the filtered
repo remains False.

Explicitly looking at the attribute on the unfiltered repo keeps all views in
sync.

diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -34,7 +34,7 @@
         # their actual contents.
         def __getitem__(self, changeid):
             ctx = super(lfilesrepo, self).__getitem__(changeid)
-            if self.lfstatus:
+            if self.unfiltered().lfstatus:
                 class lfilesmanifestdict(manifest.manifestdict):
                     def __contains__(self, filename):
                         orig = super(lfilesmanifestdict, self).__contains__
@@ -72,19 +72,20 @@
         # appropriate list in the result. Also removes standin files
         # from the listing. Revert to the original status if
         # self.lfstatus is False.
-        # XXX large file status is buggy when used on repo proxy.
-        # XXX this needs to be investigated.
-        @localrepo.unfilteredmethod
         def status(self, node1='.', node2=None, match=None, ignored=False,
                 clean=False, unknown=False, listsubrepos=False):
             listignored, listclean, listunknown = ignored, clean, unknown
             orig = super(lfilesrepo, self).status
-            if not self.lfstatus:
+
+            # When various overrides set repo.lfstatus, the change is redirected
+            # to the unfiltered repo, and self.lfstatus is always false when
+            # this repo is filtered.
+            if not self.unfiltered().lfstatus:
                 return orig(node1, node2, match, listignored, listclean,
                             listunknown, listsubrepos)
 
             # some calls in this function rely on the old version of status
-            self.lfstatus = False
+            self.unfiltered().lfstatus = False
             ctx1 = self[node1]
             ctx2 = self[node2]
             working = ctx2.rev() is None
@@ -240,7 +241,7 @@
                 if wlock:
                     wlock.release()
 
-            self.lfstatus = True
+            self.unfiltered().lfstatus = True
             return scmutil.status(*result)
 
         def commitctx(self, ctx, *args, **kwargs):


More information about the Mercurial-devel mailing list