mercurial/sparse.py
changeset 45290 d70c972cec74
parent 45106 a03c177a4679
child 45294 30f3e278c5d7
equal deleted inserted replaced
45289:1d1f112da75c 45290:d70c972cec74
   364     repo._sparsematchercache[key] = result
   364     repo._sparsematchercache[key] = result
   365 
   365 
   366     return result
   366     return result
   367 
   367 
   368 
   368 
   369 def filterupdatesactions(repo, wctx, mctx, branchmerge, actions):
   369 def filterupdatesactions(repo, wctx, mctx, branchmerge, mresult):
   370     """Filter updates to only lay out files that match the sparse rules."""
   370     """Filter updates to only lay out files that match the sparse rules."""
   371     if not enabled:
   371     if not enabled:
   372         return actions
   372         return
   373 
   373 
   374     oldrevs = [pctx.rev() for pctx in wctx.parents()]
   374     oldrevs = [pctx.rev() for pctx in wctx.parents()]
   375     oldsparsematch = matcher(repo, oldrevs)
   375     oldsparsematch = matcher(repo, oldrevs)
   376 
   376 
   377     if oldsparsematch.always():
   377     if oldsparsematch.always():
   378         return actions
   378         return
   379 
   379 
   380     files = set()
   380     files = set()
   381     prunedactions = {}
   381     prunedactions = {}
   382 
   382 
   383     if branchmerge:
   383     if branchmerge:
   388         # If we're updating, use the target context's filter, since we're
   388         # If we're updating, use the target context's filter, since we're
   389         # moving to the target context.
   389         # moving to the target context.
   390         sparsematch = matcher(repo, [mctx.rev()])
   390         sparsematch = matcher(repo, [mctx.rev()])
   391 
   391 
   392     temporaryfiles = []
   392     temporaryfiles = []
   393     for file, action in pycompat.iteritems(actions):
   393     for file, action in pycompat.iteritems(mresult.actions):
   394         type, args, msg = action
   394         type, args, msg = action
   395         files.add(file)
   395         files.add(file)
   396         if sparsematch(file):
   396         if sparsematch(file):
   397             prunedactions[file] = action
   397             prunedactions[file] = action
   398         elif type == b'm':
   398         elif type == b'm':
   455                 flags = mf.flags(file)
   455                 flags = mf.flags(file)
   456                 prunedactions[file] = (b'g', (flags, False), b'')
   456                 prunedactions[file] = (b'g', (flags, False), b'')
   457             elif old and not new:
   457             elif old and not new:
   458                 prunedactions[file] = (b'r', [], b'')
   458                 prunedactions[file] = (b'r', [], b'')
   459 
   459 
   460     return prunedactions
   460     mresult.setactions(prunedactions)
   461 
   461 
   462 
   462 
   463 def refreshwdir(repo, origstatus, origsparsematch, force=False):
   463 def refreshwdir(repo, origstatus, origsparsematch, force=False):
   464     """Refreshes working directory by taking sparse config into account.
   464     """Refreshes working directory by taking sparse config into account.
   465 
   465