Show More
@@ -137,6 +137,7 b' from mercurial import (' | |||||
137 | fileset, |
|
137 | fileset, | |
138 | hg, |
|
138 | hg, | |
139 | localrepo, |
|
139 | localrepo, | |
|
140 | merge, | |||
140 | minifileset, |
|
141 | minifileset, | |
141 | node, |
|
142 | node, | |
142 | pycompat, |
|
143 | pycompat, | |
@@ -331,6 +332,8 b' def extsetup(ui):' | |||||
331 | wrapfunction(hg, 'clone', wrapper.hgclone) |
|
332 | wrapfunction(hg, 'clone', wrapper.hgclone) | |
332 | wrapfunction(hg, 'postshare', wrapper.hgpostshare) |
|
333 | wrapfunction(hg, 'postshare', wrapper.hgpostshare) | |
333 |
|
334 | |||
|
335 | wrapfunction(merge, 'applyupdates', wrapper.mergemodapplyupdates) | |||
|
336 | ||||
334 | # Make bundle choose changegroup3 instead of changegroup2. This affects |
|
337 | # Make bundle choose changegroup3 instead of changegroup2. This affects | |
335 | # "hg bundle" command. Note: it does not cover all bundle formats like |
|
338 | # "hg bundle" command. Note: it does not cover all bundle formats like | |
336 | # "packed1". Using "packed1" with lfs will likely cause trouble. |
|
339 | # "packed1". Using "packed1" with lfs will likely cause trouble. |
@@ -249,6 +249,42 b' def hgpostshare(orig, sourcerepo, destre' | |||||
249 | if 'lfs' in destrepo.requirements: |
|
249 | if 'lfs' in destrepo.requirements: | |
250 | destrepo.vfs.append('hgrc', util.tonativeeol('\n[extensions]\nlfs=\n')) |
|
250 | destrepo.vfs.append('hgrc', util.tonativeeol('\n[extensions]\nlfs=\n')) | |
251 |
|
251 | |||
|
252 | def _prefetchfiles(repo, ctx, files): | |||
|
253 | """Ensure that required LFS blobs are present, fetching them as a group if | |||
|
254 | needed. | |||
|
255 | ||||
|
256 | This is centralized logic for various prefetch hooks.""" | |||
|
257 | pointers = [] | |||
|
258 | localstore = repo.svfs.lfslocalblobstore | |||
|
259 | ||||
|
260 | for f in files: | |||
|
261 | p = pointerfromctx(ctx, f) | |||
|
262 | if p and not localstore.has(p.oid()): | |||
|
263 | p.filename = f | |||
|
264 | pointers.append(p) | |||
|
265 | ||||
|
266 | if pointers: | |||
|
267 | repo.svfs.lfsremoteblobstore.readbatch(pointers, localstore) | |||
|
268 | ||||
|
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 | ||||
252 | def _canskipupload(repo): |
|
288 | def _canskipupload(repo): | |
253 | # if remotestore is a null store, upload is a no-op and can be skipped |
|
289 | # if remotestore is a null store, upload is a no-op and can be skipped | |
254 | return isinstance(repo.svfs.lfsremoteblobstore, blobstore._nullremote) |
|
290 | return isinstance(repo.svfs.lfsremoteblobstore, blobstore._nullremote) |
@@ -66,10 +66,10 b' Clear the cache to force a download' | |||||
66 | $ cd ../repo2 |
|
66 | $ cd ../repo2 | |
67 | $ hg update tip -v |
|
67 | $ hg update tip -v | |
68 | resolving manifests |
|
68 | resolving manifests | |
69 | getting a |
|
|||
70 | lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes) |
|
69 | lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes) | |
71 | lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache |
|
70 | lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache | |
72 | lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b |
|
71 | lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b | |
|
72 | getting a | |||
73 | lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store |
|
73 | lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store | |
74 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
74 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
75 |
|
75 | |||
@@ -99,17 +99,18 b' Clear the cache to force a download' | |||||
99 | $ rm -rf `hg config lfs.usercache` |
|
99 | $ rm -rf `hg config lfs.usercache` | |
100 | $ hg --repo ../repo1 update tip -v |
|
100 | $ hg --repo ../repo1 update tip -v | |
101 | resolving manifests |
|
101 | resolving manifests | |
102 | getting b |
|
102 | lfs: need to transfer 2 objects (39 bytes) | |
103 | lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store |
|
103 | lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes) | |
104 | getting c |
|
104 | lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache | |
|
105 | lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 | |||
105 | lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes) |
|
106 | lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes) | |
106 | lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache |
|
107 | lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache | |
107 | lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 |
|
108 | lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 | |
|
109 | getting b | |||
|
110 | lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store | |||
|
111 | getting c | |||
108 | lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store |
|
112 | lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store | |
109 | getting d |
|
113 | getting d | |
110 | lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes) |
|
|||
111 | lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache |
|
|||
112 | lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 |
|
|||
113 | lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store |
|
114 | lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store | |
114 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
115 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
115 |
|
116 | |||
@@ -123,11 +124,6 b' Test a corrupt file download, but clear ' | |||||
123 |
|
124 | |||
124 | $ hg --repo ../repo1 update -C tip -v |
|
125 | $ hg --repo ../repo1 update -C tip -v | |
125 | resolving manifests |
|
126 | resolving manifests | |
126 | getting a |
|
|||
127 | lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store |
|
|||
128 | getting b |
|
|||
129 | lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store |
|
|||
130 | getting c |
|
|||
131 | lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes) |
|
127 | lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes) | |
132 | abort: corrupt remote lfs object: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 |
|
128 | abort: corrupt remote lfs object: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 | |
133 | [255] |
|
129 | [255] |
@@ -760,7 +760,6 b' Damaging a file required by the update d' | |||||
760 | $ hg --config lfs.usercache=emptycache clone -v repo5 fromcorrupt2 |
|
760 | $ hg --config lfs.usercache=emptycache clone -v repo5 fromcorrupt2 | |
761 | updating to branch default |
|
761 | updating to branch default | |
762 | resolving manifests |
|
762 | resolving manifests | |
763 | getting l |
|
|||
764 | abort: corrupt remote lfs object: 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b |
|
763 | abort: corrupt remote lfs object: 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | |
765 | [255] |
|
764 | [255] | |
766 |
|
765 |
General Comments 0
You need to be logged in to leave comments.
Login now