Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 45356:2c96fd8e05f6
merge: pass mergeresult obj in merge._prefetchfiles()
Differential Revision: https://phab.mercurial-scm.org/D8877
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 03 Aug 2020 14:19:06 +0530 |
parents | b9b055f15035 |
children | 27c6518b7287 |
comparison
equal
deleted
inserted
replaced
45355:b9b055f15035 | 45356:2c96fd8e05f6 |
---|---|
1254 if i > 0: | 1254 if i > 0: |
1255 yield False, (i, f) | 1255 yield False, (i, f) |
1256 yield True, filedata | 1256 yield True, filedata |
1257 | 1257 |
1258 | 1258 |
1259 def _prefetchfiles(repo, ctx, actions): | 1259 def _prefetchfiles(repo, ctx, mresult): |
1260 """Invoke ``scmutil.prefetchfiles()`` for the files relevant to the dict | 1260 """Invoke ``scmutil.prefetchfiles()`` for the files relevant to the dict |
1261 of merge actions. ``ctx`` is the context being merged in.""" | 1261 of merge actions. ``ctx`` is the context being merged in.""" |
1262 | 1262 |
1263 # Skipping 'a', 'am', 'f', 'r', 'dm', 'e', 'k', 'p' and 'pr', because they | 1263 # Skipping 'a', 'am', 'f', 'r', 'dm', 'e', 'k', 'p' and 'pr', because they |
1264 # don't touch the context to be merged in. 'cd' is skipped, because | 1264 # don't touch the context to be merged in. 'cd' is skipped, because |
1265 # changed/deleted never resolves to something from the remote side. | 1265 # changed/deleted never resolves to something from the remote side. |
1266 oplist = [ | 1266 files = [] |
1267 actions[a] | 1267 for f, args, msg in mresult.getactions( |
1268 for a in ( | 1268 [ |
1269 mergestatemod.ACTION_GET, | 1269 mergestatemod.ACTION_GET, |
1270 mergestatemod.ACTION_DELETED_CHANGED, | 1270 mergestatemod.ACTION_DELETED_CHANGED, |
1271 mergestatemod.ACTION_LOCAL_DIR_RENAME_GET, | 1271 mergestatemod.ACTION_LOCAL_DIR_RENAME_GET, |
1272 mergestatemod.ACTION_MERGE, | 1272 mergestatemod.ACTION_MERGE, |
1273 ) | 1273 ] |
1274 ] | 1274 ): |
1275 files.append(f) | |
1276 | |
1275 prefetch = scmutil.prefetchfiles | 1277 prefetch = scmutil.prefetchfiles |
1276 matchfiles = scmutil.matchfiles | 1278 matchfiles = scmutil.matchfiles |
1277 prefetch( | 1279 prefetch( |
1278 repo, | 1280 repo, [(ctx.rev(), matchfiles(repo, files),)], |
1279 [ | |
1280 ( | |
1281 ctx.rev(), | |
1282 matchfiles( | |
1283 repo, [f for sublist in oplist for f, args, msg in sublist] | |
1284 ), | |
1285 ) | |
1286 ], | |
1287 ) | 1281 ) |
1288 | 1282 |
1289 | 1283 |
1290 @attr.s(frozen=True) | 1284 @attr.s(frozen=True) |
1291 class updateresult(object): | 1285 class updateresult(object): |
1349 files were affected by the update, and filedata is as described in | 1343 files were affected by the update, and filedata is as described in |
1350 batchget. | 1344 batchget. |
1351 """ | 1345 """ |
1352 | 1346 |
1353 actions = mresult.actionsdict | 1347 actions = mresult.actionsdict |
1354 _prefetchfiles(repo, mctx, actions) | 1348 _prefetchfiles(repo, mctx, mresult) |
1355 | 1349 |
1356 updated, merged, removed = 0, 0, 0 | 1350 updated, merged, removed = 0, 0, 0 |
1357 ms = mergestatemod.mergestate.clean( | 1351 ms = mergestatemod.mergestate.clean( |
1358 repo, wctx.p1().node(), mctx.node(), labels | 1352 repo, wctx.p1().node(), mctx.node(), labels |
1359 ) | 1353 ) |