##// END OF EJS Templates
sparse: refactor update actions filtering and call from core...
Gregory Szorc -
r33323:25250052 default
parent child Browse files
Show More
@@ -102,7 +102,6 b' cmdtable = {}'
102 command = registrar.command(cmdtable)
102 command = registrar.command(cmdtable)
103
103
104 def uisetup(ui):
104 def uisetup(ui):
105 _setupupdates(ui)
106 _setupcommit(ui)
105 _setupcommit(ui)
107
106
108 def extsetup(ui):
107 def extsetup(ui):
@@ -136,10 +135,6 b' def replacefilecache(cls, propname, repl'
136 raise AttributeError(_("type '%s' has no property '%s'") % (origcls,
135 raise AttributeError(_("type '%s' has no property '%s'") % (origcls,
137 propname))
136 propname))
138
137
139 def _setupupdates(ui):
140 extensions.wrapfunction(mergemod, 'calculateupdates',
141 sparse.calculateupdates)
142
143 def _setupcommit(ui):
138 def _setupcommit(ui):
144 def _refreshoncommit(orig, self, node):
139 def _refreshoncommit(orig, self, node):
145 """Refresh the checkout when commits touch .hgsparse
140 """Refresh the checkout when commits touch .hgsparse
@@ -975,7 +975,10 b' def _resolvetrivial(repo, wctx, mctx, an'
975 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force,
975 def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force,
976 acceptremote, followcopies, matcher=None,
976 acceptremote, followcopies, matcher=None,
977 mergeforce=False):
977 mergeforce=False):
978 "Calculate the actions needed to merge mctx into wctx using ancestors"
978 """Calculate the actions needed to merge mctx into wctx using ancestors"""
979 # Avoid cycle.
980 from . import sparse
981
979 if len(ancestors) == 1: # default
982 if len(ancestors) == 1: # default
980 actions, diverge, renamedelete = manifestmerge(
983 actions, diverge, renamedelete = manifestmerge(
981 repo, wctx, mctx, ancestors[0], branchmerge, force, matcher,
984 repo, wctx, mctx, ancestors[0], branchmerge, force, matcher,
@@ -1074,7 +1077,10 b' def calculateupdates(repo, wctx, mctx, a'
1074 fractions = _forgetremoved(wctx, mctx, branchmerge)
1077 fractions = _forgetremoved(wctx, mctx, branchmerge)
1075 actions.update(fractions)
1078 actions.update(fractions)
1076
1079
1077 return actions, diverge, renamedelete
1080 prunedactions = sparse.filterupdatesactions(repo, wctx, mctx, branchmerge,
1081 actions)
1082
1083 return prunedactions, diverge, renamedelete
1078
1084
1079 def batchremove(repo, wctx, actions):
1085 def batchremove(repo, wctx, actions):
1080 """apply removes to the working directory
1086 """apply removes to the working directory
@@ -301,18 +301,16 b' def matcher(repo, revs=None, includetemp'
301
301
302 return result
302 return result
303
303
304 def calculateupdates(orig, repo, wctx, mctx, ancestors, branchmerge, *arg,
304 def filterupdatesactions(repo, wctx, mctx, branchmerge, actions):
305 **kwargs):
305 """Filter updates to only lay out files that match the sparse rules."""
306 """Filter updates to only lay out files that match the sparse rules.
306 if not enabled:
307 """
307 return actions
308 actions, diverge, renamedelete = orig(repo, wctx, mctx, ancestors,
309 branchmerge, *arg, **kwargs)
310
308
311 oldrevs = [pctx.rev() for pctx in wctx.parents()]
309 oldrevs = [pctx.rev() for pctx in wctx.parents()]
312 oldsparsematch = matcher(repo, oldrevs)
310 oldsparsematch = matcher(repo, oldrevs)
313
311
314 if oldsparsematch.always():
312 if oldsparsematch.always():
315 return actions, diverge, renamedelete
313 return actions
316
314
317 files = set()
315 files = set()
318 prunedactions = {}
316 prunedactions = {}
@@ -383,4 +381,4 b' def calculateupdates(orig, repo, wctx, m'
383 elif old and not new:
381 elif old and not new:
384 prunedactions[file] = ('r', [], '')
382 prunedactions[file] = ('r', [], '')
385
383
386 return prunedactions, diverge, renamedelete
384 return prunedactions
General Comments 0
You need to be logged in to leave comments. Login now