diff mercurial/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 38df146d0697
children 4695f1829045
line wrap: on
line diff
--- a/mercurial/sparse.py	Sun Jul 09 15:11:19 2017 +0200
+++ b/mercurial/sparse.py	Fri Jul 07 11:51:10 2017 -0700
@@ -478,3 +478,19 @@
         dirstate.normallookup(file)
 
     return added, dropped, lookup
+
+def aftercommit(repo, node):
+    """Perform actions after a working directory commit."""
+    # This function is called unconditionally, even if sparse isn't
+    # enabled.
+    ctx = repo[node]
+
+    profiles = patternsforrev(repo, ctx.rev())[2]
+
+    # profiles will only have data if sparse is enabled.
+    if set(profiles) & set(ctx.files()):
+        origstatus = repo.status()
+        origsparsematch = matcher(repo)
+        refreshwdir(repo, origstatus, origsparsematch, force=True)
+
+    prunetemporaryincludes(repo)