##// END OF EJS Templates
merge: invoke scmutil.fileprefetchhooks() prior to applying updates...
Matt Harbison -
r36159:60dd840a default
parent child Browse files
Show More
@@ -137,7 +137,6 b' from mercurial import ('
137 fileset,
137 fileset,
138 hg,
138 hg,
139 localrepo,
139 localrepo,
140 merge,
141 minifileset,
140 minifileset,
142 node,
141 node,
143 pycompat,
142 pycompat,
@@ -333,8 +332,6 b' def extsetup(ui):'
333 wrapfunction(hg, 'clone', wrapper.hgclone)
332 wrapfunction(hg, 'clone', wrapper.hgclone)
334 wrapfunction(hg, 'postshare', wrapper.hgpostshare)
333 wrapfunction(hg, 'postshare', wrapper.hgpostshare)
335
334
336 wrapfunction(merge, 'applyupdates', wrapper.mergemodapplyupdates)
337
338 scmutil.fileprefetchhooks.add('lfs', wrapper._prefetchfiles)
335 scmutil.fileprefetchhooks.add('lfs', wrapper._prefetchfiles)
339
336
340 # Make bundle choose changegroup3 instead of changegroup2. This affects
337 # Make bundle choose changegroup3 instead of changegroup2. This affects
@@ -251,9 +251,7 b' def hgpostshare(orig, sourcerepo, destre'
251
251
252 def _prefetchfiles(repo, ctx, files):
252 def _prefetchfiles(repo, ctx, files):
253 """Ensure that required LFS blobs are present, fetching them as a group if
253 """Ensure that required LFS blobs are present, fetching them as a group if
254 needed.
254 needed."""
255
256 This is centralized logic for various prefetch hooks."""
257 pointers = []
255 pointers = []
258 localstore = repo.svfs.lfslocalblobstore
256 localstore = repo.svfs.lfslocalblobstore
259
257
@@ -266,25 +264,6 b' def _prefetchfiles(repo, ctx, files):'
266 if pointers:
264 if pointers:
267 repo.svfs.lfsremoteblobstore.readbatch(pointers, localstore)
265 repo.svfs.lfsremoteblobstore.readbatch(pointers, localstore)
268
266
269 def mergemodapplyupdates(orig, repo, actions, wctx, mctx, overwrite,
270 labels=None):
271 """Ensure that the required LFS blobs are present before applying updates,
272 fetching them as a group if needed.
273
274 This has the effect of ensuring all necessary LFS blobs are present before
275 making working directory changes during an update (including after clone and
276 share) or merge."""
277
278 # Skipping 'a', 'am', 'f', 'r', 'dm', 'e', 'k', 'p' and 'pr', because they
279 # don't touch mctx. 'cd' is skipped, because changed/deleted never resolves
280 # to something from the remote side.
281 oplist = [actions[a] for a in 'g dc dg m'.split()]
282
283 _prefetchfiles(repo, mctx,
284 [f for sublist in oplist for f, args, msg in sublist])
285
286 return orig(repo, actions, wctx, mctx, overwrite, labels)
287
288 def _canskipupload(repo):
267 def _canskipupload(repo):
289 # if remotestore is a null store, upload is a no-op and can be skipped
268 # if remotestore is a null store, upload is a no-op and can be skipped
290 return isinstance(repo.svfs.lfsremoteblobstore, blobstore._nullremote)
269 return isinstance(repo.svfs.lfsremoteblobstore, blobstore._nullremote)
@@ -1385,6 +1385,16 b' def batchget(repo, mctx, wctx, actions):'
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
@@ -1396,6 +1406,8 b' def applyupdates(repo, actions, wctx, mc'
1396 describes how many files were affected by the update.
1406 describes how many files were affected by the update.
1397 """
1407 """
1398
1408
1409 _prefetchfiles(repo, mctx, actions)
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 = []
General Comments 0
You need to be logged in to leave comments. Login now