diff hgext/sparse.py @ 33353:160efb559f67

sparse: move post commit actions into core Instead of wrapping committablectx.markcommitted(), we inline the call into workingctx.markcommitted(). Per smf's review, workingctx is the proper location for this code, as committablectx is the shared base class for it and memctx. Since this code touches the working directory, it belongs in workingctx.
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 07 Jul 2017 11:51:10 -0700
parents 33d0859c37bd
children 4695f1829045
line wrap: on
line diff
--- a/hgext/sparse.py	Sun Jul 09 15:11:19 2017 +0200
+++ b/hgext/sparse.py	Fri Jul 07 11:51:10 2017 -0700
@@ -79,7 +79,6 @@
 from mercurial import (
     cmdutil,
     commands,
-    context,
     dirstate,
     error,
     extensions,
@@ -100,9 +99,6 @@
 cmdtable = {}
 command = registrar.command(cmdtable)
 
-def uisetup(ui):
-    _setupcommit(ui)
-
 def extsetup(ui):
     sparse.enabled = True
 
@@ -134,27 +130,6 @@
         raise AttributeError(_("type '%s' has no property '%s'") % (origcls,
                              propname))
 
-def _setupcommit(ui):
-    def _refreshoncommit(orig, self, node):
-        """Refresh the checkout when commits touch .hgsparse
-        """
-        orig(self, node)
-        repo = self._repo
-
-        ctx = repo[node]
-        profiles = sparse.patternsforrev(repo, ctx.rev())[2]
-
-        # profiles will only have data if sparse is enabled.
-        if set(profiles) & set(ctx.files()):
-            origstatus = repo.status()
-            origsparsematch = sparse.matcher(repo)
-            sparse.refreshwdir(repo, origstatus, origsparsematch, force=True)
-
-        sparse.prunetemporaryincludes(repo)
-
-    extensions.wrapfunction(context.committablectx, 'markcommitted',
-        _refreshoncommit)
-
 def _setuplog(ui):
     entry = commands.table['^log|history']
     entry[1].append(('', 'sparse', None,