comparison mercurial/merge.py @ 36142:60dd840a7fdb

merge: invoke scmutil.fileprefetchhooks() prior to applying updates This moves the file list calculation into core, so other extensions don't need to duplicate it.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 11 Feb 2018 13:25:56 -0500
parents 4fe2041007ed
children 187f2474bc11
comparison
equal deleted inserted replaced
36141:62719115875d 36142:60dd840a7fdb
1383 i = 0 1383 i = 0
1384 i += 1 1384 i += 1
1385 if i > 0: 1385 if i > 0:
1386 yield i, f 1386 yield i, f
1387 1387
1388 def _prefetchfiles(repo, ctx, actions):
1389 """Invoke ``scmutil.fileprefetchhooks()`` for the files relevant to the dict
1390 of merge actions. ``ctx`` is the context being merged in."""
1391
1392 # Skipping 'a', 'am', 'f', 'r', 'dm', 'e', 'k', 'p' and 'pr', because they
1393 # don't touch the context to be merged in. 'cd' is skipped, because
1394 # changed/deleted never resolves to something from the remote side.
1395 oplist = [actions[a] for a in 'g dc dg m'.split()]
1396 prefetch = scmutil.fileprefetchhooks
1397 prefetch(repo, ctx, [f for sublist in oplist for f, args, msg in sublist])
1388 1398
1389 def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None): 1399 def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None):
1390 """apply the merge action list to the working directory 1400 """apply the merge action list to the working directory
1391 1401
1392 wctx is the working copy context 1402 wctx is the working copy context
1393 mctx is the context to be merged into the working copy 1403 mctx is the context to be merged into the working copy
1394 1404
1395 Return a tuple of counts (updated, merged, removed, unresolved) that 1405 Return a tuple of counts (updated, merged, removed, unresolved) that
1396 describes how many files were affected by the update. 1406 describes how many files were affected by the update.
1397 """ 1407 """
1408
1409 _prefetchfiles(repo, mctx, actions)
1398 1410
1399 updated, merged, removed = 0, 0, 0 1411 updated, merged, removed = 0, 0, 0
1400 ms = mergestate.clean(repo, wctx.p1().node(), mctx.node(), labels) 1412 ms = mergestate.clean(repo, wctx.p1().node(), mctx.node(), labels)
1401 moves = [] 1413 moves = []
1402 for m, l in actions.items(): 1414 for m, l in actions.items():