Show More
@@ -79,7 +79,6 b' from mercurial.node import nullid' | |||
|
79 | 79 | from mercurial import ( |
|
80 | 80 | cmdutil, |
|
81 | 81 | commands, |
|
82 | context, | |
|
83 | 82 | dirstate, |
|
84 | 83 | error, |
|
85 | 84 | extensions, |
@@ -100,9 +99,6 b" testedwith = 'ships-with-hg-core'" | |||
|
100 | 99 | cmdtable = {} |
|
101 | 100 | command = registrar.command(cmdtable) |
|
102 | 101 | |
|
103 | def uisetup(ui): | |
|
104 | _setupcommit(ui) | |
|
105 | ||
|
106 | 102 | def extsetup(ui): |
|
107 | 103 | sparse.enabled = True |
|
108 | 104 | |
@@ -134,27 +130,6 b' def replacefilecache(cls, propname, repl' | |||
|
134 | 130 | raise AttributeError(_("type '%s' has no property '%s'") % (origcls, |
|
135 | 131 | propname)) |
|
136 | 132 | |
|
137 | def _setupcommit(ui): | |
|
138 | def _refreshoncommit(orig, self, node): | |
|
139 | """Refresh the checkout when commits touch .hgsparse | |
|
140 | """ | |
|
141 | orig(self, node) | |
|
142 | repo = self._repo | |
|
143 | ||
|
144 | ctx = repo[node] | |
|
145 | profiles = sparse.patternsforrev(repo, ctx.rev())[2] | |
|
146 | ||
|
147 | # profiles will only have data if sparse is enabled. | |
|
148 | if set(profiles) & set(ctx.files()): | |
|
149 | origstatus = repo.status() | |
|
150 | origsparsematch = sparse.matcher(repo) | |
|
151 | sparse.refreshwdir(repo, origstatus, origsparsematch, force=True) | |
|
152 | ||
|
153 | sparse.prunetemporaryincludes(repo) | |
|
154 | ||
|
155 | extensions.wrapfunction(context.committablectx, 'markcommitted', | |
|
156 | _refreshoncommit) | |
|
157 | ||
|
158 | 133 | def _setuplog(ui): |
|
159 | 134 | entry = commands.table['^log|history'] |
|
160 | 135 | entry[1].append(('', 'sparse', None, |
@@ -38,6 +38,7 b' from . import (' | |||
|
38 | 38 | repoview, |
|
39 | 39 | revlog, |
|
40 | 40 | scmutil, |
|
41 | sparse, | |
|
41 | 42 | subrepo, |
|
42 | 43 | util, |
|
43 | 44 | ) |
@@ -1803,6 +1804,11 b' class workingctx(committablectx):' | |||
|
1803 | 1804 | match.bad = bad |
|
1804 | 1805 | return match |
|
1805 | 1806 | |
|
1807 | def markcommitted(self, node): | |
|
1808 | super(workingctx, self).markcommitted(node) | |
|
1809 | ||
|
1810 | sparse.aftercommit(self._repo, node) | |
|
1811 | ||
|
1806 | 1812 | class committablefilectx(basefilectx): |
|
1807 | 1813 | """A committablefilectx provides common functionality for a file context |
|
1808 | 1814 | that wants the ability to commit, e.g. workingfilectx or memfilectx.""" |
@@ -478,3 +478,19 b' def refreshwdir(repo, origstatus, origsp' | |||
|
478 | 478 | dirstate.normallookup(file) |
|
479 | 479 | |
|
480 | 480 | return added, dropped, lookup |
|
481 | ||
|
482 | def aftercommit(repo, node): | |
|
483 | """Perform actions after a working directory commit.""" | |
|
484 | # This function is called unconditionally, even if sparse isn't | |
|
485 | # enabled. | |
|
486 | ctx = repo[node] | |
|
487 | ||
|
488 | profiles = patternsforrev(repo, ctx.rev())[2] | |
|
489 | ||
|
490 | # profiles will only have data if sparse is enabled. | |
|
491 | if set(profiles) & set(ctx.files()): | |
|
492 | origstatus = repo.status() | |
|
493 | origsparsematch = matcher(repo) | |
|
494 | refreshwdir(repo, origstatus, origsparsematch, force=True) | |
|
495 | ||
|
496 | prunetemporaryincludes(repo) |
General Comments 0
You need to be logged in to leave comments.
Login now