Show More
@@ -1,1172 +1,1174 b'' | |||
|
1 | 1 | # Copyright 2009-2010 Gregory P. Ward |
|
2 | 2 | # Copyright 2009-2010 Intelerad Medical Systems Incorporated |
|
3 | 3 | # Copyright 2010-2011 Fog Creek Software |
|
4 | 4 | # Copyright 2010-2011 Unity Technologies |
|
5 | 5 | # |
|
6 | 6 | # This software may be used and distributed according to the terms of the |
|
7 | 7 | # GNU General Public License version 2 or any later version. |
|
8 | 8 | |
|
9 | 9 | '''Overridden Mercurial commands and functions for the largefiles extension''' |
|
10 | 10 | |
|
11 | 11 | import os |
|
12 | 12 | import copy |
|
13 | 13 | |
|
14 | 14 | from mercurial import hg, commands, util, cmdutil, scmutil, match as match_, \ |
|
15 | 15 | archival, merge, pathutil, revset |
|
16 | 16 | from mercurial.i18n import _ |
|
17 | 17 | from mercurial.node import hex |
|
18 | 18 | from hgext import rebase |
|
19 | 19 | |
|
20 | 20 | import lfutil |
|
21 | 21 | import lfcommands |
|
22 | 22 | import basestore |
|
23 | 23 | |
|
24 | 24 | # -- Utility functions: commonly/repeatedly needed functionality --------------- |
|
25 | 25 | |
|
26 | 26 | def installnormalfilesmatchfn(manifest): |
|
27 | 27 | '''installmatchfn with a matchfn that ignores all largefiles''' |
|
28 | 28 | def overridematch(ctx, pats=[], opts={}, globbed=False, |
|
29 | 29 | default='relpath'): |
|
30 | 30 | match = oldmatch(ctx, pats, opts, globbed, default) |
|
31 | 31 | m = copy.copy(match) |
|
32 | 32 | notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in |
|
33 | 33 | manifest) |
|
34 | 34 | m._files = filter(notlfile, m._files) |
|
35 | 35 | m._fmap = set(m._files) |
|
36 | 36 | m._always = False |
|
37 | 37 | origmatchfn = m.matchfn |
|
38 | 38 | m.matchfn = lambda f: notlfile(f) and origmatchfn(f) or None |
|
39 | 39 | return m |
|
40 | 40 | oldmatch = installmatchfn(overridematch) |
|
41 | 41 | |
|
42 | 42 | def installmatchfn(f): |
|
43 | 43 | '''monkey patch the scmutil module with a custom match function. |
|
44 | 44 | Warning: it is monkey patching the _module_ on runtime! Not thread safe!''' |
|
45 | 45 | oldmatch = scmutil.match |
|
46 | 46 | setattr(f, 'oldmatch', oldmatch) |
|
47 | 47 | scmutil.match = f |
|
48 | 48 | return oldmatch |
|
49 | 49 | |
|
50 | 50 | def restorematchfn(): |
|
51 | 51 | '''restores scmutil.match to what it was before installmatchfn |
|
52 | 52 | was called. no-op if scmutil.match is its original function. |
|
53 | 53 | |
|
54 | 54 | Note that n calls to installmatchfn will require n calls to |
|
55 | 55 | restore matchfn to reverse''' |
|
56 | 56 | scmutil.match = getattr(scmutil.match, 'oldmatch') |
|
57 | 57 | |
|
58 | 58 | def installmatchandpatsfn(f): |
|
59 | 59 | oldmatchandpats = scmutil.matchandpats |
|
60 | 60 | setattr(f, 'oldmatchandpats', oldmatchandpats) |
|
61 | 61 | scmutil.matchandpats = f |
|
62 | 62 | return oldmatchandpats |
|
63 | 63 | |
|
64 | 64 | def restorematchandpatsfn(): |
|
65 | 65 | '''restores scmutil.matchandpats to what it was before |
|
66 | 66 | installnormalfilesmatchandpatsfn was called. no-op if scmutil.matchandpats |
|
67 | 67 | is its original function. |
|
68 | 68 | |
|
69 | 69 | Note that n calls to installnormalfilesmatchandpatsfn will require n calls |
|
70 | 70 | to restore matchfn to reverse''' |
|
71 | 71 | scmutil.matchandpats = getattr(scmutil.matchandpats, 'oldmatchandpats', |
|
72 | 72 | scmutil.matchandpats) |
|
73 | 73 | |
|
74 | 74 | def addlargefiles(ui, repo, *pats, **opts): |
|
75 | 75 | large = opts.pop('large', None) |
|
76 | 76 | lfsize = lfutil.getminsize( |
|
77 | 77 | ui, lfutil.islfilesrepo(repo), opts.pop('lfsize', None)) |
|
78 | 78 | |
|
79 | 79 | lfmatcher = None |
|
80 | 80 | if lfutil.islfilesrepo(repo): |
|
81 | 81 | lfpats = ui.configlist(lfutil.longname, 'patterns', default=[]) |
|
82 | 82 | if lfpats: |
|
83 | 83 | lfmatcher = match_.match(repo.root, '', list(lfpats)) |
|
84 | 84 | |
|
85 | 85 | lfnames = [] |
|
86 | 86 | m = scmutil.match(repo[None], pats, opts) |
|
87 | 87 | m.bad = lambda x, y: None |
|
88 | 88 | wctx = repo[None] |
|
89 | 89 | for f in repo.walk(m): |
|
90 | 90 | exact = m.exact(f) |
|
91 | 91 | lfile = lfutil.standin(f) in wctx |
|
92 | 92 | nfile = f in wctx |
|
93 | 93 | exists = lfile or nfile |
|
94 | 94 | |
|
95 | 95 | # Don't warn the user when they attempt to add a normal tracked file. |
|
96 | 96 | # The normal add code will do that for us. |
|
97 | 97 | if exact and exists: |
|
98 | 98 | if lfile: |
|
99 | 99 | ui.warn(_('%s already a largefile\n') % f) |
|
100 | 100 | continue |
|
101 | 101 | |
|
102 | 102 | if (exact or not exists) and not lfutil.isstandin(f): |
|
103 | 103 | wfile = repo.wjoin(f) |
|
104 | 104 | |
|
105 | 105 | # In case the file was removed previously, but not committed |
|
106 | 106 | # (issue3507) |
|
107 | 107 | if not os.path.exists(wfile): |
|
108 | 108 | continue |
|
109 | 109 | |
|
110 | 110 | abovemin = (lfsize and |
|
111 | 111 | os.lstat(wfile).st_size >= lfsize * 1024 * 1024) |
|
112 | 112 | if large or abovemin or (lfmatcher and lfmatcher(f)): |
|
113 | 113 | lfnames.append(f) |
|
114 | 114 | if ui.verbose or not exact: |
|
115 | 115 | ui.status(_('adding %s as a largefile\n') % m.rel(f)) |
|
116 | 116 | |
|
117 | 117 | bad = [] |
|
118 | 118 | standins = [] |
|
119 | 119 | |
|
120 | 120 | # Need to lock, otherwise there could be a race condition between |
|
121 | 121 | # when standins are created and added to the repo. |
|
122 | 122 | wlock = repo.wlock() |
|
123 | 123 | try: |
|
124 | 124 | if not opts.get('dry_run'): |
|
125 | 125 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
126 | 126 | for f in lfnames: |
|
127 | 127 | standinname = lfutil.standin(f) |
|
128 | 128 | lfutil.writestandin(repo, standinname, hash='', |
|
129 | 129 | executable=lfutil.getexecutable(repo.wjoin(f))) |
|
130 | 130 | standins.append(standinname) |
|
131 | 131 | if lfdirstate[f] == 'r': |
|
132 | 132 | lfdirstate.normallookup(f) |
|
133 | 133 | else: |
|
134 | 134 | lfdirstate.add(f) |
|
135 | 135 | lfdirstate.write() |
|
136 | 136 | bad += [lfutil.splitstandin(f) |
|
137 | 137 | for f in repo[None].add(standins) |
|
138 | 138 | if f in m.files()] |
|
139 | 139 | finally: |
|
140 | 140 | wlock.release() |
|
141 | 141 | return bad |
|
142 | 142 | |
|
143 | 143 | def removelargefiles(ui, repo, *pats, **opts): |
|
144 | 144 | after = opts.get('after') |
|
145 | 145 | if not pats and not after: |
|
146 | 146 | raise util.Abort(_('no files specified')) |
|
147 | 147 | m = scmutil.match(repo[None], pats, opts) |
|
148 | 148 | try: |
|
149 | 149 | repo.lfstatus = True |
|
150 | 150 | s = repo.status(match=m, clean=True) |
|
151 | 151 | finally: |
|
152 | 152 | repo.lfstatus = False |
|
153 | 153 | manifest = repo[None].manifest() |
|
154 | 154 | modified, added, deleted, clean = [[f for f in list |
|
155 | 155 | if lfutil.standin(f) in manifest] |
|
156 | 156 | for list in [s[0], s[1], s[3], s[6]]] |
|
157 | 157 | |
|
158 | 158 | def warn(files, msg): |
|
159 | 159 | for f in files: |
|
160 | 160 | ui.warn(msg % m.rel(f)) |
|
161 | 161 | return int(len(files) > 0) |
|
162 | 162 | |
|
163 | 163 | result = 0 |
|
164 | 164 | |
|
165 | 165 | if after: |
|
166 | 166 | remove, forget = deleted, [] |
|
167 | 167 | result = warn(modified + added + clean, |
|
168 | 168 | _('not removing %s: file still exists\n')) |
|
169 | 169 | else: |
|
170 | 170 | remove, forget = deleted + clean, [] |
|
171 | 171 | result = warn(modified, _('not removing %s: file is modified (use -f' |
|
172 | 172 | ' to force removal)\n')) |
|
173 | 173 | result = warn(added, _('not removing %s: file has been marked for add' |
|
174 | 174 | ' (use forget to undo)\n')) or result |
|
175 | 175 | |
|
176 | 176 | for f in sorted(remove + forget): |
|
177 | 177 | if ui.verbose or not m.exact(f): |
|
178 | 178 | ui.status(_('removing %s\n') % m.rel(f)) |
|
179 | 179 | |
|
180 | 180 | # Need to lock because standin files are deleted then removed from the |
|
181 | 181 | # repository and we could race in-between. |
|
182 | 182 | wlock = repo.wlock() |
|
183 | 183 | try: |
|
184 | 184 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
185 | 185 | for f in remove: |
|
186 | 186 | if not after: |
|
187 | 187 | # If this is being called by addremove, notify the user that we |
|
188 | 188 | # are removing the file. |
|
189 | 189 | if getattr(repo, "_isaddremove", False): |
|
190 | 190 | ui.status(_('removing %s\n') % f) |
|
191 | 191 | util.unlinkpath(repo.wjoin(f), ignoremissing=True) |
|
192 | 192 | lfdirstate.remove(f) |
|
193 | 193 | lfdirstate.write() |
|
194 | 194 | forget = [lfutil.standin(f) for f in forget] |
|
195 | 195 | remove = [lfutil.standin(f) for f in remove] |
|
196 | 196 | repo[None].forget(forget) |
|
197 | 197 | # If this is being called by addremove, let the original addremove |
|
198 | 198 | # function handle this. |
|
199 | 199 | if not getattr(repo, "_isaddremove", False): |
|
200 | 200 | for f in remove: |
|
201 | 201 | util.unlinkpath(repo.wjoin(f), ignoremissing=True) |
|
202 | 202 | repo[None].forget(remove) |
|
203 | 203 | finally: |
|
204 | 204 | wlock.release() |
|
205 | 205 | |
|
206 | 206 | return result |
|
207 | 207 | |
|
208 | 208 | # For overriding mercurial.hgweb.webcommands so that largefiles will |
|
209 | 209 | # appear at their right place in the manifests. |
|
210 | 210 | def decodepath(orig, path): |
|
211 | 211 | return lfutil.splitstandin(path) or path |
|
212 | 212 | |
|
213 | 213 | # -- Wrappers: modify existing commands -------------------------------- |
|
214 | 214 | |
|
215 | 215 | # Add works by going through the files that the user wanted to add and |
|
216 | 216 | # checking if they should be added as largefiles. Then it makes a new |
|
217 | 217 | # matcher which matches only the normal files and runs the original |
|
218 | 218 | # version of add. |
|
219 | 219 | def overrideadd(orig, ui, repo, *pats, **opts): |
|
220 | 220 | normal = opts.pop('normal') |
|
221 | 221 | if normal: |
|
222 | 222 | if opts.get('large'): |
|
223 | 223 | raise util.Abort(_('--normal cannot be used with --large')) |
|
224 | 224 | return orig(ui, repo, *pats, **opts) |
|
225 | 225 | bad = addlargefiles(ui, repo, *pats, **opts) |
|
226 | 226 | installnormalfilesmatchfn(repo[None].manifest()) |
|
227 | 227 | result = orig(ui, repo, *pats, **opts) |
|
228 | 228 | restorematchfn() |
|
229 | 229 | |
|
230 | 230 | return (result == 1 or bad) and 1 or 0 |
|
231 | 231 | |
|
232 | 232 | def overrideremove(orig, ui, repo, *pats, **opts): |
|
233 | 233 | installnormalfilesmatchfn(repo[None].manifest()) |
|
234 | 234 | result = orig(ui, repo, *pats, **opts) |
|
235 | 235 | restorematchfn() |
|
236 | 236 | return removelargefiles(ui, repo, *pats, **opts) or result |
|
237 | 237 | |
|
238 | 238 | def overridestatusfn(orig, repo, rev2, **opts): |
|
239 | 239 | try: |
|
240 | 240 | repo._repo.lfstatus = True |
|
241 | 241 | return orig(repo, rev2, **opts) |
|
242 | 242 | finally: |
|
243 | 243 | repo._repo.lfstatus = False |
|
244 | 244 | |
|
245 | 245 | def overridestatus(orig, ui, repo, *pats, **opts): |
|
246 | 246 | try: |
|
247 | 247 | repo.lfstatus = True |
|
248 | 248 | return orig(ui, repo, *pats, **opts) |
|
249 | 249 | finally: |
|
250 | 250 | repo.lfstatus = False |
|
251 | 251 | |
|
252 | 252 | def overridedirty(orig, repo, ignoreupdate=False): |
|
253 | 253 | try: |
|
254 | 254 | repo._repo.lfstatus = True |
|
255 | 255 | return orig(repo, ignoreupdate) |
|
256 | 256 | finally: |
|
257 | 257 | repo._repo.lfstatus = False |
|
258 | 258 | |
|
259 | 259 | def overridelog(orig, ui, repo, *pats, **opts): |
|
260 | 260 | def overridematchandpats(ctx, pats=[], opts={}, globbed=False, |
|
261 | 261 | default='relpath'): |
|
262 | 262 | """Matcher that merges root directory with .hglf, suitable for log. |
|
263 | 263 | It is still possible to match .hglf directly. |
|
264 | 264 | For any listed files run log on the standin too. |
|
265 | 265 | matchfn tries both the given filename and with .hglf stripped. |
|
266 | 266 | """ |
|
267 | 267 | matchandpats = oldmatchandpats(ctx, pats, opts, globbed, default) |
|
268 | 268 | m, p = copy.copy(matchandpats) |
|
269 | 269 | |
|
270 | 270 | pats = set(p) |
|
271 | 271 | # TODO: handling of patterns in both cases below |
|
272 | 272 | if m._cwd: |
|
273 | 273 | if os.path.isabs(m._cwd): |
|
274 | 274 | # TODO: handle largefile magic when invoked from other cwd |
|
275 | 275 | return matchandpats |
|
276 | 276 | back = (m._cwd.count('/') + 1) * '../' |
|
277 | 277 | pats.update(back + lfutil.standin(m._cwd + '/' + f) for f in p) |
|
278 | 278 | else: |
|
279 | 279 | pats.update(lfutil.standin(f) for f in p) |
|
280 | 280 | |
|
281 | 281 | for i in range(0, len(m._files)): |
|
282 | 282 | standin = lfutil.standin(m._files[i]) |
|
283 | 283 | if standin in repo[ctx.node()]: |
|
284 | 284 | m._files[i] = standin |
|
285 | elif m._files[i] not in repo[ctx.node()]: | |
|
286 | m._files.append(standin) | |
|
285 | 287 | pats.add(standin) |
|
286 | 288 | |
|
287 | 289 | m._fmap = set(m._files) |
|
288 | 290 | m._always = False |
|
289 | 291 | origmatchfn = m.matchfn |
|
290 | 292 | def lfmatchfn(f): |
|
291 | 293 | lf = lfutil.splitstandin(f) |
|
292 | 294 | if lf is not None and origmatchfn(lf): |
|
293 | 295 | return True |
|
294 | 296 | r = origmatchfn(f) |
|
295 | 297 | return r |
|
296 | 298 | m.matchfn = lfmatchfn |
|
297 | 299 | |
|
298 | 300 | return m, pats |
|
299 | 301 | |
|
300 | 302 | oldmatchandpats = installmatchandpatsfn(overridematchandpats) |
|
301 | 303 | try: |
|
302 | 304 | repo.lfstatus = True |
|
303 | 305 | return orig(ui, repo, *pats, **opts) |
|
304 | 306 | finally: |
|
305 | 307 | repo.lfstatus = False |
|
306 | 308 | restorematchandpatsfn() |
|
307 | 309 | |
|
308 | 310 | def overrideverify(orig, ui, repo, *pats, **opts): |
|
309 | 311 | large = opts.pop('large', False) |
|
310 | 312 | all = opts.pop('lfa', False) |
|
311 | 313 | contents = opts.pop('lfc', False) |
|
312 | 314 | |
|
313 | 315 | result = orig(ui, repo, *pats, **opts) |
|
314 | 316 | if large or all or contents: |
|
315 | 317 | result = result or lfcommands.verifylfiles(ui, repo, all, contents) |
|
316 | 318 | return result |
|
317 | 319 | |
|
318 | 320 | def overridedebugstate(orig, ui, repo, *pats, **opts): |
|
319 | 321 | large = opts.pop('large', False) |
|
320 | 322 | if large: |
|
321 | 323 | class fakerepo(object): |
|
322 | 324 | dirstate = lfutil.openlfdirstate(ui, repo) |
|
323 | 325 | orig(ui, fakerepo, *pats, **opts) |
|
324 | 326 | else: |
|
325 | 327 | orig(ui, repo, *pats, **opts) |
|
326 | 328 | |
|
327 | 329 | # Override needs to refresh standins so that update's normal merge |
|
328 | 330 | # will go through properly. Then the other update hook (overriding repo.update) |
|
329 | 331 | # will get the new files. Filemerge is also overridden so that the merge |
|
330 | 332 | # will merge standins correctly. |
|
331 | 333 | def overrideupdate(orig, ui, repo, *pats, **opts): |
|
332 | 334 | # Need to lock between the standins getting updated and their |
|
333 | 335 | # largefiles getting updated |
|
334 | 336 | wlock = repo.wlock() |
|
335 | 337 | try: |
|
336 | 338 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
337 | 339 | s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), |
|
338 | 340 | [], False, False, False) |
|
339 | 341 | (unsure, modified, added, removed, missing, unknown, ignored, clean) = s |
|
340 | 342 | |
|
341 | 343 | if opts['check']: |
|
342 | 344 | mod = len(modified) > 0 |
|
343 | 345 | for lfile in unsure: |
|
344 | 346 | standin = lfutil.standin(lfile) |
|
345 | 347 | if repo['.'][standin].data().strip() != \ |
|
346 | 348 | lfutil.hashfile(repo.wjoin(lfile)): |
|
347 | 349 | mod = True |
|
348 | 350 | else: |
|
349 | 351 | lfdirstate.normal(lfile) |
|
350 | 352 | lfdirstate.write() |
|
351 | 353 | if mod: |
|
352 | 354 | raise util.Abort(_('uncommitted changes')) |
|
353 | 355 | # XXX handle removed differently |
|
354 | 356 | if not opts['clean']: |
|
355 | 357 | for lfile in unsure + modified + added: |
|
356 | 358 | lfutil.updatestandin(repo, lfutil.standin(lfile)) |
|
357 | 359 | return orig(ui, repo, *pats, **opts) |
|
358 | 360 | finally: |
|
359 | 361 | wlock.release() |
|
360 | 362 | |
|
361 | 363 | # Before starting the manifest merge, merge.updates will call |
|
362 | 364 | # _checkunknown to check if there are any files in the merged-in |
|
363 | 365 | # changeset that collide with unknown files in the working copy. |
|
364 | 366 | # |
|
365 | 367 | # The largefiles are seen as unknown, so this prevents us from merging |
|
366 | 368 | # in a file 'foo' if we already have a largefile with the same name. |
|
367 | 369 | # |
|
368 | 370 | # The overridden function filters the unknown files by removing any |
|
369 | 371 | # largefiles. This makes the merge proceed and we can then handle this |
|
370 | 372 | # case further in the overridden manifestmerge function below. |
|
371 | 373 | def overridecheckunknownfile(origfn, repo, wctx, mctx, f): |
|
372 | 374 | if lfutil.standin(repo.dirstate.normalize(f)) in wctx: |
|
373 | 375 | return False |
|
374 | 376 | return origfn(repo, wctx, mctx, f) |
|
375 | 377 | |
|
376 | 378 | # The manifest merge handles conflicts on the manifest level. We want |
|
377 | 379 | # to handle changes in largefile-ness of files at this level too. |
|
378 | 380 | # |
|
379 | 381 | # The strategy is to run the original manifestmerge and then process |
|
380 | 382 | # the action list it outputs. There are two cases we need to deal with: |
|
381 | 383 | # |
|
382 | 384 | # 1. Normal file in p1, largefile in p2. Here the largefile is |
|
383 | 385 | # detected via its standin file, which will enter the working copy |
|
384 | 386 | # with a "get" action. It is not "merge" since the standin is all |
|
385 | 387 | # Mercurial is concerned with at this level -- the link to the |
|
386 | 388 | # existing normal file is not relevant here. |
|
387 | 389 | # |
|
388 | 390 | # 2. Largefile in p1, normal file in p2. Here we get a "merge" action |
|
389 | 391 | # since the largefile will be present in the working copy and |
|
390 | 392 | # different from the normal file in p2. Mercurial therefore |
|
391 | 393 | # triggers a merge action. |
|
392 | 394 | # |
|
393 | 395 | # In both cases, we prompt the user and emit new actions to either |
|
394 | 396 | # remove the standin (if the normal file was kept) or to remove the |
|
395 | 397 | # normal file and get the standin (if the largefile was kept). The |
|
396 | 398 | # default prompt answer is to use the largefile version since it was |
|
397 | 399 | # presumably changed on purpose. |
|
398 | 400 | # |
|
399 | 401 | # Finally, the merge.applyupdates function will then take care of |
|
400 | 402 | # writing the files into the working copy and lfcommands.updatelfiles |
|
401 | 403 | # will update the largefiles. |
|
402 | 404 | def overridecalculateupdates(origfn, repo, p1, p2, pas, branchmerge, force, |
|
403 | 405 | partial, acceptremote, followcopies): |
|
404 | 406 | overwrite = force and not branchmerge |
|
405 | 407 | actions = origfn(repo, p1, p2, pas, branchmerge, force, partial, |
|
406 | 408 | acceptremote, followcopies) |
|
407 | 409 | |
|
408 | 410 | if overwrite: |
|
409 | 411 | return actions |
|
410 | 412 | |
|
411 | 413 | removes = set(a[0] for a in actions if a[1] == 'r') |
|
412 | 414 | processed = [] |
|
413 | 415 | |
|
414 | 416 | for action in actions: |
|
415 | 417 | f, m, args, msg = action |
|
416 | 418 | |
|
417 | 419 | splitstandin = f and lfutil.splitstandin(f) |
|
418 | 420 | if (m == "g" and splitstandin is not None and |
|
419 | 421 | splitstandin in p1 and splitstandin not in removes): |
|
420 | 422 | # Case 1: normal file in the working copy, largefile in |
|
421 | 423 | # the second parent |
|
422 | 424 | lfile = splitstandin |
|
423 | 425 | standin = f |
|
424 | 426 | msg = _('remote turned local normal file %s into a largefile\n' |
|
425 | 427 | 'use (l)argefile or keep (n)ormal file?' |
|
426 | 428 | '$$ &Largefile $$ &Normal file') % lfile |
|
427 | 429 | if repo.ui.promptchoice(msg, 0) == 0: |
|
428 | 430 | processed.append((lfile, "r", None, msg)) |
|
429 | 431 | processed.append((standin, "g", (p2.flags(standin),), msg)) |
|
430 | 432 | else: |
|
431 | 433 | processed.append((standin, "r", None, msg)) |
|
432 | 434 | elif (m == "g" and |
|
433 | 435 | lfutil.standin(f) in p1 and lfutil.standin(f) not in removes): |
|
434 | 436 | # Case 2: largefile in the working copy, normal file in |
|
435 | 437 | # the second parent |
|
436 | 438 | standin = lfutil.standin(f) |
|
437 | 439 | lfile = f |
|
438 | 440 | msg = _('remote turned local largefile %s into a normal file\n' |
|
439 | 441 | 'keep (l)argefile or use (n)ormal file?' |
|
440 | 442 | '$$ &Largefile $$ &Normal file') % lfile |
|
441 | 443 | if repo.ui.promptchoice(msg, 0) == 0: |
|
442 | 444 | processed.append((lfile, "r", None, msg)) |
|
443 | 445 | else: |
|
444 | 446 | processed.append((standin, "r", None, msg)) |
|
445 | 447 | processed.append((lfile, "g", (p2.flags(lfile),), msg)) |
|
446 | 448 | else: |
|
447 | 449 | processed.append(action) |
|
448 | 450 | |
|
449 | 451 | return processed |
|
450 | 452 | |
|
451 | 453 | # Override filemerge to prompt the user about how they wish to merge |
|
452 | 454 | # largefiles. This will handle identical edits without prompting the user. |
|
453 | 455 | def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca): |
|
454 | 456 | if not lfutil.isstandin(orig): |
|
455 | 457 | return origfn(repo, mynode, orig, fcd, fco, fca) |
|
456 | 458 | |
|
457 | 459 | ahash = fca.data().strip().lower() |
|
458 | 460 | dhash = fcd.data().strip().lower() |
|
459 | 461 | ohash = fco.data().strip().lower() |
|
460 | 462 | if (ohash != ahash and |
|
461 | 463 | ohash != dhash and |
|
462 | 464 | (dhash == ahash or |
|
463 | 465 | repo.ui.promptchoice( |
|
464 | 466 | _('largefile %s has a merge conflict\nancestor was %s\n' |
|
465 | 467 | 'keep (l)ocal %s or\ntake (o)ther %s?' |
|
466 | 468 | '$$ &Local $$ &Other') % |
|
467 | 469 | (lfutil.splitstandin(orig), ahash, dhash, ohash), |
|
468 | 470 | 0) == 1)): |
|
469 | 471 | repo.wwrite(fcd.path(), fco.data(), fco.flags()) |
|
470 | 472 | return 0 |
|
471 | 473 | |
|
472 | 474 | # Copy first changes the matchers to match standins instead of |
|
473 | 475 | # largefiles. Then it overrides util.copyfile in that function it |
|
474 | 476 | # checks if the destination largefile already exists. It also keeps a |
|
475 | 477 | # list of copied files so that the largefiles can be copied and the |
|
476 | 478 | # dirstate updated. |
|
477 | 479 | def overridecopy(orig, ui, repo, pats, opts, rename=False): |
|
478 | 480 | # doesn't remove largefile on rename |
|
479 | 481 | if len(pats) < 2: |
|
480 | 482 | # this isn't legal, let the original function deal with it |
|
481 | 483 | return orig(ui, repo, pats, opts, rename) |
|
482 | 484 | |
|
483 | 485 | def makestandin(relpath): |
|
484 | 486 | path = pathutil.canonpath(repo.root, repo.getcwd(), relpath) |
|
485 | 487 | return os.path.join(repo.wjoin(lfutil.standin(path))) |
|
486 | 488 | |
|
487 | 489 | fullpats = scmutil.expandpats(pats) |
|
488 | 490 | dest = fullpats[-1] |
|
489 | 491 | |
|
490 | 492 | if os.path.isdir(dest): |
|
491 | 493 | if not os.path.isdir(makestandin(dest)): |
|
492 | 494 | os.makedirs(makestandin(dest)) |
|
493 | 495 | # This could copy both lfiles and normal files in one command, |
|
494 | 496 | # but we don't want to do that. First replace their matcher to |
|
495 | 497 | # only match normal files and run it, then replace it to just |
|
496 | 498 | # match largefiles and run it again. |
|
497 | 499 | nonormalfiles = False |
|
498 | 500 | nolfiles = False |
|
499 | 501 | installnormalfilesmatchfn(repo[None].manifest()) |
|
500 | 502 | try: |
|
501 | 503 | try: |
|
502 | 504 | result = orig(ui, repo, pats, opts, rename) |
|
503 | 505 | except util.Abort, e: |
|
504 | 506 | if str(e) != _('no files to copy'): |
|
505 | 507 | raise e |
|
506 | 508 | else: |
|
507 | 509 | nonormalfiles = True |
|
508 | 510 | result = 0 |
|
509 | 511 | finally: |
|
510 | 512 | restorematchfn() |
|
511 | 513 | |
|
512 | 514 | # The first rename can cause our current working directory to be removed. |
|
513 | 515 | # In that case there is nothing left to copy/rename so just quit. |
|
514 | 516 | try: |
|
515 | 517 | repo.getcwd() |
|
516 | 518 | except OSError: |
|
517 | 519 | return result |
|
518 | 520 | |
|
519 | 521 | try: |
|
520 | 522 | try: |
|
521 | 523 | # When we call orig below it creates the standins but we don't add |
|
522 | 524 | # them to the dir state until later so lock during that time. |
|
523 | 525 | wlock = repo.wlock() |
|
524 | 526 | |
|
525 | 527 | manifest = repo[None].manifest() |
|
526 | 528 | def overridematch(ctx, pats=[], opts={}, globbed=False, |
|
527 | 529 | default='relpath'): |
|
528 | 530 | newpats = [] |
|
529 | 531 | # The patterns were previously mangled to add the standin |
|
530 | 532 | # directory; we need to remove that now |
|
531 | 533 | for pat in pats: |
|
532 | 534 | if match_.patkind(pat) is None and lfutil.shortname in pat: |
|
533 | 535 | newpats.append(pat.replace(lfutil.shortname, '')) |
|
534 | 536 | else: |
|
535 | 537 | newpats.append(pat) |
|
536 | 538 | match = oldmatch(ctx, newpats, opts, globbed, default) |
|
537 | 539 | m = copy.copy(match) |
|
538 | 540 | lfile = lambda f: lfutil.standin(f) in manifest |
|
539 | 541 | m._files = [lfutil.standin(f) for f in m._files if lfile(f)] |
|
540 | 542 | m._fmap = set(m._files) |
|
541 | 543 | m._always = False |
|
542 | 544 | origmatchfn = m.matchfn |
|
543 | 545 | m.matchfn = lambda f: (lfutil.isstandin(f) and |
|
544 | 546 | (f in manifest) and |
|
545 | 547 | origmatchfn(lfutil.splitstandin(f)) or |
|
546 | 548 | None) |
|
547 | 549 | return m |
|
548 | 550 | oldmatch = installmatchfn(overridematch) |
|
549 | 551 | listpats = [] |
|
550 | 552 | for pat in pats: |
|
551 | 553 | if match_.patkind(pat) is not None: |
|
552 | 554 | listpats.append(pat) |
|
553 | 555 | else: |
|
554 | 556 | listpats.append(makestandin(pat)) |
|
555 | 557 | |
|
556 | 558 | try: |
|
557 | 559 | origcopyfile = util.copyfile |
|
558 | 560 | copiedfiles = [] |
|
559 | 561 | def overridecopyfile(src, dest): |
|
560 | 562 | if (lfutil.shortname in src and |
|
561 | 563 | dest.startswith(repo.wjoin(lfutil.shortname))): |
|
562 | 564 | destlfile = dest.replace(lfutil.shortname, '') |
|
563 | 565 | if not opts['force'] and os.path.exists(destlfile): |
|
564 | 566 | raise IOError('', |
|
565 | 567 | _('destination largefile already exists')) |
|
566 | 568 | copiedfiles.append((src, dest)) |
|
567 | 569 | origcopyfile(src, dest) |
|
568 | 570 | |
|
569 | 571 | util.copyfile = overridecopyfile |
|
570 | 572 | result += orig(ui, repo, listpats, opts, rename) |
|
571 | 573 | finally: |
|
572 | 574 | util.copyfile = origcopyfile |
|
573 | 575 | |
|
574 | 576 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
575 | 577 | for (src, dest) in copiedfiles: |
|
576 | 578 | if (lfutil.shortname in src and |
|
577 | 579 | dest.startswith(repo.wjoin(lfutil.shortname))): |
|
578 | 580 | srclfile = src.replace(repo.wjoin(lfutil.standin('')), '') |
|
579 | 581 | destlfile = dest.replace(repo.wjoin(lfutil.standin('')), '') |
|
580 | 582 | destlfiledir = os.path.dirname(repo.wjoin(destlfile)) or '.' |
|
581 | 583 | if not os.path.isdir(destlfiledir): |
|
582 | 584 | os.makedirs(destlfiledir) |
|
583 | 585 | if rename: |
|
584 | 586 | os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile)) |
|
585 | 587 | |
|
586 | 588 | # The file is gone, but this deletes any empty parent |
|
587 | 589 | # directories as a side-effect. |
|
588 | 590 | util.unlinkpath(repo.wjoin(srclfile), True) |
|
589 | 591 | lfdirstate.remove(srclfile) |
|
590 | 592 | else: |
|
591 | 593 | util.copyfile(repo.wjoin(srclfile), |
|
592 | 594 | repo.wjoin(destlfile)) |
|
593 | 595 | |
|
594 | 596 | lfdirstate.add(destlfile) |
|
595 | 597 | lfdirstate.write() |
|
596 | 598 | except util.Abort, e: |
|
597 | 599 | if str(e) != _('no files to copy'): |
|
598 | 600 | raise e |
|
599 | 601 | else: |
|
600 | 602 | nolfiles = True |
|
601 | 603 | finally: |
|
602 | 604 | restorematchfn() |
|
603 | 605 | wlock.release() |
|
604 | 606 | |
|
605 | 607 | if nolfiles and nonormalfiles: |
|
606 | 608 | raise util.Abort(_('no files to copy')) |
|
607 | 609 | |
|
608 | 610 | return result |
|
609 | 611 | |
|
610 | 612 | # When the user calls revert, we have to be careful to not revert any |
|
611 | 613 | # changes to other largefiles accidentally. This means we have to keep |
|
612 | 614 | # track of the largefiles that are being reverted so we only pull down |
|
613 | 615 | # the necessary largefiles. |
|
614 | 616 | # |
|
615 | 617 | # Standins are only updated (to match the hash of largefiles) before |
|
616 | 618 | # commits. Update the standins then run the original revert, changing |
|
617 | 619 | # the matcher to hit standins instead of largefiles. Based on the |
|
618 | 620 | # resulting standins update the largefiles. |
|
619 | 621 | def overriderevert(orig, ui, repo, *pats, **opts): |
|
620 | 622 | # Because we put the standins in a bad state (by updating them) |
|
621 | 623 | # and then return them to a correct state we need to lock to |
|
622 | 624 | # prevent others from changing them in their incorrect state. |
|
623 | 625 | wlock = repo.wlock() |
|
624 | 626 | try: |
|
625 | 627 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
626 | 628 | (modified, added, removed, missing, unknown, ignored, clean) = \ |
|
627 | 629 | lfutil.lfdirstatestatus(lfdirstate, repo, repo['.'].rev()) |
|
628 | 630 | lfdirstate.write() |
|
629 | 631 | for lfile in modified: |
|
630 | 632 | lfutil.updatestandin(repo, lfutil.standin(lfile)) |
|
631 | 633 | for lfile in missing: |
|
632 | 634 | if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))): |
|
633 | 635 | os.unlink(repo.wjoin(lfutil.standin(lfile))) |
|
634 | 636 | |
|
635 | 637 | oldstandins = lfutil.getstandinsstate(repo) |
|
636 | 638 | |
|
637 | 639 | def overridematch(ctx, pats=[], opts={}, globbed=False, |
|
638 | 640 | default='relpath'): |
|
639 | 641 | match = oldmatch(ctx, pats, opts, globbed, default) |
|
640 | 642 | m = copy.copy(match) |
|
641 | 643 | def tostandin(f): |
|
642 | 644 | if lfutil.standin(f) in ctx: |
|
643 | 645 | return lfutil.standin(f) |
|
644 | 646 | elif lfutil.standin(f) in repo[None]: |
|
645 | 647 | return None |
|
646 | 648 | return f |
|
647 | 649 | m._files = [tostandin(f) for f in m._files] |
|
648 | 650 | m._files = [f for f in m._files if f is not None] |
|
649 | 651 | m._fmap = set(m._files) |
|
650 | 652 | m._always = False |
|
651 | 653 | origmatchfn = m.matchfn |
|
652 | 654 | def matchfn(f): |
|
653 | 655 | if lfutil.isstandin(f): |
|
654 | 656 | return (origmatchfn(lfutil.splitstandin(f)) and |
|
655 | 657 | (f in repo[None] or f in ctx)) |
|
656 | 658 | return origmatchfn(f) |
|
657 | 659 | m.matchfn = matchfn |
|
658 | 660 | return m |
|
659 | 661 | oldmatch = installmatchfn(overridematch) |
|
660 | 662 | try: |
|
661 | 663 | orig(ui, repo, *pats, **opts) |
|
662 | 664 | finally: |
|
663 | 665 | restorematchfn() |
|
664 | 666 | |
|
665 | 667 | newstandins = lfutil.getstandinsstate(repo) |
|
666 | 668 | filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) |
|
667 | 669 | lfcommands.updatelfiles(ui, repo, filelist, printmessage=False) |
|
668 | 670 | |
|
669 | 671 | finally: |
|
670 | 672 | wlock.release() |
|
671 | 673 | |
|
672 | 674 | def hgupdaterepo(orig, repo, node, overwrite): |
|
673 | 675 | if not overwrite: |
|
674 | 676 | # Only call updatelfiles on the standins that have changed to save time |
|
675 | 677 | oldstandins = lfutil.getstandinsstate(repo) |
|
676 | 678 | |
|
677 | 679 | result = orig(repo, node, overwrite) |
|
678 | 680 | |
|
679 | 681 | filelist = None |
|
680 | 682 | if not overwrite: |
|
681 | 683 | newstandins = lfutil.getstandinsstate(repo) |
|
682 | 684 | filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) |
|
683 | 685 | lfcommands.updatelfiles(repo.ui, repo, filelist=filelist) |
|
684 | 686 | return result |
|
685 | 687 | |
|
686 | 688 | def hgmerge(orig, repo, node, force=None, remind=True): |
|
687 | 689 | result = orig(repo, node, force, remind) |
|
688 | 690 | lfcommands.updatelfiles(repo.ui, repo) |
|
689 | 691 | return result |
|
690 | 692 | |
|
691 | 693 | # When we rebase a repository with remotely changed largefiles, we need to |
|
692 | 694 | # take some extra care so that the largefiles are correctly updated in the |
|
693 | 695 | # working copy |
|
694 | 696 | def overridepull(orig, ui, repo, source=None, **opts): |
|
695 | 697 | revsprepull = len(repo) |
|
696 | 698 | if not source: |
|
697 | 699 | source = 'default' |
|
698 | 700 | repo.lfpullsource = source |
|
699 | 701 | if opts.get('rebase', False): |
|
700 | 702 | repo._isrebasing = True |
|
701 | 703 | try: |
|
702 | 704 | if opts.get('update'): |
|
703 | 705 | del opts['update'] |
|
704 | 706 | ui.debug('--update and --rebase are not compatible, ignoring ' |
|
705 | 707 | 'the update flag\n') |
|
706 | 708 | del opts['rebase'] |
|
707 | 709 | origpostincoming = commands.postincoming |
|
708 | 710 | def _dummy(*args, **kwargs): |
|
709 | 711 | pass |
|
710 | 712 | commands.postincoming = _dummy |
|
711 | 713 | try: |
|
712 | 714 | result = commands.pull(ui, repo, source, **opts) |
|
713 | 715 | finally: |
|
714 | 716 | commands.postincoming = origpostincoming |
|
715 | 717 | revspostpull = len(repo) |
|
716 | 718 | if revspostpull > revsprepull: |
|
717 | 719 | result = result or rebase.rebase(ui, repo) |
|
718 | 720 | finally: |
|
719 | 721 | repo._isrebasing = False |
|
720 | 722 | else: |
|
721 | 723 | result = orig(ui, repo, source, **opts) |
|
722 | 724 | revspostpull = len(repo) |
|
723 | 725 | lfrevs = opts.get('lfrev', []) |
|
724 | 726 | if opts.get('all_largefiles'): |
|
725 | 727 | lfrevs.append('pulled()') |
|
726 | 728 | if lfrevs and revspostpull > revsprepull: |
|
727 | 729 | numcached = 0 |
|
728 | 730 | repo.firstpulled = revsprepull # for pulled() revset expression |
|
729 | 731 | try: |
|
730 | 732 | for rev in scmutil.revrange(repo, lfrevs): |
|
731 | 733 | ui.note(_('pulling largefiles for revision %s\n') % rev) |
|
732 | 734 | (cached, missing) = lfcommands.cachelfiles(ui, repo, rev) |
|
733 | 735 | numcached += len(cached) |
|
734 | 736 | finally: |
|
735 | 737 | del repo.firstpulled |
|
736 | 738 | ui.status(_("%d largefiles cached\n") % numcached) |
|
737 | 739 | return result |
|
738 | 740 | |
|
739 | 741 | def pulledrevsetsymbol(repo, subset, x): |
|
740 | 742 | """``pulled()`` |
|
741 | 743 | Changesets that just has been pulled. |
|
742 | 744 | |
|
743 | 745 | Only available with largefiles from pull --lfrev expressions. |
|
744 | 746 | |
|
745 | 747 | .. container:: verbose |
|
746 | 748 | |
|
747 | 749 | Some examples: |
|
748 | 750 | |
|
749 | 751 | - pull largefiles for all new changesets:: |
|
750 | 752 | |
|
751 | 753 | hg pull -lfrev "pulled()" |
|
752 | 754 | |
|
753 | 755 | - pull largefiles for all new branch heads:: |
|
754 | 756 | |
|
755 | 757 | hg pull -lfrev "head(pulled()) and not closed()" |
|
756 | 758 | |
|
757 | 759 | """ |
|
758 | 760 | |
|
759 | 761 | try: |
|
760 | 762 | firstpulled = repo.firstpulled |
|
761 | 763 | except AttributeError: |
|
762 | 764 | raise util.Abort(_("pulled() only available in --lfrev")) |
|
763 | 765 | return revset.baseset([r for r in subset if r >= firstpulled]) |
|
764 | 766 | |
|
765 | 767 | def overrideclone(orig, ui, source, dest=None, **opts): |
|
766 | 768 | d = dest |
|
767 | 769 | if d is None: |
|
768 | 770 | d = hg.defaultdest(source) |
|
769 | 771 | if opts.get('all_largefiles') and not hg.islocal(d): |
|
770 | 772 | raise util.Abort(_( |
|
771 | 773 | '--all-largefiles is incompatible with non-local destination %s') % |
|
772 | 774 | d) |
|
773 | 775 | |
|
774 | 776 | return orig(ui, source, dest, **opts) |
|
775 | 777 | |
|
776 | 778 | def hgclone(orig, ui, opts, *args, **kwargs): |
|
777 | 779 | result = orig(ui, opts, *args, **kwargs) |
|
778 | 780 | |
|
779 | 781 | if result is not None: |
|
780 | 782 | sourcerepo, destrepo = result |
|
781 | 783 | repo = destrepo.local() |
|
782 | 784 | |
|
783 | 785 | # Caching is implicitly limited to 'rev' option, since the dest repo was |
|
784 | 786 | # truncated at that point. The user may expect a download count with |
|
785 | 787 | # this option, so attempt whether or not this is a largefile repo. |
|
786 | 788 | if opts.get('all_largefiles'): |
|
787 | 789 | success, missing = lfcommands.downloadlfiles(ui, repo, None) |
|
788 | 790 | |
|
789 | 791 | if missing != 0: |
|
790 | 792 | return None |
|
791 | 793 | |
|
792 | 794 | return result |
|
793 | 795 | |
|
794 | 796 | def overriderebase(orig, ui, repo, **opts): |
|
795 | 797 | repo._isrebasing = True |
|
796 | 798 | try: |
|
797 | 799 | return orig(ui, repo, **opts) |
|
798 | 800 | finally: |
|
799 | 801 | repo._isrebasing = False |
|
800 | 802 | |
|
801 | 803 | def overridearchive(orig, repo, dest, node, kind, decode=True, matchfn=None, |
|
802 | 804 | prefix=None, mtime=None, subrepos=None): |
|
803 | 805 | # No need to lock because we are only reading history and |
|
804 | 806 | # largefile caches, neither of which are modified. |
|
805 | 807 | lfcommands.cachelfiles(repo.ui, repo, node) |
|
806 | 808 | |
|
807 | 809 | if kind not in archival.archivers: |
|
808 | 810 | raise util.Abort(_("unknown archive type '%s'") % kind) |
|
809 | 811 | |
|
810 | 812 | ctx = repo[node] |
|
811 | 813 | |
|
812 | 814 | if kind == 'files': |
|
813 | 815 | if prefix: |
|
814 | 816 | raise util.Abort( |
|
815 | 817 | _('cannot give prefix when archiving to files')) |
|
816 | 818 | else: |
|
817 | 819 | prefix = archival.tidyprefix(dest, kind, prefix) |
|
818 | 820 | |
|
819 | 821 | def write(name, mode, islink, getdata): |
|
820 | 822 | if matchfn and not matchfn(name): |
|
821 | 823 | return |
|
822 | 824 | data = getdata() |
|
823 | 825 | if decode: |
|
824 | 826 | data = repo.wwritedata(name, data) |
|
825 | 827 | archiver.addfile(prefix + name, mode, islink, data) |
|
826 | 828 | |
|
827 | 829 | archiver = archival.archivers[kind](dest, mtime or ctx.date()[0]) |
|
828 | 830 | |
|
829 | 831 | if repo.ui.configbool("ui", "archivemeta", True): |
|
830 | 832 | def metadata(): |
|
831 | 833 | base = 'repo: %s\nnode: %s\nbranch: %s\n' % ( |
|
832 | 834 | hex(repo.changelog.node(0)), hex(node), ctx.branch()) |
|
833 | 835 | |
|
834 | 836 | tags = ''.join('tag: %s\n' % t for t in ctx.tags() |
|
835 | 837 | if repo.tagtype(t) == 'global') |
|
836 | 838 | if not tags: |
|
837 | 839 | repo.ui.pushbuffer() |
|
838 | 840 | opts = {'template': '{latesttag}\n{latesttagdistance}', |
|
839 | 841 | 'style': '', 'patch': None, 'git': None} |
|
840 | 842 | cmdutil.show_changeset(repo.ui, repo, opts).show(ctx) |
|
841 | 843 | ltags, dist = repo.ui.popbuffer().split('\n') |
|
842 | 844 | tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':')) |
|
843 | 845 | tags += 'latesttagdistance: %s\n' % dist |
|
844 | 846 | |
|
845 | 847 | return base + tags |
|
846 | 848 | |
|
847 | 849 | write('.hg_archival.txt', 0644, False, metadata) |
|
848 | 850 | |
|
849 | 851 | for f in ctx: |
|
850 | 852 | ff = ctx.flags(f) |
|
851 | 853 | getdata = ctx[f].data |
|
852 | 854 | if lfutil.isstandin(f): |
|
853 | 855 | path = lfutil.findfile(repo, getdata().strip()) |
|
854 | 856 | if path is None: |
|
855 | 857 | raise util.Abort( |
|
856 | 858 | _('largefile %s not found in repo store or system cache') |
|
857 | 859 | % lfutil.splitstandin(f)) |
|
858 | 860 | f = lfutil.splitstandin(f) |
|
859 | 861 | |
|
860 | 862 | def getdatafn(): |
|
861 | 863 | fd = None |
|
862 | 864 | try: |
|
863 | 865 | fd = open(path, 'rb') |
|
864 | 866 | return fd.read() |
|
865 | 867 | finally: |
|
866 | 868 | if fd: |
|
867 | 869 | fd.close() |
|
868 | 870 | |
|
869 | 871 | getdata = getdatafn |
|
870 | 872 | write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata) |
|
871 | 873 | |
|
872 | 874 | if subrepos: |
|
873 | 875 | for subpath in sorted(ctx.substate): |
|
874 | 876 | sub = ctx.sub(subpath) |
|
875 | 877 | submatch = match_.narrowmatcher(subpath, matchfn) |
|
876 | 878 | sub.archive(repo.ui, archiver, prefix, submatch) |
|
877 | 879 | |
|
878 | 880 | archiver.done() |
|
879 | 881 | |
|
880 | 882 | def hgsubrepoarchive(orig, repo, ui, archiver, prefix, match=None): |
|
881 | 883 | repo._get(repo._state + ('hg',)) |
|
882 | 884 | rev = repo._state[1] |
|
883 | 885 | ctx = repo._repo[rev] |
|
884 | 886 | |
|
885 | 887 | lfcommands.cachelfiles(ui, repo._repo, ctx.node()) |
|
886 | 888 | |
|
887 | 889 | def write(name, mode, islink, getdata): |
|
888 | 890 | # At this point, the standin has been replaced with the largefile name, |
|
889 | 891 | # so the normal matcher works here without the lfutil variants. |
|
890 | 892 | if match and not match(f): |
|
891 | 893 | return |
|
892 | 894 | data = getdata() |
|
893 | 895 | |
|
894 | 896 | archiver.addfile(prefix + repo._path + '/' + name, mode, islink, data) |
|
895 | 897 | |
|
896 | 898 | for f in ctx: |
|
897 | 899 | ff = ctx.flags(f) |
|
898 | 900 | getdata = ctx[f].data |
|
899 | 901 | if lfutil.isstandin(f): |
|
900 | 902 | path = lfutil.findfile(repo._repo, getdata().strip()) |
|
901 | 903 | if path is None: |
|
902 | 904 | raise util.Abort( |
|
903 | 905 | _('largefile %s not found in repo store or system cache') |
|
904 | 906 | % lfutil.splitstandin(f)) |
|
905 | 907 | f = lfutil.splitstandin(f) |
|
906 | 908 | |
|
907 | 909 | def getdatafn(): |
|
908 | 910 | fd = None |
|
909 | 911 | try: |
|
910 | 912 | fd = open(os.path.join(prefix, path), 'rb') |
|
911 | 913 | return fd.read() |
|
912 | 914 | finally: |
|
913 | 915 | if fd: |
|
914 | 916 | fd.close() |
|
915 | 917 | |
|
916 | 918 | getdata = getdatafn |
|
917 | 919 | |
|
918 | 920 | write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata) |
|
919 | 921 | |
|
920 | 922 | for subpath in sorted(ctx.substate): |
|
921 | 923 | sub = ctx.sub(subpath) |
|
922 | 924 | submatch = match_.narrowmatcher(subpath, match) |
|
923 | 925 | sub.archive(ui, archiver, os.path.join(prefix, repo._path) + '/', |
|
924 | 926 | submatch) |
|
925 | 927 | |
|
926 | 928 | # If a largefile is modified, the change is not reflected in its |
|
927 | 929 | # standin until a commit. cmdutil.bailifchanged() raises an exception |
|
928 | 930 | # if the repo has uncommitted changes. Wrap it to also check if |
|
929 | 931 | # largefiles were changed. This is used by bisect and backout. |
|
930 | 932 | def overridebailifchanged(orig, repo): |
|
931 | 933 | orig(repo) |
|
932 | 934 | repo.lfstatus = True |
|
933 | 935 | modified, added, removed, deleted = repo.status()[:4] |
|
934 | 936 | repo.lfstatus = False |
|
935 | 937 | if modified or added or removed or deleted: |
|
936 | 938 | raise util.Abort(_('uncommitted changes')) |
|
937 | 939 | |
|
938 | 940 | # Fetch doesn't use cmdutil.bailifchanged so override it to add the check |
|
939 | 941 | def overridefetch(orig, ui, repo, *pats, **opts): |
|
940 | 942 | repo.lfstatus = True |
|
941 | 943 | modified, added, removed, deleted = repo.status()[:4] |
|
942 | 944 | repo.lfstatus = False |
|
943 | 945 | if modified or added or removed or deleted: |
|
944 | 946 | raise util.Abort(_('uncommitted changes')) |
|
945 | 947 | return orig(ui, repo, *pats, **opts) |
|
946 | 948 | |
|
947 | 949 | def overrideforget(orig, ui, repo, *pats, **opts): |
|
948 | 950 | installnormalfilesmatchfn(repo[None].manifest()) |
|
949 | 951 | result = orig(ui, repo, *pats, **opts) |
|
950 | 952 | restorematchfn() |
|
951 | 953 | m = scmutil.match(repo[None], pats, opts) |
|
952 | 954 | |
|
953 | 955 | try: |
|
954 | 956 | repo.lfstatus = True |
|
955 | 957 | s = repo.status(match=m, clean=True) |
|
956 | 958 | finally: |
|
957 | 959 | repo.lfstatus = False |
|
958 | 960 | forget = sorted(s[0] + s[1] + s[3] + s[6]) |
|
959 | 961 | forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()] |
|
960 | 962 | |
|
961 | 963 | for f in forget: |
|
962 | 964 | if lfutil.standin(f) not in repo.dirstate and not \ |
|
963 | 965 | os.path.isdir(m.rel(lfutil.standin(f))): |
|
964 | 966 | ui.warn(_('not removing %s: file is already untracked\n') |
|
965 | 967 | % m.rel(f)) |
|
966 | 968 | result = 1 |
|
967 | 969 | |
|
968 | 970 | for f in forget: |
|
969 | 971 | if ui.verbose or not m.exact(f): |
|
970 | 972 | ui.status(_('removing %s\n') % m.rel(f)) |
|
971 | 973 | |
|
972 | 974 | # Need to lock because standin files are deleted then removed from the |
|
973 | 975 | # repository and we could race in-between. |
|
974 | 976 | wlock = repo.wlock() |
|
975 | 977 | try: |
|
976 | 978 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
977 | 979 | for f in forget: |
|
978 | 980 | if lfdirstate[f] == 'a': |
|
979 | 981 | lfdirstate.drop(f) |
|
980 | 982 | else: |
|
981 | 983 | lfdirstate.remove(f) |
|
982 | 984 | lfdirstate.write() |
|
983 | 985 | standins = [lfutil.standin(f) for f in forget] |
|
984 | 986 | for f in standins: |
|
985 | 987 | util.unlinkpath(repo.wjoin(f), ignoremissing=True) |
|
986 | 988 | repo[None].forget(standins) |
|
987 | 989 | finally: |
|
988 | 990 | wlock.release() |
|
989 | 991 | |
|
990 | 992 | return result |
|
991 | 993 | |
|
992 | 994 | def outgoinghook(ui, repo, other, opts, missing): |
|
993 | 995 | if opts.pop('large', None): |
|
994 | 996 | toupload = set() |
|
995 | 997 | lfutil.getlfilestoupload(repo, missing, |
|
996 | 998 | lambda fn, lfhash: toupload.add(fn)) |
|
997 | 999 | if not toupload: |
|
998 | 1000 | ui.status(_('largefiles: no files to upload\n')) |
|
999 | 1001 | else: |
|
1000 | 1002 | ui.status(_('largefiles to upload:\n')) |
|
1001 | 1003 | for file in sorted(toupload): |
|
1002 | 1004 | ui.status(lfutil.splitstandin(file) + '\n') |
|
1003 | 1005 | ui.status('\n') |
|
1004 | 1006 | |
|
1005 | 1007 | def summaryremotehook(ui, repo, opts, changes): |
|
1006 | 1008 | largeopt = opts.get('large', False) |
|
1007 | 1009 | if changes is None: |
|
1008 | 1010 | if largeopt: |
|
1009 | 1011 | return (False, True) # only outgoing check is needed |
|
1010 | 1012 | else: |
|
1011 | 1013 | return (False, False) |
|
1012 | 1014 | elif largeopt: |
|
1013 | 1015 | url, branch, peer, outgoing = changes[1] |
|
1014 | 1016 | if peer is None: |
|
1015 | 1017 | # i18n: column positioning for "hg summary" |
|
1016 | 1018 | ui.status(_('largefiles: (no remote repo)\n')) |
|
1017 | 1019 | return |
|
1018 | 1020 | |
|
1019 | 1021 | toupload = set() |
|
1020 | 1022 | lfutil.getlfilestoupload(repo, outgoing.missing, |
|
1021 | 1023 | lambda fn, lfhash: toupload.add(fn)) |
|
1022 | 1024 | if not toupload: |
|
1023 | 1025 | # i18n: column positioning for "hg summary" |
|
1024 | 1026 | ui.status(_('largefiles: (no files to upload)\n')) |
|
1025 | 1027 | else: |
|
1026 | 1028 | # i18n: column positioning for "hg summary" |
|
1027 | 1029 | ui.status(_('largefiles: %d to upload\n') % len(toupload)) |
|
1028 | 1030 | |
|
1029 | 1031 | def overridesummary(orig, ui, repo, *pats, **opts): |
|
1030 | 1032 | try: |
|
1031 | 1033 | repo.lfstatus = True |
|
1032 | 1034 | orig(ui, repo, *pats, **opts) |
|
1033 | 1035 | finally: |
|
1034 | 1036 | repo.lfstatus = False |
|
1035 | 1037 | |
|
1036 | 1038 | def scmutiladdremove(orig, repo, pats=[], opts={}, dry_run=None, |
|
1037 | 1039 | similarity=None): |
|
1038 | 1040 | if not lfutil.islfilesrepo(repo): |
|
1039 | 1041 | return orig(repo, pats, opts, dry_run, similarity) |
|
1040 | 1042 | # Get the list of missing largefiles so we can remove them |
|
1041 | 1043 | lfdirstate = lfutil.openlfdirstate(repo.ui, repo) |
|
1042 | 1044 | s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [], False, |
|
1043 | 1045 | False, False) |
|
1044 | 1046 | (unsure, modified, added, removed, missing, unknown, ignored, clean) = s |
|
1045 | 1047 | |
|
1046 | 1048 | # Call into the normal remove code, but the removing of the standin, we want |
|
1047 | 1049 | # to have handled by original addremove. Monkey patching here makes sure |
|
1048 | 1050 | # we don't remove the standin in the largefiles code, preventing a very |
|
1049 | 1051 | # confused state later. |
|
1050 | 1052 | if missing: |
|
1051 | 1053 | m = [repo.wjoin(f) for f in missing] |
|
1052 | 1054 | repo._isaddremove = True |
|
1053 | 1055 | removelargefiles(repo.ui, repo, *m, **opts) |
|
1054 | 1056 | repo._isaddremove = False |
|
1055 | 1057 | # Call into the normal add code, and any files that *should* be added as |
|
1056 | 1058 | # largefiles will be |
|
1057 | 1059 | addlargefiles(repo.ui, repo, *pats, **opts) |
|
1058 | 1060 | # Now that we've handled largefiles, hand off to the original addremove |
|
1059 | 1061 | # function to take care of the rest. Make sure it doesn't do anything with |
|
1060 | 1062 | # largefiles by installing a matcher that will ignore them. |
|
1061 | 1063 | installnormalfilesmatchfn(repo[None].manifest()) |
|
1062 | 1064 | result = orig(repo, pats, opts, dry_run, similarity) |
|
1063 | 1065 | restorematchfn() |
|
1064 | 1066 | return result |
|
1065 | 1067 | |
|
1066 | 1068 | # Calling purge with --all will cause the largefiles to be deleted. |
|
1067 | 1069 | # Override repo.status to prevent this from happening. |
|
1068 | 1070 | def overridepurge(orig, ui, repo, *dirs, **opts): |
|
1069 | 1071 | # XXX large file status is buggy when used on repo proxy. |
|
1070 | 1072 | # XXX this needs to be investigate. |
|
1071 | 1073 | repo = repo.unfiltered() |
|
1072 | 1074 | oldstatus = repo.status |
|
1073 | 1075 | def overridestatus(node1='.', node2=None, match=None, ignored=False, |
|
1074 | 1076 | clean=False, unknown=False, listsubrepos=False): |
|
1075 | 1077 | r = oldstatus(node1, node2, match, ignored, clean, unknown, |
|
1076 | 1078 | listsubrepos) |
|
1077 | 1079 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
1078 | 1080 | modified, added, removed, deleted, unknown, ignored, clean = r |
|
1079 | 1081 | unknown = [f for f in unknown if lfdirstate[f] == '?'] |
|
1080 | 1082 | ignored = [f for f in ignored if lfdirstate[f] == '?'] |
|
1081 | 1083 | return modified, added, removed, deleted, unknown, ignored, clean |
|
1082 | 1084 | repo.status = overridestatus |
|
1083 | 1085 | orig(ui, repo, *dirs, **opts) |
|
1084 | 1086 | repo.status = oldstatus |
|
1085 | 1087 | |
|
1086 | 1088 | def overriderollback(orig, ui, repo, **opts): |
|
1087 | 1089 | result = orig(ui, repo, **opts) |
|
1088 | 1090 | merge.update(repo, node=None, branchmerge=False, force=True, |
|
1089 | 1091 | partial=lfutil.isstandin) |
|
1090 | 1092 | wlock = repo.wlock() |
|
1091 | 1093 | try: |
|
1092 | 1094 | lfdirstate = lfutil.openlfdirstate(ui, repo) |
|
1093 | 1095 | lfiles = lfutil.listlfiles(repo) |
|
1094 | 1096 | oldlfiles = lfutil.listlfiles(repo, repo[None].parents()[0].rev()) |
|
1095 | 1097 | for file in lfiles: |
|
1096 | 1098 | if file in oldlfiles: |
|
1097 | 1099 | lfdirstate.normallookup(file) |
|
1098 | 1100 | else: |
|
1099 | 1101 | lfdirstate.add(file) |
|
1100 | 1102 | lfdirstate.write() |
|
1101 | 1103 | finally: |
|
1102 | 1104 | wlock.release() |
|
1103 | 1105 | return result |
|
1104 | 1106 | |
|
1105 | 1107 | def overridetransplant(orig, ui, repo, *revs, **opts): |
|
1106 | 1108 | try: |
|
1107 | 1109 | oldstandins = lfutil.getstandinsstate(repo) |
|
1108 | 1110 | repo._istransplanting = True |
|
1109 | 1111 | result = orig(ui, repo, *revs, **opts) |
|
1110 | 1112 | newstandins = lfutil.getstandinsstate(repo) |
|
1111 | 1113 | filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) |
|
1112 | 1114 | lfcommands.updatelfiles(repo.ui, repo, filelist=filelist, |
|
1113 | 1115 | printmessage=True) |
|
1114 | 1116 | finally: |
|
1115 | 1117 | repo._istransplanting = False |
|
1116 | 1118 | return result |
|
1117 | 1119 | |
|
1118 | 1120 | def overridecat(orig, ui, repo, file1, *pats, **opts): |
|
1119 | 1121 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
1120 | 1122 | err = 1 |
|
1121 | 1123 | notbad = set() |
|
1122 | 1124 | m = scmutil.match(ctx, (file1,) + pats, opts) |
|
1123 | 1125 | origmatchfn = m.matchfn |
|
1124 | 1126 | def lfmatchfn(f): |
|
1125 | 1127 | if origmatchfn(f): |
|
1126 | 1128 | return True |
|
1127 | 1129 | lf = lfutil.splitstandin(f) |
|
1128 | 1130 | if lf is None: |
|
1129 | 1131 | return False |
|
1130 | 1132 | notbad.add(lf) |
|
1131 | 1133 | return origmatchfn(lf) |
|
1132 | 1134 | m.matchfn = lfmatchfn |
|
1133 | 1135 | origbadfn = m.bad |
|
1134 | 1136 | def lfbadfn(f, msg): |
|
1135 | 1137 | if not f in notbad: |
|
1136 | 1138 | origbadfn(f, msg) |
|
1137 | 1139 | m.bad = lfbadfn |
|
1138 | 1140 | for f in ctx.walk(m): |
|
1139 | 1141 | fp = cmdutil.makefileobj(repo, opts.get('output'), ctx.node(), |
|
1140 | 1142 | pathname=f) |
|
1141 | 1143 | lf = lfutil.splitstandin(f) |
|
1142 | 1144 | if lf is None or origmatchfn(f): |
|
1143 | 1145 | # duplicating unreachable code from commands.cat |
|
1144 | 1146 | data = ctx[f].data() |
|
1145 | 1147 | if opts.get('decode'): |
|
1146 | 1148 | data = repo.wwritedata(f, data) |
|
1147 | 1149 | fp.write(data) |
|
1148 | 1150 | else: |
|
1149 | 1151 | hash = lfutil.readstandin(repo, lf, ctx.rev()) |
|
1150 | 1152 | if not lfutil.inusercache(repo.ui, hash): |
|
1151 | 1153 | store = basestore._openstore(repo) |
|
1152 | 1154 | success, missing = store.get([(lf, hash)]) |
|
1153 | 1155 | if len(success) != 1: |
|
1154 | 1156 | raise util.Abort( |
|
1155 | 1157 | _('largefile %s is not in cache and could not be ' |
|
1156 | 1158 | 'downloaded') % lf) |
|
1157 | 1159 | path = lfutil.usercachepath(repo.ui, hash) |
|
1158 | 1160 | fpin = open(path, "rb") |
|
1159 | 1161 | for chunk in util.filechunkiter(fpin, 128 * 1024): |
|
1160 | 1162 | fp.write(chunk) |
|
1161 | 1163 | fpin.close() |
|
1162 | 1164 | fp.close() |
|
1163 | 1165 | err = 0 |
|
1164 | 1166 | return err |
|
1165 | 1167 | |
|
1166 | 1168 | def mercurialsinkbefore(orig, sink): |
|
1167 | 1169 | sink.repo._isconverting = True |
|
1168 | 1170 | orig(sink) |
|
1169 | 1171 | |
|
1170 | 1172 | def mercurialsinkafter(orig, sink): |
|
1171 | 1173 | sink.repo._isconverting = False |
|
1172 | 1174 | orig(sink) |
@@ -1,2537 +1,2545 b'' | |||
|
1 | 1 | $ USERCACHE="$TESTTMP/cache"; export USERCACHE |
|
2 | 2 | $ mkdir "${USERCACHE}" |
|
3 | 3 | $ cat >> $HGRCPATH <<EOF |
|
4 | 4 | > [extensions] |
|
5 | 5 | > largefiles= |
|
6 | 6 | > purge= |
|
7 | 7 | > rebase= |
|
8 | 8 | > transplant= |
|
9 | 9 | > [phases] |
|
10 | 10 | > publish=False |
|
11 | 11 | > [largefiles] |
|
12 | 12 | > minsize=2 |
|
13 | 13 | > patterns=glob:**.dat |
|
14 | 14 | > usercache=${USERCACHE} |
|
15 | 15 | > [hooks] |
|
16 | 16 | > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status" |
|
17 | 17 | > EOF |
|
18 | 18 | |
|
19 | 19 | Create the repo with a couple of revisions of both large and normal |
|
20 | 20 | files. |
|
21 | 21 | Test status and dirstate of largefiles and that summary output is correct. |
|
22 | 22 | |
|
23 | 23 | $ hg init a |
|
24 | 24 | $ cd a |
|
25 | 25 | $ mkdir sub |
|
26 | 26 | $ echo normal1 > normal1 |
|
27 | 27 | $ echo normal2 > sub/normal2 |
|
28 | 28 | $ echo large1 > large1 |
|
29 | 29 | $ echo large2 > sub/large2 |
|
30 | 30 | $ hg add normal1 sub/normal2 |
|
31 | 31 | $ hg add --large large1 sub/large2 |
|
32 | 32 | $ hg commit -m "add files" |
|
33 | 33 | Invoking status precommit hook |
|
34 | 34 | A large1 |
|
35 | 35 | A normal1 |
|
36 | 36 | A sub/large2 |
|
37 | 37 | A sub/normal2 |
|
38 | 38 | $ touch large1 sub/large2 |
|
39 | 39 | $ sleep 1 |
|
40 | 40 | $ hg st |
|
41 | 41 | $ hg debugstate --nodates |
|
42 | 42 | n 644 41 .hglf/large1 |
|
43 | 43 | n 644 41 .hglf/sub/large2 |
|
44 | 44 | n 644 8 normal1 |
|
45 | 45 | n 644 8 sub/normal2 |
|
46 | 46 | $ hg debugstate --large --nodates |
|
47 | 47 | n 644 7 large1 |
|
48 | 48 | n 644 7 sub/large2 |
|
49 | 49 | $ echo normal11 > normal1 |
|
50 | 50 | $ echo normal22 > sub/normal2 |
|
51 | 51 | $ echo large11 > large1 |
|
52 | 52 | $ echo large22 > sub/large2 |
|
53 | 53 | $ hg commit -m "edit files" |
|
54 | 54 | Invoking status precommit hook |
|
55 | 55 | M large1 |
|
56 | 56 | M normal1 |
|
57 | 57 | M sub/large2 |
|
58 | 58 | M sub/normal2 |
|
59 | 59 | $ hg sum --large |
|
60 | 60 | parent: 1:ce8896473775 tip |
|
61 | 61 | edit files |
|
62 | 62 | branch: default |
|
63 | 63 | commit: (clean) |
|
64 | 64 | update: (current) |
|
65 | 65 | largefiles: (no remote repo) |
|
66 | 66 | |
|
67 | 67 | Commit preserved largefile contents. |
|
68 | 68 | |
|
69 | 69 | $ cat normal1 |
|
70 | 70 | normal11 |
|
71 | 71 | $ cat large1 |
|
72 | 72 | large11 |
|
73 | 73 | $ cat sub/normal2 |
|
74 | 74 | normal22 |
|
75 | 75 | $ cat sub/large2 |
|
76 | 76 | large22 |
|
77 | 77 | |
|
78 | 78 | Test status, subdir and unknown files |
|
79 | 79 | |
|
80 | 80 | $ echo unknown > sub/unknown |
|
81 | 81 | $ hg st --all |
|
82 | 82 | ? sub/unknown |
|
83 | 83 | C large1 |
|
84 | 84 | C normal1 |
|
85 | 85 | C sub/large2 |
|
86 | 86 | C sub/normal2 |
|
87 | 87 | $ hg st --all sub |
|
88 | 88 | ? sub/unknown |
|
89 | 89 | C sub/large2 |
|
90 | 90 | C sub/normal2 |
|
91 | 91 | $ rm sub/unknown |
|
92 | 92 | |
|
93 | 93 | Test messages and exit codes for remove warning cases |
|
94 | 94 | |
|
95 | 95 | $ hg remove -A large1 |
|
96 | 96 | not removing large1: file still exists |
|
97 | 97 | [1] |
|
98 | 98 | $ echo 'modified' > large1 |
|
99 | 99 | $ hg remove large1 |
|
100 | 100 | not removing large1: file is modified (use -f to force removal) |
|
101 | 101 | [1] |
|
102 | 102 | $ echo 'new' > normalnew |
|
103 | 103 | $ hg add normalnew |
|
104 | 104 | $ echo 'new' > largenew |
|
105 | 105 | $ hg add --large normalnew |
|
106 | 106 | normalnew already tracked! |
|
107 | 107 | $ hg remove normalnew largenew |
|
108 | 108 | not removing largenew: file is untracked |
|
109 | 109 | not removing normalnew: file has been marked for add (use forget to undo) |
|
110 | 110 | [1] |
|
111 | 111 | $ rm normalnew largenew |
|
112 | 112 | $ hg up -Cq |
|
113 | 113 | |
|
114 | 114 | Remove both largefiles and normal files. |
|
115 | 115 | |
|
116 | 116 | $ hg remove normal1 large1 |
|
117 | 117 | $ hg status large1 |
|
118 | 118 | R large1 |
|
119 | 119 | $ hg commit -m "remove files" |
|
120 | 120 | Invoking status precommit hook |
|
121 | 121 | R large1 |
|
122 | 122 | R normal1 |
|
123 | 123 | $ ls |
|
124 | 124 | sub |
|
125 | 125 | $ echo "testlargefile" > large1-test |
|
126 | 126 | $ hg add --large large1-test |
|
127 | 127 | $ hg st |
|
128 | 128 | A large1-test |
|
129 | 129 | $ hg rm large1-test |
|
130 | 130 | not removing large1-test: file has been marked for add (use forget to undo) |
|
131 | 131 | [1] |
|
132 | 132 | $ hg st |
|
133 | 133 | A large1-test |
|
134 | 134 | $ hg forget large1-test |
|
135 | 135 | $ hg st |
|
136 | 136 | ? large1-test |
|
137 | 137 | $ hg remove large1-test |
|
138 | 138 | not removing large1-test: file is untracked |
|
139 | 139 | [1] |
|
140 | 140 | $ hg forget large1-test |
|
141 | 141 | not removing large1-test: file is already untracked |
|
142 | 142 | [1] |
|
143 | 143 | $ rm large1-test |
|
144 | 144 | |
|
145 | 145 | Copy both largefiles and normal files (testing that status output is correct). |
|
146 | 146 | |
|
147 | 147 | $ hg cp sub/normal2 normal1 |
|
148 | 148 | $ hg cp sub/large2 large1 |
|
149 | 149 | $ hg commit -m "copy files" |
|
150 | 150 | Invoking status precommit hook |
|
151 | 151 | A large1 |
|
152 | 152 | A normal1 |
|
153 | 153 | $ cat normal1 |
|
154 | 154 | normal22 |
|
155 | 155 | $ cat large1 |
|
156 | 156 | large22 |
|
157 | 157 | |
|
158 | 158 | Test moving largefiles and verify that normal files are also unaffected. |
|
159 | 159 | |
|
160 | 160 | $ hg mv normal1 normal3 |
|
161 | 161 | $ hg mv large1 large3 |
|
162 | 162 | $ hg mv sub/normal2 sub/normal4 |
|
163 | 163 | $ hg mv sub/large2 sub/large4 |
|
164 | 164 | $ hg commit -m "move files" |
|
165 | 165 | Invoking status precommit hook |
|
166 | 166 | A large3 |
|
167 | 167 | A normal3 |
|
168 | 168 | A sub/large4 |
|
169 | 169 | A sub/normal4 |
|
170 | 170 | R large1 |
|
171 | 171 | R normal1 |
|
172 | 172 | R sub/large2 |
|
173 | 173 | R sub/normal2 |
|
174 | 174 | $ cat normal3 |
|
175 | 175 | normal22 |
|
176 | 176 | $ cat large3 |
|
177 | 177 | large22 |
|
178 | 178 | $ cat sub/normal4 |
|
179 | 179 | normal22 |
|
180 | 180 | $ cat sub/large4 |
|
181 | 181 | large22 |
|
182 | 182 | |
|
183 | 183 | Test copies and moves from a directory other than root (issue3516) |
|
184 | 184 | |
|
185 | 185 | $ cd .. |
|
186 | 186 | $ hg init lf_cpmv |
|
187 | 187 | $ cd lf_cpmv |
|
188 | 188 | $ mkdir dira |
|
189 | 189 | $ mkdir dira/dirb |
|
190 | 190 | $ touch dira/dirb/largefile |
|
191 | 191 | $ hg add --large dira/dirb/largefile |
|
192 | 192 | $ hg commit -m "added" |
|
193 | 193 | Invoking status precommit hook |
|
194 | 194 | A dira/dirb/largefile |
|
195 | 195 | $ cd dira |
|
196 | 196 | $ hg cp dirb/largefile foo/largefile |
|
197 | 197 | $ hg ci -m "deep copy" |
|
198 | 198 | Invoking status precommit hook |
|
199 | 199 | A dira/foo/largefile |
|
200 | 200 | $ find . | sort |
|
201 | 201 | . |
|
202 | 202 | ./dirb |
|
203 | 203 | ./dirb/largefile |
|
204 | 204 | ./foo |
|
205 | 205 | ./foo/largefile |
|
206 | 206 | $ hg mv foo/largefile baz/largefile |
|
207 | 207 | $ hg ci -m "moved" |
|
208 | 208 | Invoking status precommit hook |
|
209 | 209 | A dira/baz/largefile |
|
210 | 210 | R dira/foo/largefile |
|
211 | 211 | $ find . | sort |
|
212 | 212 | . |
|
213 | 213 | ./baz |
|
214 | 214 | ./baz/largefile |
|
215 | 215 | ./dirb |
|
216 | 216 | ./dirb/largefile |
|
217 | 217 | $ cd .. |
|
218 | 218 | $ hg mv dira dirc |
|
219 | 219 | moving .hglf/dira/baz/largefile to .hglf/dirc/baz/largefile (glob) |
|
220 | 220 | moving .hglf/dira/dirb/largefile to .hglf/dirc/dirb/largefile (glob) |
|
221 | 221 | $ find * | sort |
|
222 | 222 | dirc |
|
223 | 223 | dirc/baz |
|
224 | 224 | dirc/baz/largefile |
|
225 | 225 | dirc/dirb |
|
226 | 226 | dirc/dirb/largefile |
|
227 | 227 | $ hg up -qC |
|
228 | 228 | $ cd ../a |
|
229 | 229 | |
|
230 | 230 | #if serve |
|
231 | 231 | Test display of largefiles in hgweb |
|
232 | 232 | |
|
233 | 233 | $ hg serve -d -p $HGPORT --pid-file ../hg.pid |
|
234 | 234 | $ cat ../hg.pid >> $DAEMON_PIDS |
|
235 | 235 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/?style=raw' |
|
236 | 236 | 200 Script output follows |
|
237 | 237 | |
|
238 | 238 | |
|
239 | 239 | drwxr-xr-x sub |
|
240 | 240 | -rw-r--r-- 41 large3 |
|
241 | 241 | -rw-r--r-- 9 normal3 |
|
242 | 242 | |
|
243 | 243 | |
|
244 | 244 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/sub/?style=raw' |
|
245 | 245 | 200 Script output follows |
|
246 | 246 | |
|
247 | 247 | |
|
248 | 248 | -rw-r--r-- 41 large4 |
|
249 | 249 | -rw-r--r-- 9 normal4 |
|
250 | 250 | |
|
251 | 251 | |
|
252 | 252 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
|
253 | 253 | #endif |
|
254 | 254 | |
|
255 | 255 | Test archiving the various revisions. These hit corner cases known with |
|
256 | 256 | archiving. |
|
257 | 257 | |
|
258 | 258 | $ hg archive -r 0 ../archive0 |
|
259 | 259 | $ hg archive -r 1 ../archive1 |
|
260 | 260 | $ hg archive -r 2 ../archive2 |
|
261 | 261 | $ hg archive -r 3 ../archive3 |
|
262 | 262 | $ hg archive -r 4 ../archive4 |
|
263 | 263 | $ cd ../archive0 |
|
264 | 264 | $ cat normal1 |
|
265 | 265 | normal1 |
|
266 | 266 | $ cat large1 |
|
267 | 267 | large1 |
|
268 | 268 | $ cat sub/normal2 |
|
269 | 269 | normal2 |
|
270 | 270 | $ cat sub/large2 |
|
271 | 271 | large2 |
|
272 | 272 | $ cd ../archive1 |
|
273 | 273 | $ cat normal1 |
|
274 | 274 | normal11 |
|
275 | 275 | $ cat large1 |
|
276 | 276 | large11 |
|
277 | 277 | $ cat sub/normal2 |
|
278 | 278 | normal22 |
|
279 | 279 | $ cat sub/large2 |
|
280 | 280 | large22 |
|
281 | 281 | $ cd ../archive2 |
|
282 | 282 | $ ls |
|
283 | 283 | sub |
|
284 | 284 | $ cat sub/normal2 |
|
285 | 285 | normal22 |
|
286 | 286 | $ cat sub/large2 |
|
287 | 287 | large22 |
|
288 | 288 | $ cd ../archive3 |
|
289 | 289 | $ cat normal1 |
|
290 | 290 | normal22 |
|
291 | 291 | $ cat large1 |
|
292 | 292 | large22 |
|
293 | 293 | $ cat sub/normal2 |
|
294 | 294 | normal22 |
|
295 | 295 | $ cat sub/large2 |
|
296 | 296 | large22 |
|
297 | 297 | $ cd ../archive4 |
|
298 | 298 | $ cat normal3 |
|
299 | 299 | normal22 |
|
300 | 300 | $ cat large3 |
|
301 | 301 | large22 |
|
302 | 302 | $ cat sub/normal4 |
|
303 | 303 | normal22 |
|
304 | 304 | $ cat sub/large4 |
|
305 | 305 | large22 |
|
306 | 306 | |
|
307 | 307 | Commit corner case: specify files to commit. |
|
308 | 308 | |
|
309 | 309 | $ cd ../a |
|
310 | 310 | $ echo normal3 > normal3 |
|
311 | 311 | $ echo large3 > large3 |
|
312 | 312 | $ echo normal4 > sub/normal4 |
|
313 | 313 | $ echo large4 > sub/large4 |
|
314 | 314 | $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again" |
|
315 | 315 | Invoking status precommit hook |
|
316 | 316 | M large3 |
|
317 | 317 | M normal3 |
|
318 | 318 | M sub/large4 |
|
319 | 319 | M sub/normal4 |
|
320 | 320 | $ cat normal3 |
|
321 | 321 | normal3 |
|
322 | 322 | $ cat large3 |
|
323 | 323 | large3 |
|
324 | 324 | $ cat sub/normal4 |
|
325 | 325 | normal4 |
|
326 | 326 | $ cat sub/large4 |
|
327 | 327 | large4 |
|
328 | 328 | |
|
329 | 329 | One more commit corner case: commit from a subdirectory. |
|
330 | 330 | |
|
331 | 331 | $ cd ../a |
|
332 | 332 | $ echo normal33 > normal3 |
|
333 | 333 | $ echo large33 > large3 |
|
334 | 334 | $ echo normal44 > sub/normal4 |
|
335 | 335 | $ echo large44 > sub/large4 |
|
336 | 336 | $ cd sub |
|
337 | 337 | $ hg commit -m "edit files yet again" |
|
338 | 338 | Invoking status precommit hook |
|
339 | 339 | M large3 |
|
340 | 340 | M normal3 |
|
341 | 341 | M sub/large4 |
|
342 | 342 | M sub/normal4 |
|
343 | 343 | $ cat ../normal3 |
|
344 | 344 | normal33 |
|
345 | 345 | $ cat ../large3 |
|
346 | 346 | large33 |
|
347 | 347 | $ cat normal4 |
|
348 | 348 | normal44 |
|
349 | 349 | $ cat large4 |
|
350 | 350 | large44 |
|
351 | 351 | |
|
352 | 352 | Committing standins is not allowed. |
|
353 | 353 | |
|
354 | 354 | $ cd .. |
|
355 | 355 | $ echo large3 > large3 |
|
356 | 356 | $ hg commit .hglf/large3 -m "try to commit standin" |
|
357 | 357 | abort: file ".hglf/large3" is a largefile standin |
|
358 | 358 | (commit the largefile itself instead) |
|
359 | 359 | [255] |
|
360 | 360 | |
|
361 | 361 | Corner cases for adding largefiles. |
|
362 | 362 | |
|
363 | 363 | $ echo large5 > large5 |
|
364 | 364 | $ hg add --large large5 |
|
365 | 365 | $ hg add --large large5 |
|
366 | 366 | large5 already a largefile |
|
367 | 367 | $ mkdir sub2 |
|
368 | 368 | $ echo large6 > sub2/large6 |
|
369 | 369 | $ echo large7 > sub2/large7 |
|
370 | 370 | $ hg add --large sub2 |
|
371 | 371 | adding sub2/large6 as a largefile (glob) |
|
372 | 372 | adding sub2/large7 as a largefile (glob) |
|
373 | 373 | $ hg st |
|
374 | 374 | M large3 |
|
375 | 375 | A large5 |
|
376 | 376 | A sub2/large6 |
|
377 | 377 | A sub2/large7 |
|
378 | 378 | |
|
379 | 379 | Committing directories containing only largefiles. |
|
380 | 380 | |
|
381 | 381 | $ mkdir -p z/y/x/m |
|
382 | 382 | $ touch z/y/x/m/large1 |
|
383 | 383 | $ touch z/y/x/large2 |
|
384 | 384 | $ hg add --large z/y/x/m/large1 z/y/x/large2 |
|
385 | 385 | $ hg commit -m "Subdir with directory only containing largefiles" z |
|
386 | 386 | Invoking status precommit hook |
|
387 | 387 | M large3 |
|
388 | 388 | A large5 |
|
389 | 389 | A sub2/large6 |
|
390 | 390 | A sub2/large7 |
|
391 | 391 | A z/y/x/large2 |
|
392 | 392 | A z/y/x/m/large1 |
|
393 | ||
|
394 | (and a bit of log testing) | |
|
395 | ||
|
396 | $ hg log -T '{rev}\n' z/y/x/m/large1 | |
|
397 | 7 | |
|
398 | $ hg log -T '{rev}\n' z/y/x/m # with only a largefile | |
|
399 | 7 | |
|
400 | ||
|
393 | 401 | $ hg rollback --quiet |
|
394 | 402 | $ touch z/y/x/m/normal |
|
395 | 403 | $ hg add z/y/x/m/normal |
|
396 | 404 | $ hg commit -m "Subdir with mixed contents" z |
|
397 | 405 | Invoking status precommit hook |
|
398 | 406 | M large3 |
|
399 | 407 | A large5 |
|
400 | 408 | A sub2/large6 |
|
401 | 409 | A sub2/large7 |
|
402 | 410 | A z/y/x/large2 |
|
403 | 411 | A z/y/x/m/large1 |
|
404 | 412 | A z/y/x/m/normal |
|
405 | 413 | $ hg st |
|
406 | 414 | M large3 |
|
407 | 415 | A large5 |
|
408 | 416 | A sub2/large6 |
|
409 | 417 | A sub2/large7 |
|
410 | 418 | $ hg rollback --quiet |
|
411 | 419 | $ hg revert z/y/x/large2 z/y/x/m/large1 |
|
412 | 420 | $ rm z/y/x/large2 z/y/x/m/large1 |
|
413 | 421 | $ hg commit -m "Subdir with normal contents" z |
|
414 | 422 | Invoking status precommit hook |
|
415 | 423 | M large3 |
|
416 | 424 | A large5 |
|
417 | 425 | A sub2/large6 |
|
418 | 426 | A sub2/large7 |
|
419 | 427 | A z/y/x/m/normal |
|
420 | 428 | $ hg st |
|
421 | 429 | M large3 |
|
422 | 430 | A large5 |
|
423 | 431 | A sub2/large6 |
|
424 | 432 | A sub2/large7 |
|
425 | 433 | $ hg rollback --quiet |
|
426 | 434 | $ hg revert --quiet z |
|
427 | 435 | $ hg commit -m "Empty subdir" z |
|
428 | 436 | abort: z: no match under directory! |
|
429 | 437 | [255] |
|
430 | 438 | $ rm -rf z |
|
431 | 439 | $ hg ci -m "standin" .hglf |
|
432 | 440 | abort: file ".hglf" is a largefile standin |
|
433 | 441 | (commit the largefile itself instead) |
|
434 | 442 | [255] |
|
435 | 443 | |
|
436 | 444 | Test "hg status" with combination of 'file pattern' and 'directory |
|
437 | 445 | pattern' for largefiles: |
|
438 | 446 | |
|
439 | 447 | $ hg status sub2/large6 sub2 |
|
440 | 448 | A sub2/large6 |
|
441 | 449 | A sub2/large7 |
|
442 | 450 | |
|
443 | 451 | Config settings (pattern **.dat, minsize 2 MB) are respected. |
|
444 | 452 | |
|
445 | 453 | $ echo testdata > test.dat |
|
446 | 454 | $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null |
|
447 | 455 | $ hg add |
|
448 | 456 | adding reallylarge as a largefile |
|
449 | 457 | adding test.dat as a largefile |
|
450 | 458 | |
|
451 | 459 | Test that minsize and --lfsize handle float values; |
|
452 | 460 | also tests that --lfsize overrides largefiles.minsize. |
|
453 | 461 | (0.250 MB = 256 kB = 262144 B) |
|
454 | 462 | |
|
455 | 463 | $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null |
|
456 | 464 | $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null |
|
457 | 465 | $ hg --config largefiles.minsize=.25 add |
|
458 | 466 | adding ratherlarge as a largefile |
|
459 | 467 | adding medium |
|
460 | 468 | $ hg forget medium |
|
461 | 469 | $ hg --config largefiles.minsize=.25 add --lfsize=.125 |
|
462 | 470 | adding medium as a largefile |
|
463 | 471 | $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null |
|
464 | 472 | $ hg --config largefiles.minsize=.25 add --lfsize=.125 |
|
465 | 473 | adding notlarge |
|
466 | 474 | $ hg forget notlarge |
|
467 | 475 | |
|
468 | 476 | Test forget on largefiles. |
|
469 | 477 | |
|
470 | 478 | $ hg forget large3 large5 test.dat reallylarge ratherlarge medium |
|
471 | 479 | $ hg commit -m "add/edit more largefiles" |
|
472 | 480 | Invoking status precommit hook |
|
473 | 481 | A sub2/large6 |
|
474 | 482 | A sub2/large7 |
|
475 | 483 | R large3 |
|
476 | 484 | ? large5 |
|
477 | 485 | ? medium |
|
478 | 486 | ? notlarge |
|
479 | 487 | ? ratherlarge |
|
480 | 488 | ? reallylarge |
|
481 | 489 | ? test.dat |
|
482 | 490 | $ hg st |
|
483 | 491 | ? large3 |
|
484 | 492 | ? large5 |
|
485 | 493 | ? medium |
|
486 | 494 | ? notlarge |
|
487 | 495 | ? ratherlarge |
|
488 | 496 | ? reallylarge |
|
489 | 497 | ? test.dat |
|
490 | 498 | |
|
491 | 499 | Purge with largefiles: verify that largefiles are still in the working |
|
492 | 500 | dir after a purge. |
|
493 | 501 | |
|
494 | 502 | $ hg purge --all |
|
495 | 503 | $ cat sub/large4 |
|
496 | 504 | large44 |
|
497 | 505 | $ cat sub2/large6 |
|
498 | 506 | large6 |
|
499 | 507 | $ cat sub2/large7 |
|
500 | 508 | large7 |
|
501 | 509 | |
|
502 | 510 | Test addremove: verify that files that should be added as largefiles are added as |
|
503 | 511 | such and that already-existing largefiles are not added as normal files by |
|
504 | 512 | accident. |
|
505 | 513 | |
|
506 | 514 | $ rm normal3 |
|
507 | 515 | $ rm sub/large4 |
|
508 | 516 | $ echo "testing addremove with patterns" > testaddremove.dat |
|
509 | 517 | $ echo "normaladdremove" > normaladdremove |
|
510 | 518 | $ hg addremove |
|
511 | 519 | removing sub/large4 |
|
512 | 520 | adding testaddremove.dat as a largefile |
|
513 | 521 | removing normal3 |
|
514 | 522 | adding normaladdremove |
|
515 | 523 | |
|
516 | 524 | Test addremove with -R |
|
517 | 525 | |
|
518 | 526 | $ hg up -C |
|
519 | 527 | getting changed largefiles |
|
520 | 528 | 1 largefiles updated, 0 removed |
|
521 | 529 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
522 | 530 | $ rm normal3 |
|
523 | 531 | $ rm sub/large4 |
|
524 | 532 | $ echo "testing addremove with patterns" > testaddremove.dat |
|
525 | 533 | $ echo "normaladdremove" > normaladdremove |
|
526 | 534 | $ cd .. |
|
527 | 535 | $ hg -R a addremove |
|
528 | 536 | removing sub/large4 |
|
529 | 537 | adding a/testaddremove.dat as a largefile (glob) |
|
530 | 538 | removing normal3 |
|
531 | 539 | adding normaladdremove |
|
532 | 540 | $ cd a |
|
533 | 541 | |
|
534 | 542 | Test 3364 |
|
535 | 543 | $ hg clone . ../addrm |
|
536 | 544 | updating to branch default |
|
537 | 545 | getting changed largefiles |
|
538 | 546 | 3 largefiles updated, 0 removed |
|
539 | 547 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
540 | 548 | $ cd ../addrm |
|
541 | 549 | $ cat >> .hg/hgrc <<EOF |
|
542 | 550 | > [hooks] |
|
543 | 551 | > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A" |
|
544 | 552 | > EOF |
|
545 | 553 | $ touch foo |
|
546 | 554 | $ hg add --large foo |
|
547 | 555 | $ hg ci -m "add foo" |
|
548 | 556 | Invoking status precommit hook |
|
549 | 557 | A foo |
|
550 | 558 | Invoking status postcommit hook |
|
551 | 559 | C foo |
|
552 | 560 | C normal3 |
|
553 | 561 | C sub/large4 |
|
554 | 562 | C sub/normal4 |
|
555 | 563 | C sub2/large6 |
|
556 | 564 | C sub2/large7 |
|
557 | 565 | $ rm foo |
|
558 | 566 | $ hg st |
|
559 | 567 | ! foo |
|
560 | 568 | hmm.. no precommit invoked, but there is a postcommit?? |
|
561 | 569 | $ hg ci -m "will not checkin" |
|
562 | 570 | nothing changed |
|
563 | 571 | Invoking status postcommit hook |
|
564 | 572 | ! foo |
|
565 | 573 | C normal3 |
|
566 | 574 | C sub/large4 |
|
567 | 575 | C sub/normal4 |
|
568 | 576 | C sub2/large6 |
|
569 | 577 | C sub2/large7 |
|
570 | 578 | [1] |
|
571 | 579 | $ hg addremove |
|
572 | 580 | removing foo |
|
573 | 581 | $ hg st |
|
574 | 582 | R foo |
|
575 | 583 | $ hg ci -m "used to say nothing changed" |
|
576 | 584 | Invoking status precommit hook |
|
577 | 585 | R foo |
|
578 | 586 | Invoking status postcommit hook |
|
579 | 587 | C normal3 |
|
580 | 588 | C sub/large4 |
|
581 | 589 | C sub/normal4 |
|
582 | 590 | C sub2/large6 |
|
583 | 591 | C sub2/large7 |
|
584 | 592 | $ hg st |
|
585 | 593 | |
|
586 | 594 | Test 3507 (both normal files and largefiles were a problem) |
|
587 | 595 | |
|
588 | 596 | $ touch normal |
|
589 | 597 | $ touch large |
|
590 | 598 | $ hg add normal |
|
591 | 599 | $ hg add --large large |
|
592 | 600 | $ hg ci -m "added" |
|
593 | 601 | Invoking status precommit hook |
|
594 | 602 | A large |
|
595 | 603 | A normal |
|
596 | 604 | Invoking status postcommit hook |
|
597 | 605 | C large |
|
598 | 606 | C normal |
|
599 | 607 | C normal3 |
|
600 | 608 | C sub/large4 |
|
601 | 609 | C sub/normal4 |
|
602 | 610 | C sub2/large6 |
|
603 | 611 | C sub2/large7 |
|
604 | 612 | $ hg remove normal |
|
605 | 613 | $ hg addremove --traceback |
|
606 | 614 | $ hg ci -m "addremoved normal" |
|
607 | 615 | Invoking status precommit hook |
|
608 | 616 | R normal |
|
609 | 617 | Invoking status postcommit hook |
|
610 | 618 | C large |
|
611 | 619 | C normal3 |
|
612 | 620 | C sub/large4 |
|
613 | 621 | C sub/normal4 |
|
614 | 622 | C sub2/large6 |
|
615 | 623 | C sub2/large7 |
|
616 | 624 | $ hg up -C '.^' |
|
617 | 625 | getting changed largefiles |
|
618 | 626 | 0 largefiles updated, 0 removed |
|
619 | 627 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
620 | 628 | $ hg remove large |
|
621 | 629 | $ hg addremove --traceback |
|
622 | 630 | $ hg ci -m "removed large" |
|
623 | 631 | Invoking status precommit hook |
|
624 | 632 | R large |
|
625 | 633 | created new head |
|
626 | 634 | Invoking status postcommit hook |
|
627 | 635 | C normal |
|
628 | 636 | C normal3 |
|
629 | 637 | C sub/large4 |
|
630 | 638 | C sub/normal4 |
|
631 | 639 | C sub2/large6 |
|
632 | 640 | C sub2/large7 |
|
633 | 641 | |
|
634 | 642 | Test commit -A (issue 3542) |
|
635 | 643 | $ echo large8 > large8 |
|
636 | 644 | $ hg add --large large8 |
|
637 | 645 | $ hg ci -Am 'this used to add large8 as normal and commit both' |
|
638 | 646 | Invoking status precommit hook |
|
639 | 647 | A large8 |
|
640 | 648 | Invoking status postcommit hook |
|
641 | 649 | C large8 |
|
642 | 650 | C normal |
|
643 | 651 | C normal3 |
|
644 | 652 | C sub/large4 |
|
645 | 653 | C sub/normal4 |
|
646 | 654 | C sub2/large6 |
|
647 | 655 | C sub2/large7 |
|
648 | 656 | $ rm large8 |
|
649 | 657 | $ hg ci -Am 'this used to not notice the rm' |
|
650 | 658 | removing large8 |
|
651 | 659 | Invoking status precommit hook |
|
652 | 660 | R large8 |
|
653 | 661 | Invoking status postcommit hook |
|
654 | 662 | C normal |
|
655 | 663 | C normal3 |
|
656 | 664 | C sub/large4 |
|
657 | 665 | C sub/normal4 |
|
658 | 666 | C sub2/large6 |
|
659 | 667 | C sub2/large7 |
|
660 | 668 | |
|
661 | 669 | Test that a standin can't be added as a large file |
|
662 | 670 | |
|
663 | 671 | $ touch large |
|
664 | 672 | $ hg add --large large |
|
665 | 673 | $ hg ci -m "add" |
|
666 | 674 | Invoking status precommit hook |
|
667 | 675 | A large |
|
668 | 676 | Invoking status postcommit hook |
|
669 | 677 | C large |
|
670 | 678 | C normal |
|
671 | 679 | C normal3 |
|
672 | 680 | C sub/large4 |
|
673 | 681 | C sub/normal4 |
|
674 | 682 | C sub2/large6 |
|
675 | 683 | C sub2/large7 |
|
676 | 684 | $ hg remove large |
|
677 | 685 | $ touch large |
|
678 | 686 | $ hg addremove --config largefiles.patterns=**large --traceback |
|
679 | 687 | adding large as a largefile |
|
680 | 688 | |
|
681 | 689 | Test that outgoing --large works (with revsets too) |
|
682 | 690 | $ hg outgoing --rev '.^' --large |
|
683 | 691 | comparing with $TESTTMP/a (glob) |
|
684 | 692 | searching for changes |
|
685 | 693 | changeset: 8:c02fd3b77ec4 |
|
686 | 694 | user: test |
|
687 | 695 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
688 | 696 | summary: add foo |
|
689 | 697 | |
|
690 | 698 | changeset: 9:289dd08c9bbb |
|
691 | 699 | user: test |
|
692 | 700 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
693 | 701 | summary: used to say nothing changed |
|
694 | 702 | |
|
695 | 703 | changeset: 10:34f23ac6ac12 |
|
696 | 704 | user: test |
|
697 | 705 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
698 | 706 | summary: added |
|
699 | 707 | |
|
700 | 708 | changeset: 12:710c1b2f523c |
|
701 | 709 | parent: 10:34f23ac6ac12 |
|
702 | 710 | user: test |
|
703 | 711 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
704 | 712 | summary: removed large |
|
705 | 713 | |
|
706 | 714 | changeset: 13:0a3e75774479 |
|
707 | 715 | user: test |
|
708 | 716 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
709 | 717 | summary: this used to add large8 as normal and commit both |
|
710 | 718 | |
|
711 | 719 | changeset: 14:84f3d378175c |
|
712 | 720 | user: test |
|
713 | 721 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
714 | 722 | summary: this used to not notice the rm |
|
715 | 723 | |
|
716 | 724 | largefiles to upload: |
|
717 | 725 | foo |
|
718 | 726 | large |
|
719 | 727 | large8 |
|
720 | 728 | |
|
721 | 729 | $ cd ../a |
|
722 | 730 | |
|
723 | 731 | Clone a largefiles repo. |
|
724 | 732 | |
|
725 | 733 | $ hg clone . ../b |
|
726 | 734 | updating to branch default |
|
727 | 735 | getting changed largefiles |
|
728 | 736 | 3 largefiles updated, 0 removed |
|
729 | 737 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
730 | 738 | $ cd ../b |
|
731 | 739 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
732 | 740 | 7:daea875e9014 add/edit more largefiles |
|
733 | 741 | 6:4355d653f84f edit files yet again |
|
734 | 742 | 5:9d5af5072dbd edit files again |
|
735 | 743 | 4:74c02385b94c move files |
|
736 | 744 | 3:9e8fbc4bce62 copy files |
|
737 | 745 | 2:51a0ae4d5864 remove files |
|
738 | 746 | 1:ce8896473775 edit files |
|
739 | 747 | 0:30d30fe6a5be add files |
|
740 | 748 | $ cat normal3 |
|
741 | 749 | normal33 |
|
742 | 750 | |
|
743 | 751 | Test graph log |
|
744 | 752 | |
|
745 | 753 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' |
|
746 | 754 | @ 7:daea875e9014 add/edit more largefiles |
|
747 | 755 | | |
|
748 | 756 | o 6:4355d653f84f edit files yet again |
|
749 | 757 | | |
|
750 | 758 | o 5:9d5af5072dbd edit files again |
|
751 | 759 | | |
|
752 | 760 | o 4:74c02385b94c move files |
|
753 | 761 | | |
|
754 | 762 | o 3:9e8fbc4bce62 copy files |
|
755 | 763 | | |
|
756 | 764 | o 2:51a0ae4d5864 remove files |
|
757 | 765 | | |
|
758 | 766 | o 1:ce8896473775 edit files |
|
759 | 767 | | |
|
760 | 768 | o 0:30d30fe6a5be add files |
|
761 | 769 | |
|
762 | 770 | $ cat sub/normal4 |
|
763 | 771 | normal44 |
|
764 | 772 | $ cat sub/large4 |
|
765 | 773 | large44 |
|
766 | 774 | $ cat sub2/large6 |
|
767 | 775 | large6 |
|
768 | 776 | $ cat sub2/large7 |
|
769 | 777 | large7 |
|
770 | 778 | $ hg log -qf sub2/large7 |
|
771 | 779 | 7:daea875e9014 |
|
772 | 780 | $ hg log -Gqf sub2/large7 |
|
773 | 781 | @ 7:daea875e9014 |
|
774 | 782 | | |
|
775 | 783 | $ cd .. |
|
776 | 784 | |
|
777 | 785 | Test log from outside repo |
|
778 | 786 | |
|
779 | 787 | $ hg log b/sub -T '{rev}:{node|short} {desc|firstline}\n' |
|
780 | 788 | 6:4355d653f84f edit files yet again |
|
781 | 789 | 5:9d5af5072dbd edit files again |
|
782 | 790 | 4:74c02385b94c move files |
|
783 | 791 | 1:ce8896473775 edit files |
|
784 | 792 | 0:30d30fe6a5be add files |
|
785 | 793 | |
|
786 | 794 | Test clone at revision |
|
787 | 795 | |
|
788 | 796 | $ hg clone a -r 3 c |
|
789 | 797 | adding changesets |
|
790 | 798 | adding manifests |
|
791 | 799 | adding file changes |
|
792 | 800 | added 4 changesets with 10 changes to 4 files |
|
793 | 801 | updating to branch default |
|
794 | 802 | getting changed largefiles |
|
795 | 803 | 2 largefiles updated, 0 removed |
|
796 | 804 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
797 | 805 | $ cd c |
|
798 | 806 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
799 | 807 | 3:9e8fbc4bce62 copy files |
|
800 | 808 | 2:51a0ae4d5864 remove files |
|
801 | 809 | 1:ce8896473775 edit files |
|
802 | 810 | 0:30d30fe6a5be add files |
|
803 | 811 | $ cat normal1 |
|
804 | 812 | normal22 |
|
805 | 813 | $ cat large1 |
|
806 | 814 | large22 |
|
807 | 815 | $ cat sub/normal2 |
|
808 | 816 | normal22 |
|
809 | 817 | $ cat sub/large2 |
|
810 | 818 | large22 |
|
811 | 819 | |
|
812 | 820 | Old revisions of a clone have correct largefiles content (this also |
|
813 | 821 | tests update). |
|
814 | 822 | |
|
815 | 823 | $ hg update -r 1 |
|
816 | 824 | getting changed largefiles |
|
817 | 825 | 1 largefiles updated, 0 removed |
|
818 | 826 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
819 | 827 | $ cat large1 |
|
820 | 828 | large11 |
|
821 | 829 | $ cat sub/large2 |
|
822 | 830 | large22 |
|
823 | 831 | $ cd .. |
|
824 | 832 | |
|
825 | 833 | Test cloning with --all-largefiles flag |
|
826 | 834 | |
|
827 | 835 | $ rm "${USERCACHE}"/* |
|
828 | 836 | $ hg clone --all-largefiles a a-backup |
|
829 | 837 | updating to branch default |
|
830 | 838 | getting changed largefiles |
|
831 | 839 | 3 largefiles updated, 0 removed |
|
832 | 840 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
833 | 841 | 8 additional largefiles cached |
|
834 | 842 | |
|
835 | 843 | $ rm "${USERCACHE}"/* |
|
836 | 844 | $ hg clone --all-largefiles -u 0 a a-clone0 |
|
837 | 845 | updating to branch default |
|
838 | 846 | getting changed largefiles |
|
839 | 847 | 2 largefiles updated, 0 removed |
|
840 | 848 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
841 | 849 | 9 additional largefiles cached |
|
842 | 850 | $ hg -R a-clone0 sum |
|
843 | 851 | parent: 0:30d30fe6a5be |
|
844 | 852 | add files |
|
845 | 853 | branch: default |
|
846 | 854 | commit: (clean) |
|
847 | 855 | update: 7 new changesets (update) |
|
848 | 856 | |
|
849 | 857 | $ rm "${USERCACHE}"/* |
|
850 | 858 | $ hg clone --all-largefiles -u 1 a a-clone1 |
|
851 | 859 | updating to branch default |
|
852 | 860 | getting changed largefiles |
|
853 | 861 | 2 largefiles updated, 0 removed |
|
854 | 862 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
855 | 863 | 8 additional largefiles cached |
|
856 | 864 | $ hg -R a-clone1 verify --large --lfa --lfc |
|
857 | 865 | checking changesets |
|
858 | 866 | checking manifests |
|
859 | 867 | crosschecking files in changesets and manifests |
|
860 | 868 | checking files |
|
861 | 869 | 10 files, 8 changesets, 24 total revisions |
|
862 | 870 | searching 8 changesets for largefiles |
|
863 | 871 | verified contents of 13 revisions of 6 largefiles |
|
864 | 872 | $ hg -R a-clone1 sum |
|
865 | 873 | parent: 1:ce8896473775 |
|
866 | 874 | edit files |
|
867 | 875 | branch: default |
|
868 | 876 | commit: (clean) |
|
869 | 877 | update: 6 new changesets (update) |
|
870 | 878 | |
|
871 | 879 | $ rm "${USERCACHE}"/* |
|
872 | 880 | $ hg clone --all-largefiles -U a a-clone-u |
|
873 | 881 | 11 additional largefiles cached |
|
874 | 882 | $ hg -R a-clone-u sum |
|
875 | 883 | parent: -1:000000000000 (no revision checked out) |
|
876 | 884 | branch: default |
|
877 | 885 | commit: (clean) |
|
878 | 886 | update: 8 new changesets (update) |
|
879 | 887 | |
|
880 | 888 | Show computed destination directory: |
|
881 | 889 | |
|
882 | 890 | $ mkdir xyz |
|
883 | 891 | $ cd xyz |
|
884 | 892 | $ hg clone ../a |
|
885 | 893 | destination directory: a |
|
886 | 894 | updating to branch default |
|
887 | 895 | getting changed largefiles |
|
888 | 896 | 3 largefiles updated, 0 removed |
|
889 | 897 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
890 | 898 | $ cd .. |
|
891 | 899 | |
|
892 | 900 | Clone URL without path: |
|
893 | 901 | |
|
894 | 902 | $ hg clone file:// |
|
895 | 903 | abort: repository / not found! |
|
896 | 904 | [255] |
|
897 | 905 | |
|
898 | 906 | Ensure base clone command argument validation |
|
899 | 907 | |
|
900 | 908 | $ hg clone -U -u 0 a a-clone-failure |
|
901 | 909 | abort: cannot specify both --noupdate and --updaterev |
|
902 | 910 | [255] |
|
903 | 911 | |
|
904 | 912 | $ hg clone --all-largefiles a ssh://localhost/a |
|
905 | 913 | abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a |
|
906 | 914 | [255] |
|
907 | 915 | |
|
908 | 916 | Test pulling with --all-largefiles flag. Also test that the largefiles are |
|
909 | 917 | downloaded from 'default' instead of 'default-push' when no source is specified |
|
910 | 918 | (issue3584) |
|
911 | 919 | |
|
912 | 920 | $ rm -Rf a-backup |
|
913 | 921 | $ hg clone -r 1 a a-backup |
|
914 | 922 | adding changesets |
|
915 | 923 | adding manifests |
|
916 | 924 | adding file changes |
|
917 | 925 | added 2 changesets with 8 changes to 4 files |
|
918 | 926 | updating to branch default |
|
919 | 927 | getting changed largefiles |
|
920 | 928 | 2 largefiles updated, 0 removed |
|
921 | 929 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
922 | 930 | $ rm "${USERCACHE}"/* |
|
923 | 931 | $ cd a-backup |
|
924 | 932 | $ hg pull --all-largefiles --config paths.default-push=bogus/path |
|
925 | 933 | pulling from $TESTTMP/a (glob) |
|
926 | 934 | searching for changes |
|
927 | 935 | adding changesets |
|
928 | 936 | adding manifests |
|
929 | 937 | adding file changes |
|
930 | 938 | added 6 changesets with 16 changes to 8 files |
|
931 | 939 | (run 'hg update' to get a working copy) |
|
932 | 940 | 6 largefiles cached |
|
933 | 941 | |
|
934 | 942 | redo pull with --lfrev and check it pulls largefiles for the right revs |
|
935 | 943 | |
|
936 | 944 | $ hg rollback |
|
937 | 945 | repository tip rolled back to revision 1 (undo pull) |
|
938 | 946 | $ hg pull -v --lfrev 'heads(pulled())+min(pulled())' |
|
939 | 947 | pulling from $TESTTMP/a (glob) |
|
940 | 948 | searching for changes |
|
941 | 949 | all local heads known remotely |
|
942 | 950 | 6 changesets found |
|
943 | 951 | adding changesets |
|
944 | 952 | adding manifests |
|
945 | 953 | adding file changes |
|
946 | 954 | added 6 changesets with 16 changes to 8 files |
|
947 | 955 | calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles |
|
948 | 956 | (run 'hg update' to get a working copy) |
|
949 | 957 | pulling largefiles for revision 7 |
|
950 | 958 | found 971fb41e78fea4f8e0ba5244784239371cb00591 in store |
|
951 | 959 | found 0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 in store |
|
952 | 960 | found bb3151689acb10f0c3125c560d5e63df914bc1af in store |
|
953 | 961 | pulling largefiles for revision 2 |
|
954 | 962 | found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store |
|
955 | 963 | 0 largefiles cached |
|
956 | 964 | |
|
957 | 965 | lfpull |
|
958 | 966 | |
|
959 | 967 | $ hg lfpull -r : --config largefiles.usercache=usercache-lfpull |
|
960 | 968 | 2 largefiles cached |
|
961 | 969 | $ hg lfpull -v -r 4+2 --config largefiles.usercache=usercache-lfpull |
|
962 | 970 | pulling largefiles for revision 4 |
|
963 | 971 | found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store |
|
964 | 972 | found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store |
|
965 | 973 | pulling largefiles for revision 2 |
|
966 | 974 | found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store |
|
967 | 975 | 0 largefiles cached |
|
968 | 976 | |
|
969 | 977 | $ ls usercache-lfpull/* | sort |
|
970 | 978 | usercache-lfpull/1deebade43c8c498a3c8daddac0244dc55d1331d |
|
971 | 979 | usercache-lfpull/4669e532d5b2c093a78eca010077e708a071bb64 |
|
972 | 980 | |
|
973 | 981 | $ cd .. |
|
974 | 982 | |
|
975 | 983 | Rebasing between two repositories does not revert largefiles to old |
|
976 | 984 | revisions (this was a very bad bug that took a lot of work to fix). |
|
977 | 985 | |
|
978 | 986 | $ hg clone a d |
|
979 | 987 | updating to branch default |
|
980 | 988 | getting changed largefiles |
|
981 | 989 | 3 largefiles updated, 0 removed |
|
982 | 990 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
983 | 991 | $ cd b |
|
984 | 992 | $ echo large4-modified > sub/large4 |
|
985 | 993 | $ echo normal3-modified > normal3 |
|
986 | 994 | $ hg commit -m "modify normal file and largefile in repo b" |
|
987 | 995 | Invoking status precommit hook |
|
988 | 996 | M normal3 |
|
989 | 997 | M sub/large4 |
|
990 | 998 | $ cd ../d |
|
991 | 999 | $ echo large6-modified > sub2/large6 |
|
992 | 1000 | $ echo normal4-modified > sub/normal4 |
|
993 | 1001 | $ hg commit -m "modify normal file largefile in repo d" |
|
994 | 1002 | Invoking status precommit hook |
|
995 | 1003 | M sub/normal4 |
|
996 | 1004 | M sub2/large6 |
|
997 | 1005 | $ cd .. |
|
998 | 1006 | $ hg clone d e |
|
999 | 1007 | updating to branch default |
|
1000 | 1008 | getting changed largefiles |
|
1001 | 1009 | 3 largefiles updated, 0 removed |
|
1002 | 1010 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1003 | 1011 | $ cd d |
|
1004 | 1012 | |
|
1005 | 1013 | More rebase testing, but also test that the largefiles are downloaded from |
|
1006 | 1014 | 'default-push' when no source is specified (issue3584). (The largefile from the |
|
1007 | 1015 | pulled revision is however not downloaded but found in the local cache.) |
|
1008 | 1016 | Largefiles are fetched for the new pulled revision, not for existing revisions, |
|
1009 | 1017 | rebased or not. |
|
1010 | 1018 | |
|
1011 | 1019 | $ [ ! -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ] |
|
1012 | 1020 | $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b |
|
1013 | 1021 | pulling from $TESTTMP/b (glob) |
|
1014 | 1022 | searching for changes |
|
1015 | 1023 | adding changesets |
|
1016 | 1024 | adding manifests |
|
1017 | 1025 | adding file changes |
|
1018 | 1026 | added 1 changesets with 2 changes to 2 files (+1 heads) |
|
1019 | 1027 | Invoking status precommit hook |
|
1020 | 1028 | M sub/normal4 |
|
1021 | 1029 | M sub2/large6 |
|
1022 | 1030 | saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob) |
|
1023 | 1031 | 0 largefiles cached |
|
1024 | 1032 | nothing to rebase - working directory parent is also destination |
|
1025 | 1033 | $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ] |
|
1026 | 1034 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
1027 | 1035 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1028 | 1036 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1029 | 1037 | 7:daea875e9014 add/edit more largefiles |
|
1030 | 1038 | 6:4355d653f84f edit files yet again |
|
1031 | 1039 | 5:9d5af5072dbd edit files again |
|
1032 | 1040 | 4:74c02385b94c move files |
|
1033 | 1041 | 3:9e8fbc4bce62 copy files |
|
1034 | 1042 | 2:51a0ae4d5864 remove files |
|
1035 | 1043 | 1:ce8896473775 edit files |
|
1036 | 1044 | 0:30d30fe6a5be add files |
|
1037 | 1045 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' |
|
1038 | 1046 | @ 9:598410d3eb9a modify normal file largefile in repo d |
|
1039 | 1047 | | |
|
1040 | 1048 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1041 | 1049 | | |
|
1042 | 1050 | o 7:daea875e9014 add/edit more largefiles |
|
1043 | 1051 | | |
|
1044 | 1052 | o 6:4355d653f84f edit files yet again |
|
1045 | 1053 | | |
|
1046 | 1054 | o 5:9d5af5072dbd edit files again |
|
1047 | 1055 | | |
|
1048 | 1056 | o 4:74c02385b94c move files |
|
1049 | 1057 | | |
|
1050 | 1058 | o 3:9e8fbc4bce62 copy files |
|
1051 | 1059 | | |
|
1052 | 1060 | o 2:51a0ae4d5864 remove files |
|
1053 | 1061 | | |
|
1054 | 1062 | o 1:ce8896473775 edit files |
|
1055 | 1063 | | |
|
1056 | 1064 | o 0:30d30fe6a5be add files |
|
1057 | 1065 | |
|
1058 | 1066 | $ cat normal3 |
|
1059 | 1067 | normal3-modified |
|
1060 | 1068 | $ cat sub/normal4 |
|
1061 | 1069 | normal4-modified |
|
1062 | 1070 | $ cat sub/large4 |
|
1063 | 1071 | large4-modified |
|
1064 | 1072 | $ cat sub2/large6 |
|
1065 | 1073 | large6-modified |
|
1066 | 1074 | $ cat sub2/large7 |
|
1067 | 1075 | large7 |
|
1068 | 1076 | $ cd ../e |
|
1069 | 1077 | $ hg pull ../b |
|
1070 | 1078 | pulling from ../b |
|
1071 | 1079 | searching for changes |
|
1072 | 1080 | adding changesets |
|
1073 | 1081 | adding manifests |
|
1074 | 1082 | adding file changes |
|
1075 | 1083 | added 1 changesets with 2 changes to 2 files (+1 heads) |
|
1076 | 1084 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
1077 | 1085 | $ hg rebase |
|
1078 | 1086 | Invoking status precommit hook |
|
1079 | 1087 | M sub/normal4 |
|
1080 | 1088 | M sub2/large6 |
|
1081 | 1089 | saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg (glob) |
|
1082 | 1090 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
1083 | 1091 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1084 | 1092 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1085 | 1093 | 7:daea875e9014 add/edit more largefiles |
|
1086 | 1094 | 6:4355d653f84f edit files yet again |
|
1087 | 1095 | 5:9d5af5072dbd edit files again |
|
1088 | 1096 | 4:74c02385b94c move files |
|
1089 | 1097 | 3:9e8fbc4bce62 copy files |
|
1090 | 1098 | 2:51a0ae4d5864 remove files |
|
1091 | 1099 | 1:ce8896473775 edit files |
|
1092 | 1100 | 0:30d30fe6a5be add files |
|
1093 | 1101 | $ cat normal3 |
|
1094 | 1102 | normal3-modified |
|
1095 | 1103 | $ cat sub/normal4 |
|
1096 | 1104 | normal4-modified |
|
1097 | 1105 | $ cat sub/large4 |
|
1098 | 1106 | large4-modified |
|
1099 | 1107 | $ cat sub2/large6 |
|
1100 | 1108 | large6-modified |
|
1101 | 1109 | $ cat sub2/large7 |
|
1102 | 1110 | large7 |
|
1103 | 1111 | |
|
1104 | 1112 | Log on largefiles |
|
1105 | 1113 | |
|
1106 | 1114 | - same output |
|
1107 | 1115 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4 |
|
1108 | 1116 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1109 | 1117 | 6:4355d653f84f edit files yet again |
|
1110 | 1118 | 5:9d5af5072dbd edit files again |
|
1111 | 1119 | 4:74c02385b94c move files |
|
1112 | 1120 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4 |
|
1113 | 1121 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1114 | 1122 | | |
|
1115 | 1123 | o 6:4355d653f84f edit files yet again |
|
1116 | 1124 | | |
|
1117 | 1125 | o 5:9d5af5072dbd edit files again |
|
1118 | 1126 | | |
|
1119 | 1127 | o 4:74c02385b94c move files |
|
1120 | 1128 | | |
|
1121 | 1129 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub/large4 |
|
1122 | 1130 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1123 | 1131 | 6:4355d653f84f edit files yet again |
|
1124 | 1132 | 5:9d5af5072dbd edit files again |
|
1125 | 1133 | 4:74c02385b94c move files |
|
1126 | 1134 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4 |
|
1127 | 1135 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1128 | 1136 | | |
|
1129 | 1137 | o 6:4355d653f84f edit files yet again |
|
1130 | 1138 | | |
|
1131 | 1139 | o 5:9d5af5072dbd edit files again |
|
1132 | 1140 | | |
|
1133 | 1141 | o 4:74c02385b94c move files |
|
1134 | 1142 | | |
|
1135 | 1143 | |
|
1136 | 1144 | - .hglf only matches largefiles, without .hglf it matches 9 bco sub/normal |
|
1137 | 1145 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub |
|
1138 | 1146 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1139 | 1147 | 6:4355d653f84f edit files yet again |
|
1140 | 1148 | 5:9d5af5072dbd edit files again |
|
1141 | 1149 | 4:74c02385b94c move files |
|
1142 | 1150 | 1:ce8896473775 edit files |
|
1143 | 1151 | 0:30d30fe6a5be add files |
|
1144 | 1152 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub |
|
1145 | 1153 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1146 | 1154 | | |
|
1147 | 1155 | o 6:4355d653f84f edit files yet again |
|
1148 | 1156 | | |
|
1149 | 1157 | o 5:9d5af5072dbd edit files again |
|
1150 | 1158 | | |
|
1151 | 1159 | o 4:74c02385b94c move files |
|
1152 | 1160 | | |
|
1153 | 1161 | o 1:ce8896473775 edit files |
|
1154 | 1162 | | |
|
1155 | 1163 | o 0:30d30fe6a5be add files |
|
1156 | 1164 | |
|
1157 | 1165 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub |
|
1158 | 1166 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1159 | 1167 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1160 | 1168 | 6:4355d653f84f edit files yet again |
|
1161 | 1169 | 5:9d5af5072dbd edit files again |
|
1162 | 1170 | 4:74c02385b94c move files |
|
1163 | 1171 | 1:ce8896473775 edit files |
|
1164 | 1172 | 0:30d30fe6a5be add files |
|
1165 | 1173 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' sub |
|
1166 | 1174 | @ 9:598410d3eb9a modify normal file largefile in repo d |
|
1167 | 1175 | | |
|
1168 | 1176 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1169 | 1177 | | |
|
1170 | 1178 | o 6:4355d653f84f edit files yet again |
|
1171 | 1179 | | |
|
1172 | 1180 | o 5:9d5af5072dbd edit files again |
|
1173 | 1181 | | |
|
1174 | 1182 | o 4:74c02385b94c move files |
|
1175 | 1183 | | |
|
1176 | 1184 | o 1:ce8896473775 edit files |
|
1177 | 1185 | | |
|
1178 | 1186 | o 0:30d30fe6a5be add files |
|
1179 | 1187 | |
|
1180 | 1188 | - globbing gives same result |
|
1181 | 1189 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*' |
|
1182 | 1190 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1183 | 1191 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1184 | 1192 | 6:4355d653f84f edit files yet again |
|
1185 | 1193 | 5:9d5af5072dbd edit files again |
|
1186 | 1194 | 4:74c02385b94c move files |
|
1187 | 1195 | 1:ce8896473775 edit files |
|
1188 | 1196 | 0:30d30fe6a5be add files |
|
1189 | 1197 | $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*' |
|
1190 | 1198 | @ 9:598410d3eb9a modify normal file largefile in repo d |
|
1191 | 1199 | | |
|
1192 | 1200 | o 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1193 | 1201 | | |
|
1194 | 1202 | o 6:4355d653f84f edit files yet again |
|
1195 | 1203 | | |
|
1196 | 1204 | o 5:9d5af5072dbd edit files again |
|
1197 | 1205 | | |
|
1198 | 1206 | o 4:74c02385b94c move files |
|
1199 | 1207 | | |
|
1200 | 1208 | o 1:ce8896473775 edit files |
|
1201 | 1209 | | |
|
1202 | 1210 | o 0:30d30fe6a5be add files |
|
1203 | 1211 | |
|
1204 | 1212 | Rollback on largefiles. |
|
1205 | 1213 | |
|
1206 | 1214 | $ echo large4-modified-again > sub/large4 |
|
1207 | 1215 | $ hg commit -m "Modify large4 again" |
|
1208 | 1216 | Invoking status precommit hook |
|
1209 | 1217 | M sub/large4 |
|
1210 | 1218 | $ hg rollback |
|
1211 | 1219 | repository tip rolled back to revision 9 (undo commit) |
|
1212 | 1220 | working directory now based on revision 9 |
|
1213 | 1221 | $ hg st |
|
1214 | 1222 | M sub/large4 |
|
1215 | 1223 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
1216 | 1224 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1217 | 1225 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1218 | 1226 | 7:daea875e9014 add/edit more largefiles |
|
1219 | 1227 | 6:4355d653f84f edit files yet again |
|
1220 | 1228 | 5:9d5af5072dbd edit files again |
|
1221 | 1229 | 4:74c02385b94c move files |
|
1222 | 1230 | 3:9e8fbc4bce62 copy files |
|
1223 | 1231 | 2:51a0ae4d5864 remove files |
|
1224 | 1232 | 1:ce8896473775 edit files |
|
1225 | 1233 | 0:30d30fe6a5be add files |
|
1226 | 1234 | $ cat sub/large4 |
|
1227 | 1235 | large4-modified-again |
|
1228 | 1236 | |
|
1229 | 1237 | "update --check" refuses to update with uncommitted changes. |
|
1230 | 1238 | $ hg update --check 8 |
|
1231 | 1239 | abort: uncommitted changes |
|
1232 | 1240 | [255] |
|
1233 | 1241 | |
|
1234 | 1242 | "update --clean" leaves correct largefiles in working copy, even when there is |
|
1235 | 1243 | .orig files from revert in .hglf. |
|
1236 | 1244 | |
|
1237 | 1245 | $ echo mistake > sub2/large7 |
|
1238 | 1246 | $ hg revert sub2/large7 |
|
1239 | 1247 | $ cat sub2/large7 |
|
1240 | 1248 | large7 |
|
1241 | 1249 | $ cat sub2/large7.orig |
|
1242 | 1250 | mistake |
|
1243 | 1251 | $ test ! -f .hglf/sub2/large7.orig |
|
1244 | 1252 | |
|
1245 | 1253 | $ hg -q update --clean -r null |
|
1246 | 1254 | $ hg update --clean |
|
1247 | 1255 | getting changed largefiles |
|
1248 | 1256 | 3 largefiles updated, 0 removed |
|
1249 | 1257 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1250 | 1258 | $ cat normal3 |
|
1251 | 1259 | normal3-modified |
|
1252 | 1260 | $ cat sub/normal4 |
|
1253 | 1261 | normal4-modified |
|
1254 | 1262 | $ cat sub/large4 |
|
1255 | 1263 | large4-modified |
|
1256 | 1264 | $ cat sub2/large6 |
|
1257 | 1265 | large6-modified |
|
1258 | 1266 | $ cat sub2/large7 |
|
1259 | 1267 | large7 |
|
1260 | 1268 | $ cat sub2/large7.orig |
|
1261 | 1269 | mistake |
|
1262 | 1270 | $ test ! -f .hglf/sub2/large7.orig |
|
1263 | 1271 | |
|
1264 | 1272 | verify that largefile .orig file no longer is overwritten on every update -C: |
|
1265 | 1273 | $ hg update --clean |
|
1266 | 1274 | getting changed largefiles |
|
1267 | 1275 | 0 largefiles updated, 0 removed |
|
1268 | 1276 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1269 | 1277 | $ cat sub2/large7.orig |
|
1270 | 1278 | mistake |
|
1271 | 1279 | $ rm sub2/large7.orig |
|
1272 | 1280 | |
|
1273 | 1281 | Now "update check" is happy. |
|
1274 | 1282 | $ hg update --check 8 |
|
1275 | 1283 | getting changed largefiles |
|
1276 | 1284 | 1 largefiles updated, 0 removed |
|
1277 | 1285 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1278 | 1286 | $ hg update --check |
|
1279 | 1287 | getting changed largefiles |
|
1280 | 1288 | 1 largefiles updated, 0 removed |
|
1281 | 1289 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1282 | 1290 | |
|
1283 | 1291 | Test removing empty largefiles directories on update |
|
1284 | 1292 | $ test -d sub2 && echo "sub2 exists" |
|
1285 | 1293 | sub2 exists |
|
1286 | 1294 | $ hg update -q null |
|
1287 | 1295 | $ test -d sub2 && echo "error: sub2 should not exist anymore" |
|
1288 | 1296 | [1] |
|
1289 | 1297 | $ hg update -q |
|
1290 | 1298 | |
|
1291 | 1299 | Test hg remove removes empty largefiles directories |
|
1292 | 1300 | $ test -d sub2 && echo "sub2 exists" |
|
1293 | 1301 | sub2 exists |
|
1294 | 1302 | $ hg remove sub2/* |
|
1295 | 1303 | $ test -d sub2 && echo "error: sub2 should not exist anymore" |
|
1296 | 1304 | [1] |
|
1297 | 1305 | $ hg revert sub2/large6 sub2/large7 |
|
1298 | 1306 | |
|
1299 | 1307 | "revert" works on largefiles (and normal files too). |
|
1300 | 1308 | $ echo hack3 >> normal3 |
|
1301 | 1309 | $ echo hack4 >> sub/normal4 |
|
1302 | 1310 | $ echo hack4 >> sub/large4 |
|
1303 | 1311 | $ rm sub2/large6 |
|
1304 | 1312 | $ hg revert sub2/large6 |
|
1305 | 1313 | $ hg rm sub2/large6 |
|
1306 | 1314 | $ echo new >> sub2/large8 |
|
1307 | 1315 | $ hg add --large sub2/large8 |
|
1308 | 1316 | # XXX we don't really want to report that we're reverting the standin; |
|
1309 | 1317 | # that's just an implementation detail. But I don't see an obvious fix. ;-( |
|
1310 | 1318 | $ hg revert sub |
|
1311 | 1319 | reverting .hglf/sub/large4 (glob) |
|
1312 | 1320 | reverting sub/normal4 (glob) |
|
1313 | 1321 | $ hg status |
|
1314 | 1322 | M normal3 |
|
1315 | 1323 | A sub2/large8 |
|
1316 | 1324 | R sub2/large6 |
|
1317 | 1325 | ? sub/large4.orig |
|
1318 | 1326 | ? sub/normal4.orig |
|
1319 | 1327 | $ cat sub/normal4 |
|
1320 | 1328 | normal4-modified |
|
1321 | 1329 | $ cat sub/large4 |
|
1322 | 1330 | large4-modified |
|
1323 | 1331 | $ hg revert -a --no-backup |
|
1324 | 1332 | undeleting .hglf/sub2/large6 (glob) |
|
1325 | 1333 | forgetting .hglf/sub2/large8 (glob) |
|
1326 | 1334 | reverting normal3 |
|
1327 | 1335 | $ hg status |
|
1328 | 1336 | ? sub/large4.orig |
|
1329 | 1337 | ? sub/normal4.orig |
|
1330 | 1338 | ? sub2/large8 |
|
1331 | 1339 | $ cat normal3 |
|
1332 | 1340 | normal3-modified |
|
1333 | 1341 | $ cat sub2/large6 |
|
1334 | 1342 | large6-modified |
|
1335 | 1343 | $ rm sub/*.orig sub2/large8 |
|
1336 | 1344 | |
|
1337 | 1345 | revert some files to an older revision |
|
1338 | 1346 | $ hg revert --no-backup -r 8 sub2 |
|
1339 | 1347 | reverting .hglf/sub2/large6 (glob) |
|
1340 | 1348 | $ cat sub2/large6 |
|
1341 | 1349 | large6 |
|
1342 | 1350 | $ hg revert --no-backup -C -r '.^' sub2 |
|
1343 | 1351 | reverting .hglf/sub2/large6 (glob) |
|
1344 | 1352 | $ hg revert --no-backup sub2 |
|
1345 | 1353 | reverting .hglf/sub2/large6 (glob) |
|
1346 | 1354 | $ hg status |
|
1347 | 1355 | |
|
1348 | 1356 | "verify --large" actually verifies largefiles |
|
1349 | 1357 | |
|
1350 | 1358 | - Where Do We Come From? What Are We? Where Are We Going? |
|
1351 | 1359 | $ pwd |
|
1352 | 1360 | $TESTTMP/e |
|
1353 | 1361 | $ hg paths |
|
1354 | 1362 | default = $TESTTMP/d (glob) |
|
1355 | 1363 | |
|
1356 | 1364 | $ hg verify --large |
|
1357 | 1365 | checking changesets |
|
1358 | 1366 | checking manifests |
|
1359 | 1367 | crosschecking files in changesets and manifests |
|
1360 | 1368 | checking files |
|
1361 | 1369 | 10 files, 10 changesets, 28 total revisions |
|
1362 | 1370 | searching 1 changesets for largefiles |
|
1363 | 1371 | verified existence of 3 revisions of 3 largefiles |
|
1364 | 1372 | |
|
1365 | 1373 | - introduce missing blob in local store repo and make sure that this is caught: |
|
1366 | 1374 | $ mv $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 . |
|
1367 | 1375 | $ hg verify --large |
|
1368 | 1376 | checking changesets |
|
1369 | 1377 | checking manifests |
|
1370 | 1378 | crosschecking files in changesets and manifests |
|
1371 | 1379 | checking files |
|
1372 | 1380 | 10 files, 10 changesets, 28 total revisions |
|
1373 | 1381 | searching 1 changesets for largefiles |
|
1374 | 1382 | changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob) |
|
1375 | 1383 | verified existence of 3 revisions of 3 largefiles |
|
1376 | 1384 | [1] |
|
1377 | 1385 | |
|
1378 | 1386 | - introduce corruption and make sure that it is caught when checking content: |
|
1379 | 1387 | $ echo '5 cents' > $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 |
|
1380 | 1388 | $ hg verify -q --large --lfc |
|
1381 | 1389 | changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob) |
|
1382 | 1390 | [1] |
|
1383 | 1391 | |
|
1384 | 1392 | - cleanup |
|
1385 | 1393 | $ mv e166e74c7303192238d60af5a9c4ce9bef0b7928 $TESTTMP/d/.hg/largefiles/ |
|
1386 | 1394 | |
|
1387 | 1395 | - verifying all revisions will fail because we didn't clone all largefiles to d: |
|
1388 | 1396 | $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
1389 | 1397 | $ hg verify -q --lfa --lfc |
|
1390 | 1398 | changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64 (glob) |
|
1391 | 1399 | changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d (glob) |
|
1392 | 1400 | changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f (glob) |
|
1393 | 1401 | changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob) |
|
1394 | 1402 | changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob) |
|
1395 | 1403 | changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob) |
|
1396 | 1404 | changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob) |
|
1397 | 1405 | changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c (glob) |
|
1398 | 1406 | changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9 (glob) |
|
1399 | 1407 | changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0 (glob) |
|
1400 | 1408 | [1] |
|
1401 | 1409 | |
|
1402 | 1410 | - cleanup |
|
1403 | 1411 | $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 |
|
1404 | 1412 | $ rm -f .hglf/sub/*.orig |
|
1405 | 1413 | |
|
1406 | 1414 | Update to revision with missing largefile - and make sure it really is missing |
|
1407 | 1415 | |
|
1408 | 1416 | $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0 |
|
1409 | 1417 | $ hg up -r 6 |
|
1410 | 1418 | getting changed largefiles |
|
1411 | 1419 | large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob) |
|
1412 | 1420 | 1 largefiles updated, 2 removed |
|
1413 | 1421 | 4 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1414 | 1422 | $ rm normal3 |
|
1415 | 1423 | $ echo >> sub/normal4 |
|
1416 | 1424 | $ hg ci -m 'commit with missing files' |
|
1417 | 1425 | Invoking status precommit hook |
|
1418 | 1426 | M sub/normal4 |
|
1419 | 1427 | ! large3 |
|
1420 | 1428 | ! normal3 |
|
1421 | 1429 | created new head |
|
1422 | 1430 | $ hg st |
|
1423 | 1431 | ! large3 |
|
1424 | 1432 | ! normal3 |
|
1425 | 1433 | $ hg up -r. |
|
1426 | 1434 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1427 | 1435 | $ hg st |
|
1428 | 1436 | ! large3 |
|
1429 | 1437 | ! normal3 |
|
1430 | 1438 | $ hg up -Cr. |
|
1431 | 1439 | getting changed largefiles |
|
1432 | 1440 | large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob) |
|
1433 | 1441 | 0 largefiles updated, 0 removed |
|
1434 | 1442 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1435 | 1443 | $ hg st |
|
1436 | 1444 | ! large3 |
|
1437 | 1445 | $ hg rollback |
|
1438 | 1446 | repository tip rolled back to revision 9 (undo commit) |
|
1439 | 1447 | working directory now based on revision 6 |
|
1440 | 1448 | |
|
1441 | 1449 | Merge with revision with missing largefile - and make sure it tries to fetch it. |
|
1442 | 1450 | |
|
1443 | 1451 | $ hg up -Cqr null |
|
1444 | 1452 | $ echo f > f |
|
1445 | 1453 | $ hg ci -Am branch |
|
1446 | 1454 | adding f |
|
1447 | 1455 | Invoking status precommit hook |
|
1448 | 1456 | A f |
|
1449 | 1457 | created new head |
|
1450 | 1458 | $ hg merge -r 6 |
|
1451 | 1459 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1452 | 1460 | (branch merge, don't forget to commit) |
|
1453 | 1461 | getting changed largefiles |
|
1454 | 1462 | large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob) |
|
1455 | 1463 | 1 largefiles updated, 0 removed |
|
1456 | 1464 | |
|
1457 | 1465 | $ hg rollback -q |
|
1458 | 1466 | $ hg up -Cq |
|
1459 | 1467 | |
|
1460 | 1468 | Pulling 0 revisions with --all-largefiles should not fetch for all revisions |
|
1461 | 1469 | |
|
1462 | 1470 | $ hg pull --all-largefiles |
|
1463 | 1471 | pulling from $TESTTMP/d (glob) |
|
1464 | 1472 | searching for changes |
|
1465 | 1473 | no changes found |
|
1466 | 1474 | |
|
1467 | 1475 | Merging does not revert to old versions of largefiles and also check |
|
1468 | 1476 | that merging after having pulled from a non-default remote works |
|
1469 | 1477 | correctly. |
|
1470 | 1478 | |
|
1471 | 1479 | $ cd .. |
|
1472 | 1480 | $ hg clone -r 7 e temp |
|
1473 | 1481 | adding changesets |
|
1474 | 1482 | adding manifests |
|
1475 | 1483 | adding file changes |
|
1476 | 1484 | added 8 changesets with 24 changes to 10 files |
|
1477 | 1485 | updating to branch default |
|
1478 | 1486 | getting changed largefiles |
|
1479 | 1487 | 3 largefiles updated, 0 removed |
|
1480 | 1488 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1481 | 1489 | $ hg clone temp f |
|
1482 | 1490 | updating to branch default |
|
1483 | 1491 | getting changed largefiles |
|
1484 | 1492 | 3 largefiles updated, 0 removed |
|
1485 | 1493 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1486 | 1494 | # Delete the largefiles in the largefiles system cache so that we have an |
|
1487 | 1495 | # opportunity to test that caching after a pull works. |
|
1488 | 1496 | $ rm "${USERCACHE}"/* |
|
1489 | 1497 | $ cd f |
|
1490 | 1498 | $ echo "large4-merge-test" > sub/large4 |
|
1491 | 1499 | $ hg commit -m "Modify large4 to test merge" |
|
1492 | 1500 | Invoking status precommit hook |
|
1493 | 1501 | M sub/large4 |
|
1494 | 1502 | # Test --cache-largefiles flag |
|
1495 | 1503 | $ hg pull --lfrev 'heads(pulled())' ../e |
|
1496 | 1504 | pulling from ../e |
|
1497 | 1505 | searching for changes |
|
1498 | 1506 | adding changesets |
|
1499 | 1507 | adding manifests |
|
1500 | 1508 | adding file changes |
|
1501 | 1509 | added 2 changesets with 4 changes to 4 files (+1 heads) |
|
1502 | 1510 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
1503 | 1511 | 2 largefiles cached |
|
1504 | 1512 | $ hg merge |
|
1505 | 1513 | largefile sub/large4 has a merge conflict |
|
1506 | 1514 | ancestor was 971fb41e78fea4f8e0ba5244784239371cb00591 |
|
1507 | 1515 | keep (l)ocal d846f26643bfa8ec210be40cc93cc6b7ff1128ea or |
|
1508 | 1516 | take (o)ther e166e74c7303192238d60af5a9c4ce9bef0b7928? l |
|
1509 | 1517 | 3 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
1510 | 1518 | (branch merge, don't forget to commit) |
|
1511 | 1519 | getting changed largefiles |
|
1512 | 1520 | 1 largefiles updated, 0 removed |
|
1513 | 1521 | $ hg commit -m "Merge repos e and f" |
|
1514 | 1522 | Invoking status precommit hook |
|
1515 | 1523 | M normal3 |
|
1516 | 1524 | M sub/normal4 |
|
1517 | 1525 | M sub2/large6 |
|
1518 | 1526 | $ cat normal3 |
|
1519 | 1527 | normal3-modified |
|
1520 | 1528 | $ cat sub/normal4 |
|
1521 | 1529 | normal4-modified |
|
1522 | 1530 | $ cat sub/large4 |
|
1523 | 1531 | large4-merge-test |
|
1524 | 1532 | $ cat sub2/large6 |
|
1525 | 1533 | large6-modified |
|
1526 | 1534 | $ cat sub2/large7 |
|
1527 | 1535 | large7 |
|
1528 | 1536 | |
|
1529 | 1537 | Test status after merging with a branch that introduces a new largefile: |
|
1530 | 1538 | |
|
1531 | 1539 | $ echo large > large |
|
1532 | 1540 | $ hg add --large large |
|
1533 | 1541 | $ hg commit -m 'add largefile' |
|
1534 | 1542 | Invoking status precommit hook |
|
1535 | 1543 | A large |
|
1536 | 1544 | $ hg update -q ".^" |
|
1537 | 1545 | $ echo change >> normal3 |
|
1538 | 1546 | $ hg commit -m 'some change' |
|
1539 | 1547 | Invoking status precommit hook |
|
1540 | 1548 | M normal3 |
|
1541 | 1549 | created new head |
|
1542 | 1550 | $ hg merge |
|
1543 | 1551 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1544 | 1552 | (branch merge, don't forget to commit) |
|
1545 | 1553 | getting changed largefiles |
|
1546 | 1554 | 1 largefiles updated, 0 removed |
|
1547 | 1555 | $ hg status |
|
1548 | 1556 | M large |
|
1549 | 1557 | |
|
1550 | 1558 | - make sure update of merge with removed largefiles fails as expected |
|
1551 | 1559 | $ hg rm sub2/large6 |
|
1552 | 1560 | $ hg up -r. |
|
1553 | 1561 | abort: outstanding uncommitted merges |
|
1554 | 1562 | [255] |
|
1555 | 1563 | |
|
1556 | 1564 | - revert should be able to revert files introduced in a pending merge |
|
1557 | 1565 | $ hg revert --all -r . |
|
1558 | 1566 | removing .hglf/large (glob) |
|
1559 | 1567 | undeleting .hglf/sub2/large6 (glob) |
|
1560 | 1568 | |
|
1561 | 1569 | Test that a normal file and a largefile with the same name and path cannot |
|
1562 | 1570 | coexist. |
|
1563 | 1571 | |
|
1564 | 1572 | $ rm sub2/large7 |
|
1565 | 1573 | $ echo "largeasnormal" > sub2/large7 |
|
1566 | 1574 | $ hg add sub2/large7 |
|
1567 | 1575 | sub2/large7 already a largefile |
|
1568 | 1576 | |
|
1569 | 1577 | Test that transplanting a largefile change works correctly. |
|
1570 | 1578 | |
|
1571 | 1579 | $ cd .. |
|
1572 | 1580 | $ hg clone -r 8 d g |
|
1573 | 1581 | adding changesets |
|
1574 | 1582 | adding manifests |
|
1575 | 1583 | adding file changes |
|
1576 | 1584 | added 9 changesets with 26 changes to 10 files |
|
1577 | 1585 | updating to branch default |
|
1578 | 1586 | getting changed largefiles |
|
1579 | 1587 | 3 largefiles updated, 0 removed |
|
1580 | 1588 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1581 | 1589 | $ cd g |
|
1582 | 1590 | $ hg transplant -s ../d 598410d3eb9a |
|
1583 | 1591 | searching for changes |
|
1584 | 1592 | searching for changes |
|
1585 | 1593 | adding changesets |
|
1586 | 1594 | adding manifests |
|
1587 | 1595 | adding file changes |
|
1588 | 1596 | added 1 changesets with 2 changes to 2 files |
|
1589 | 1597 | getting changed largefiles |
|
1590 | 1598 | 1 largefiles updated, 0 removed |
|
1591 | 1599 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
1592 | 1600 | 9:598410d3eb9a modify normal file largefile in repo d |
|
1593 | 1601 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
1594 | 1602 | 7:daea875e9014 add/edit more largefiles |
|
1595 | 1603 | 6:4355d653f84f edit files yet again |
|
1596 | 1604 | 5:9d5af5072dbd edit files again |
|
1597 | 1605 | 4:74c02385b94c move files |
|
1598 | 1606 | 3:9e8fbc4bce62 copy files |
|
1599 | 1607 | 2:51a0ae4d5864 remove files |
|
1600 | 1608 | 1:ce8896473775 edit files |
|
1601 | 1609 | 0:30d30fe6a5be add files |
|
1602 | 1610 | $ cat normal3 |
|
1603 | 1611 | normal3-modified |
|
1604 | 1612 | $ cat sub/normal4 |
|
1605 | 1613 | normal4-modified |
|
1606 | 1614 | $ cat sub/large4 |
|
1607 | 1615 | large4-modified |
|
1608 | 1616 | $ cat sub2/large6 |
|
1609 | 1617 | large6-modified |
|
1610 | 1618 | $ cat sub2/large7 |
|
1611 | 1619 | large7 |
|
1612 | 1620 | |
|
1613 | 1621 | Cat a largefile |
|
1614 | 1622 | $ hg cat normal3 |
|
1615 | 1623 | normal3-modified |
|
1616 | 1624 | $ hg cat sub/large4 |
|
1617 | 1625 | large4-modified |
|
1618 | 1626 | $ rm "${USERCACHE}"/* |
|
1619 | 1627 | $ hg cat -r a381d2c8c80e -o cat.out sub/large4 |
|
1620 | 1628 | $ cat cat.out |
|
1621 | 1629 | large4-modified |
|
1622 | 1630 | $ rm cat.out |
|
1623 | 1631 | $ hg cat -r a381d2c8c80e normal3 |
|
1624 | 1632 | normal3-modified |
|
1625 | 1633 | $ hg cat -r '.^' normal3 |
|
1626 | 1634 | normal3-modified |
|
1627 | 1635 | $ hg cat -r '.^' sub/large4 doesntexist |
|
1628 | 1636 | large4-modified |
|
1629 | 1637 | doesntexist: no such file in rev a381d2c8c80e |
|
1630 | 1638 | $ hg --cwd sub cat -r '.^' large4 |
|
1631 | 1639 | large4-modified |
|
1632 | 1640 | $ hg --cwd sub cat -r '.^' ../normal3 |
|
1633 | 1641 | normal3-modified |
|
1634 | 1642 | Cat a standin |
|
1635 | 1643 | $ hg cat .hglf/sub/large4 |
|
1636 | 1644 | e166e74c7303192238d60af5a9c4ce9bef0b7928 |
|
1637 | 1645 | $ hg cat .hglf/normal3 |
|
1638 | 1646 | .hglf/normal3: no such file in rev 598410d3eb9a |
|
1639 | 1647 | [1] |
|
1640 | 1648 | |
|
1641 | 1649 | Test that renaming a largefile results in correct output for status |
|
1642 | 1650 | |
|
1643 | 1651 | $ hg rename sub/large4 large4-renamed |
|
1644 | 1652 | $ hg commit -m "test rename output" |
|
1645 | 1653 | Invoking status precommit hook |
|
1646 | 1654 | A large4-renamed |
|
1647 | 1655 | R sub/large4 |
|
1648 | 1656 | $ cat large4-renamed |
|
1649 | 1657 | large4-modified |
|
1650 | 1658 | $ cd sub2 |
|
1651 | 1659 | $ hg rename large6 large6-renamed |
|
1652 | 1660 | $ hg st |
|
1653 | 1661 | A sub2/large6-renamed |
|
1654 | 1662 | R sub2/large6 |
|
1655 | 1663 | $ cd .. |
|
1656 | 1664 | |
|
1657 | 1665 | Test --normal flag |
|
1658 | 1666 | |
|
1659 | 1667 | $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null |
|
1660 | 1668 | $ hg add --normal --large new-largefile |
|
1661 | 1669 | abort: --normal cannot be used with --large |
|
1662 | 1670 | [255] |
|
1663 | 1671 | $ hg add --normal new-largefile |
|
1664 | 1672 | new-largefile: up to 69 MB of RAM may be required to manage this file |
|
1665 | 1673 | (use 'hg revert new-largefile' to cancel the pending addition) |
|
1666 | 1674 | $ cd .. |
|
1667 | 1675 | |
|
1668 | 1676 | #if serve |
|
1669 | 1677 | vanilla clients not locked out from largefiles servers on vanilla repos |
|
1670 | 1678 | $ mkdir r1 |
|
1671 | 1679 | $ cd r1 |
|
1672 | 1680 | $ hg init |
|
1673 | 1681 | $ echo c1 > f1 |
|
1674 | 1682 | $ hg add f1 |
|
1675 | 1683 | $ hg commit -m "m1" |
|
1676 | 1684 | Invoking status precommit hook |
|
1677 | 1685 | A f1 |
|
1678 | 1686 | $ cd .. |
|
1679 | 1687 | $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid |
|
1680 | 1688 | $ cat hg.pid >> $DAEMON_PIDS |
|
1681 | 1689 | $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2 |
|
1682 | 1690 | requesting all changes |
|
1683 | 1691 | adding changesets |
|
1684 | 1692 | adding manifests |
|
1685 | 1693 | adding file changes |
|
1686 | 1694 | added 1 changesets with 1 changes to 1 files |
|
1687 | 1695 | updating to branch default |
|
1688 | 1696 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1689 | 1697 | |
|
1690 | 1698 | largefiles clients still work with vanilla servers |
|
1691 | 1699 | $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid |
|
1692 | 1700 | $ cat hg.pid >> $DAEMON_PIDS |
|
1693 | 1701 | $ hg clone http://localhost:$HGPORT1 r3 |
|
1694 | 1702 | requesting all changes |
|
1695 | 1703 | adding changesets |
|
1696 | 1704 | adding manifests |
|
1697 | 1705 | adding file changes |
|
1698 | 1706 | added 1 changesets with 1 changes to 1 files |
|
1699 | 1707 | updating to branch default |
|
1700 | 1708 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1701 | 1709 | #endif |
|
1702 | 1710 | |
|
1703 | 1711 | |
|
1704 | 1712 | vanilla clients locked out from largefiles http repos |
|
1705 | 1713 | $ mkdir r4 |
|
1706 | 1714 | $ cd r4 |
|
1707 | 1715 | $ hg init |
|
1708 | 1716 | $ echo c1 > f1 |
|
1709 | 1717 | $ hg add --large f1 |
|
1710 | 1718 | $ hg commit -m "m1" |
|
1711 | 1719 | Invoking status precommit hook |
|
1712 | 1720 | A f1 |
|
1713 | 1721 | $ cd .. |
|
1714 | 1722 | |
|
1715 | 1723 | largefiles can be pushed locally (issue3583) |
|
1716 | 1724 | $ hg init dest |
|
1717 | 1725 | $ cd r4 |
|
1718 | 1726 | $ hg outgoing ../dest |
|
1719 | 1727 | comparing with ../dest |
|
1720 | 1728 | searching for changes |
|
1721 | 1729 | changeset: 0:639881c12b4c |
|
1722 | 1730 | tag: tip |
|
1723 | 1731 | user: test |
|
1724 | 1732 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1725 | 1733 | summary: m1 |
|
1726 | 1734 | |
|
1727 | 1735 | $ hg push ../dest |
|
1728 | 1736 | pushing to ../dest |
|
1729 | 1737 | searching for changes |
|
1730 | 1738 | adding changesets |
|
1731 | 1739 | adding manifests |
|
1732 | 1740 | adding file changes |
|
1733 | 1741 | added 1 changesets with 1 changes to 1 files |
|
1734 | 1742 | |
|
1735 | 1743 | exit code with nothing outgoing (issue3611) |
|
1736 | 1744 | $ hg outgoing ../dest |
|
1737 | 1745 | comparing with ../dest |
|
1738 | 1746 | searching for changes |
|
1739 | 1747 | no changes found |
|
1740 | 1748 | [1] |
|
1741 | 1749 | $ cd .. |
|
1742 | 1750 | |
|
1743 | 1751 | #if serve |
|
1744 | 1752 | $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid |
|
1745 | 1753 | $ cat hg.pid >> $DAEMON_PIDS |
|
1746 | 1754 | $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5 |
|
1747 | 1755 | abort: remote error: |
|
1748 | 1756 | |
|
1749 | 1757 | This repository uses the largefiles extension. |
|
1750 | 1758 | |
|
1751 | 1759 | Please enable it in your Mercurial config file. |
|
1752 | 1760 | [255] |
|
1753 | 1761 | |
|
1754 | 1762 | used all HGPORTs, kill all daemons |
|
1755 | 1763 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
|
1756 | 1764 | #endif |
|
1757 | 1765 | |
|
1758 | 1766 | vanilla clients locked out from largefiles ssh repos |
|
1759 | 1767 | $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5 |
|
1760 | 1768 | abort: remote error: |
|
1761 | 1769 | |
|
1762 | 1770 | This repository uses the largefiles extension. |
|
1763 | 1771 | |
|
1764 | 1772 | Please enable it in your Mercurial config file. |
|
1765 | 1773 | [255] |
|
1766 | 1774 | |
|
1767 | 1775 | #if serve |
|
1768 | 1776 | |
|
1769 | 1777 | largefiles clients refuse to push largefiles repos to vanilla servers |
|
1770 | 1778 | $ mkdir r6 |
|
1771 | 1779 | $ cd r6 |
|
1772 | 1780 | $ hg init |
|
1773 | 1781 | $ echo c1 > f1 |
|
1774 | 1782 | $ hg add f1 |
|
1775 | 1783 | $ hg commit -m "m1" |
|
1776 | 1784 | Invoking status precommit hook |
|
1777 | 1785 | A f1 |
|
1778 | 1786 | $ cat >> .hg/hgrc <<! |
|
1779 | 1787 | > [web] |
|
1780 | 1788 | > push_ssl = false |
|
1781 | 1789 | > allow_push = * |
|
1782 | 1790 | > ! |
|
1783 | 1791 | $ cd .. |
|
1784 | 1792 | $ hg clone r6 r7 |
|
1785 | 1793 | updating to branch default |
|
1786 | 1794 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1787 | 1795 | $ cd r7 |
|
1788 | 1796 | $ echo c2 > f2 |
|
1789 | 1797 | $ hg add --large f2 |
|
1790 | 1798 | $ hg commit -m "m2" |
|
1791 | 1799 | Invoking status precommit hook |
|
1792 | 1800 | A f2 |
|
1793 | 1801 | $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid |
|
1794 | 1802 | $ cat ../hg.pid >> $DAEMON_PIDS |
|
1795 | 1803 | $ hg push http://localhost:$HGPORT |
|
1796 | 1804 | pushing to http://localhost:$HGPORT/ |
|
1797 | 1805 | searching for changes |
|
1798 | 1806 | abort: http://localhost:$HGPORT/ does not appear to be a largefile store |
|
1799 | 1807 | [255] |
|
1800 | 1808 | $ cd .. |
|
1801 | 1809 | |
|
1802 | 1810 | putlfile errors are shown (issue3123) |
|
1803 | 1811 | Corrupt the cached largefile in r7 and move it out of the servers usercache |
|
1804 | 1812 | $ mv r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 . |
|
1805 | 1813 | $ echo 'client side corruption' > r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 |
|
1806 | 1814 | $ rm "$USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8" |
|
1807 | 1815 | $ hg init empty |
|
1808 | 1816 | $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \ |
|
1809 | 1817 | > --config 'web.allow_push=*' --config web.push_ssl=False |
|
1810 | 1818 | $ cat hg.pid >> $DAEMON_PIDS |
|
1811 | 1819 | $ hg push -R r7 http://localhost:$HGPORT1 |
|
1812 | 1820 | pushing to http://localhost:$HGPORT1/ |
|
1813 | 1821 | searching for changes |
|
1814 | 1822 | remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash |
|
1815 | 1823 | abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob) |
|
1816 | 1824 | [255] |
|
1817 | 1825 | $ mv 4cdac4d8b084d0b599525cf732437fb337d422a8 r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 |
|
1818 | 1826 | Push of file that exists on server but is corrupted - magic healing would be nice ... but too magic |
|
1819 | 1827 | $ echo "server side corruption" > empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 |
|
1820 | 1828 | $ hg push -R r7 http://localhost:$HGPORT1 |
|
1821 | 1829 | pushing to http://localhost:$HGPORT1/ |
|
1822 | 1830 | searching for changes |
|
1823 | 1831 | remote: adding changesets |
|
1824 | 1832 | remote: adding manifests |
|
1825 | 1833 | remote: adding file changes |
|
1826 | 1834 | remote: added 2 changesets with 2 changes to 2 files |
|
1827 | 1835 | $ cat empty/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 |
|
1828 | 1836 | server side corruption |
|
1829 | 1837 | $ rm -rf empty |
|
1830 | 1838 | |
|
1831 | 1839 | Push a largefiles repository to a served empty repository |
|
1832 | 1840 | $ hg init r8 |
|
1833 | 1841 | $ echo c3 > r8/f1 |
|
1834 | 1842 | $ hg add --large r8/f1 -R r8 |
|
1835 | 1843 | $ hg commit -m "m1" -R r8 |
|
1836 | 1844 | Invoking status precommit hook |
|
1837 | 1845 | A f1 |
|
1838 | 1846 | $ hg init empty |
|
1839 | 1847 | $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \ |
|
1840 | 1848 | > --config 'web.allow_push=*' --config web.push_ssl=False |
|
1841 | 1849 | $ cat hg.pid >> $DAEMON_PIDS |
|
1842 | 1850 | $ rm "${USERCACHE}"/* |
|
1843 | 1851 | $ hg push -R r8 http://localhost:$HGPORT2/#default |
|
1844 | 1852 | pushing to http://localhost:$HGPORT2/ |
|
1845 | 1853 | searching for changes |
|
1846 | 1854 | remote: adding changesets |
|
1847 | 1855 | remote: adding manifests |
|
1848 | 1856 | remote: adding file changes |
|
1849 | 1857 | remote: added 1 changesets with 1 changes to 1 files |
|
1850 | 1858 | $ [ -f "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 ] |
|
1851 | 1859 | $ [ -f empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ] |
|
1852 | 1860 | |
|
1853 | 1861 | Clone over http, no largefiles pulled on clone. |
|
1854 | 1862 | |
|
1855 | 1863 | $ hg clone http://localhost:$HGPORT2/#default http-clone -U |
|
1856 | 1864 | adding changesets |
|
1857 | 1865 | adding manifests |
|
1858 | 1866 | adding file changes |
|
1859 | 1867 | added 1 changesets with 1 changes to 1 files |
|
1860 | 1868 | |
|
1861 | 1869 | test 'verify' with remotestore: |
|
1862 | 1870 | |
|
1863 | 1871 | $ rm "${USERCACHE}"/02a439e5c31c526465ab1a0ca1f431f76b827b90 |
|
1864 | 1872 | $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 . |
|
1865 | 1873 | $ hg -R http-clone verify --large --lfa |
|
1866 | 1874 | checking changesets |
|
1867 | 1875 | checking manifests |
|
1868 | 1876 | crosschecking files in changesets and manifests |
|
1869 | 1877 | checking files |
|
1870 | 1878 | 1 files, 1 changesets, 1 total revisions |
|
1871 | 1879 | searching 1 changesets for largefiles |
|
1872 | 1880 | changeset 0:cf03e5bb9936: f1 missing |
|
1873 | 1881 | verified existence of 1 revisions of 1 largefiles |
|
1874 | 1882 | [1] |
|
1875 | 1883 | $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/ |
|
1876 | 1884 | $ hg -R http-clone -q verify --large --lfa |
|
1877 | 1885 | |
|
1878 | 1886 | largefiles pulled on update - a largefile missing on the server: |
|
1879 | 1887 | $ mv empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 . |
|
1880 | 1888 | $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache |
|
1881 | 1889 | getting changed largefiles |
|
1882 | 1890 | f1: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 not available from http://localhost:$HGPORT2/ |
|
1883 | 1891 | 0 largefiles updated, 0 removed |
|
1884 | 1892 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1885 | 1893 | $ hg -R http-clone st |
|
1886 | 1894 | ! f1 |
|
1887 | 1895 | $ hg -R http-clone up -Cqr null |
|
1888 | 1896 | |
|
1889 | 1897 | largefiles pulled on update - a largefile corrupted on the server: |
|
1890 | 1898 | $ echo corruption > empty/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 |
|
1891 | 1899 | $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache |
|
1892 | 1900 | getting changed largefiles |
|
1893 | 1901 | f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27) |
|
1894 | 1902 | 0 largefiles updated, 0 removed |
|
1895 | 1903 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1896 | 1904 | $ hg -R http-clone st |
|
1897 | 1905 | ! f1 |
|
1898 | 1906 | $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ] |
|
1899 | 1907 | $ [ ! -f http-clone/f1 ] |
|
1900 | 1908 | $ [ ! -f http-clone-usercache ] |
|
1901 | 1909 | $ hg -R http-clone verify --large --lfc |
|
1902 | 1910 | checking changesets |
|
1903 | 1911 | checking manifests |
|
1904 | 1912 | crosschecking files in changesets and manifests |
|
1905 | 1913 | checking files |
|
1906 | 1914 | 1 files, 1 changesets, 1 total revisions |
|
1907 | 1915 | searching 1 changesets for largefiles |
|
1908 | 1916 | verified contents of 1 revisions of 1 largefiles |
|
1909 | 1917 | $ hg -R http-clone up -Cqr null |
|
1910 | 1918 | |
|
1911 | 1919 | largefiles pulled on update - no server side problems: |
|
1912 | 1920 | $ mv 02a439e5c31c526465ab1a0ca1f431f76b827b90 empty/.hg/largefiles/ |
|
1913 | 1921 | $ hg -R http-clone --debug up --config largefiles.usercache=http-clone-usercache |
|
1914 | 1922 | resolving manifests |
|
1915 | 1923 | branchmerge: False, force: False, partial: False |
|
1916 | 1924 | ancestor: 000000000000, local: 000000000000+, remote: cf03e5bb9936 |
|
1917 | 1925 | .hglf/f1: remote created -> g |
|
1918 | 1926 | getting .hglf/f1 |
|
1919 | 1927 | updating: .hglf/f1 1/1 files (100.00%) |
|
1920 | 1928 | getting changed largefiles |
|
1921 | 1929 | using http://localhost:$HGPORT2/ |
|
1922 | 1930 | sending capabilities command |
|
1923 | 1931 | sending batch command |
|
1924 | 1932 | getting largefiles: 0/1 lfile (0.00%) |
|
1925 | 1933 | getting f1:02a439e5c31c526465ab1a0ca1f431f76b827b90 |
|
1926 | 1934 | sending getlfile command |
|
1927 | 1935 | found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store |
|
1928 | 1936 | 1 largefiles updated, 0 removed |
|
1929 | 1937 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1930 | 1938 | |
|
1931 | 1939 | $ ls http-clone-usercache/* |
|
1932 | 1940 | http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90 |
|
1933 | 1941 | |
|
1934 | 1942 | $ rm -rf empty http-clone* |
|
1935 | 1943 | |
|
1936 | 1944 | used all HGPORTs, kill all daemons |
|
1937 | 1945 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
|
1938 | 1946 | |
|
1939 | 1947 | #endif |
|
1940 | 1948 | |
|
1941 | 1949 | |
|
1942 | 1950 | #if unix-permissions |
|
1943 | 1951 | |
|
1944 | 1952 | Clone a local repository owned by another user |
|
1945 | 1953 | We have to simulate that here by setting $HOME and removing write permissions |
|
1946 | 1954 | $ ORIGHOME="$HOME" |
|
1947 | 1955 | $ mkdir alice |
|
1948 | 1956 | $ HOME="`pwd`/alice" |
|
1949 | 1957 | $ cd alice |
|
1950 | 1958 | $ hg init pubrepo |
|
1951 | 1959 | $ cd pubrepo |
|
1952 | 1960 | $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null |
|
1953 | 1961 | $ hg add --large a-large-file |
|
1954 | 1962 | $ hg commit -m "Add a large file" |
|
1955 | 1963 | Invoking status precommit hook |
|
1956 | 1964 | A a-large-file |
|
1957 | 1965 | $ cd .. |
|
1958 | 1966 | $ chmod -R a-w pubrepo |
|
1959 | 1967 | $ cd .. |
|
1960 | 1968 | $ mkdir bob |
|
1961 | 1969 | $ HOME="`pwd`/bob" |
|
1962 | 1970 | $ cd bob |
|
1963 | 1971 | $ hg clone --pull ../alice/pubrepo pubrepo |
|
1964 | 1972 | requesting all changes |
|
1965 | 1973 | adding changesets |
|
1966 | 1974 | adding manifests |
|
1967 | 1975 | adding file changes |
|
1968 | 1976 | added 1 changesets with 1 changes to 1 files |
|
1969 | 1977 | updating to branch default |
|
1970 | 1978 | getting changed largefiles |
|
1971 | 1979 | 1 largefiles updated, 0 removed |
|
1972 | 1980 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1973 | 1981 | $ cd .. |
|
1974 | 1982 | $ chmod -R u+w alice/pubrepo |
|
1975 | 1983 | $ HOME="$ORIGHOME" |
|
1976 | 1984 | |
|
1977 | 1985 | #endif |
|
1978 | 1986 | |
|
1979 | 1987 | #if symlink |
|
1980 | 1988 | |
|
1981 | 1989 | Symlink to a large largefile should behave the same as a symlink to a normal file |
|
1982 | 1990 | $ hg init largesymlink |
|
1983 | 1991 | $ cd largesymlink |
|
1984 | 1992 | $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null |
|
1985 | 1993 | $ hg add --large largefile |
|
1986 | 1994 | $ hg commit -m "commit a large file" |
|
1987 | 1995 | Invoking status precommit hook |
|
1988 | 1996 | A largefile |
|
1989 | 1997 | $ ln -s largefile largelink |
|
1990 | 1998 | $ hg add largelink |
|
1991 | 1999 | $ hg commit -m "commit a large symlink" |
|
1992 | 2000 | Invoking status precommit hook |
|
1993 | 2001 | A largelink |
|
1994 | 2002 | $ rm -f largelink |
|
1995 | 2003 | $ hg up >/dev/null |
|
1996 | 2004 | $ test -f largelink |
|
1997 | 2005 | [1] |
|
1998 | 2006 | $ test -L largelink |
|
1999 | 2007 | [1] |
|
2000 | 2008 | $ rm -f largelink # make next part of the test independent of the previous |
|
2001 | 2009 | $ hg up -C >/dev/null |
|
2002 | 2010 | $ test -f largelink |
|
2003 | 2011 | $ test -L largelink |
|
2004 | 2012 | $ cd .. |
|
2005 | 2013 | |
|
2006 | 2014 | #endif |
|
2007 | 2015 | |
|
2008 | 2016 | test for pattern matching on 'hg status': |
|
2009 | 2017 | to boost performance, largefiles checks whether specified patterns are |
|
2010 | 2018 | related to largefiles in working directory (NOT to STANDIN) or not. |
|
2011 | 2019 | |
|
2012 | 2020 | $ hg init statusmatch |
|
2013 | 2021 | $ cd statusmatch |
|
2014 | 2022 | |
|
2015 | 2023 | $ mkdir -p a/b/c/d |
|
2016 | 2024 | $ echo normal > a/b/c/d/e.normal.txt |
|
2017 | 2025 | $ hg add a/b/c/d/e.normal.txt |
|
2018 | 2026 | $ echo large > a/b/c/d/e.large.txt |
|
2019 | 2027 | $ hg add --large a/b/c/d/e.large.txt |
|
2020 | 2028 | $ mkdir -p a/b/c/x |
|
2021 | 2029 | $ echo normal > a/b/c/x/y.normal.txt |
|
2022 | 2030 | $ hg add a/b/c/x/y.normal.txt |
|
2023 | 2031 | $ hg commit -m 'add files' |
|
2024 | 2032 | Invoking status precommit hook |
|
2025 | 2033 | A a/b/c/d/e.large.txt |
|
2026 | 2034 | A a/b/c/d/e.normal.txt |
|
2027 | 2035 | A a/b/c/x/y.normal.txt |
|
2028 | 2036 | |
|
2029 | 2037 | (1) no pattern: no performance boost |
|
2030 | 2038 | $ hg status -A |
|
2031 | 2039 | C a/b/c/d/e.large.txt |
|
2032 | 2040 | C a/b/c/d/e.normal.txt |
|
2033 | 2041 | C a/b/c/x/y.normal.txt |
|
2034 | 2042 | |
|
2035 | 2043 | (2) pattern not related to largefiles: performance boost |
|
2036 | 2044 | $ hg status -A a/b/c/x |
|
2037 | 2045 | C a/b/c/x/y.normal.txt |
|
2038 | 2046 | |
|
2039 | 2047 | (3) pattern related to largefiles: no performance boost |
|
2040 | 2048 | $ hg status -A a/b/c/d |
|
2041 | 2049 | C a/b/c/d/e.large.txt |
|
2042 | 2050 | C a/b/c/d/e.normal.txt |
|
2043 | 2051 | |
|
2044 | 2052 | (4) pattern related to STANDIN (not to largefiles): performance boost |
|
2045 | 2053 | $ hg status -A .hglf/a |
|
2046 | 2054 | C .hglf/a/b/c/d/e.large.txt |
|
2047 | 2055 | |
|
2048 | 2056 | (5) mixed case: no performance boost |
|
2049 | 2057 | $ hg status -A a/b/c/x a/b/c/d |
|
2050 | 2058 | C a/b/c/d/e.large.txt |
|
2051 | 2059 | C a/b/c/d/e.normal.txt |
|
2052 | 2060 | C a/b/c/x/y.normal.txt |
|
2053 | 2061 | |
|
2054 | 2062 | verify that largefiles doesn't break filesets |
|
2055 | 2063 | |
|
2056 | 2064 | $ hg log --rev . --exclude "set:binary()" |
|
2057 | 2065 | changeset: 0:41bd42f10efa |
|
2058 | 2066 | tag: tip |
|
2059 | 2067 | user: test |
|
2060 | 2068 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2061 | 2069 | summary: add files |
|
2062 | 2070 | |
|
2063 | 2071 | verify that large files in subrepos handled properly |
|
2064 | 2072 | $ hg init subrepo |
|
2065 | 2073 | $ echo "subrepo = subrepo" > .hgsub |
|
2066 | 2074 | $ hg add .hgsub |
|
2067 | 2075 | $ hg ci -m "add subrepo" |
|
2068 | 2076 | Invoking status precommit hook |
|
2069 | 2077 | A .hgsub |
|
2070 | 2078 | ? .hgsubstate |
|
2071 | 2079 | $ echo "rev 1" > subrepo/large.txt |
|
2072 | 2080 | $ hg -R subrepo add --large subrepo/large.txt |
|
2073 | 2081 | $ hg sum |
|
2074 | 2082 | parent: 1:8ee150ea2e9c tip |
|
2075 | 2083 | add subrepo |
|
2076 | 2084 | branch: default |
|
2077 | 2085 | commit: 1 subrepos |
|
2078 | 2086 | update: (current) |
|
2079 | 2087 | $ hg st |
|
2080 | 2088 | $ hg st -S |
|
2081 | 2089 | A subrepo/large.txt |
|
2082 | 2090 | $ hg ci -S -m "commit top repo" |
|
2083 | 2091 | committing subrepository subrepo |
|
2084 | 2092 | Invoking status precommit hook |
|
2085 | 2093 | A large.txt |
|
2086 | 2094 | Invoking status precommit hook |
|
2087 | 2095 | M .hgsubstate |
|
2088 | 2096 | # No differences |
|
2089 | 2097 | $ hg st -S |
|
2090 | 2098 | $ hg sum |
|
2091 | 2099 | parent: 2:ce4cd0c527a6 tip |
|
2092 | 2100 | commit top repo |
|
2093 | 2101 | branch: default |
|
2094 | 2102 | commit: (clean) |
|
2095 | 2103 | update: (current) |
|
2096 | 2104 | $ echo "rev 2" > subrepo/large.txt |
|
2097 | 2105 | $ hg st -S |
|
2098 | 2106 | M subrepo/large.txt |
|
2099 | 2107 | $ hg sum |
|
2100 | 2108 | parent: 2:ce4cd0c527a6 tip |
|
2101 | 2109 | commit top repo |
|
2102 | 2110 | branch: default |
|
2103 | 2111 | commit: 1 subrepos |
|
2104 | 2112 | update: (current) |
|
2105 | 2113 | $ hg ci -m "this commit should fail without -S" |
|
2106 | 2114 | abort: uncommitted changes in subrepo subrepo |
|
2107 | 2115 | (use --subrepos for recursive commit) |
|
2108 | 2116 | [255] |
|
2109 | 2117 | |
|
2110 | 2118 | Add a normal file to the subrepo, then test archiving |
|
2111 | 2119 | |
|
2112 | 2120 | $ echo 'normal file' > subrepo/normal.txt |
|
2113 | 2121 | $ hg -R subrepo add subrepo/normal.txt |
|
2114 | 2122 | |
|
2115 | 2123 | Lock in subrepo, otherwise the change isn't archived |
|
2116 | 2124 | |
|
2117 | 2125 | $ hg ci -S -m "add normal file to top level" |
|
2118 | 2126 | committing subrepository subrepo |
|
2119 | 2127 | Invoking status precommit hook |
|
2120 | 2128 | M large.txt |
|
2121 | 2129 | A normal.txt |
|
2122 | 2130 | Invoking status precommit hook |
|
2123 | 2131 | M .hgsubstate |
|
2124 | 2132 | $ hg archive -S ../lf_subrepo_archive |
|
2125 | 2133 | $ find ../lf_subrepo_archive | sort |
|
2126 | 2134 | ../lf_subrepo_archive |
|
2127 | 2135 | ../lf_subrepo_archive/.hg_archival.txt |
|
2128 | 2136 | ../lf_subrepo_archive/.hgsub |
|
2129 | 2137 | ../lf_subrepo_archive/.hgsubstate |
|
2130 | 2138 | ../lf_subrepo_archive/a |
|
2131 | 2139 | ../lf_subrepo_archive/a/b |
|
2132 | 2140 | ../lf_subrepo_archive/a/b/c |
|
2133 | 2141 | ../lf_subrepo_archive/a/b/c/d |
|
2134 | 2142 | ../lf_subrepo_archive/a/b/c/d/e.large.txt |
|
2135 | 2143 | ../lf_subrepo_archive/a/b/c/d/e.normal.txt |
|
2136 | 2144 | ../lf_subrepo_archive/a/b/c/x |
|
2137 | 2145 | ../lf_subrepo_archive/a/b/c/x/y.normal.txt |
|
2138 | 2146 | ../lf_subrepo_archive/subrepo |
|
2139 | 2147 | ../lf_subrepo_archive/subrepo/large.txt |
|
2140 | 2148 | ../lf_subrepo_archive/subrepo/normal.txt |
|
2141 | 2149 | |
|
2142 | 2150 | Test update with subrepos. |
|
2143 | 2151 | |
|
2144 | 2152 | $ hg update 0 |
|
2145 | 2153 | getting changed largefiles |
|
2146 | 2154 | 0 largefiles updated, 1 removed |
|
2147 | 2155 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
2148 | 2156 | $ hg status -S |
|
2149 | 2157 | $ hg update tip |
|
2150 | 2158 | getting changed largefiles |
|
2151 | 2159 | 1 largefiles updated, 0 removed |
|
2152 | 2160 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
2153 | 2161 | $ hg status -S |
|
2154 | 2162 | # modify a large file |
|
2155 | 2163 | $ echo "modified" > subrepo/large.txt |
|
2156 | 2164 | $ hg st -S |
|
2157 | 2165 | M subrepo/large.txt |
|
2158 | 2166 | # update -C should revert the change. |
|
2159 | 2167 | $ hg update -C |
|
2160 | 2168 | getting changed largefiles |
|
2161 | 2169 | 1 largefiles updated, 0 removed |
|
2162 | 2170 | getting changed largefiles |
|
2163 | 2171 | 0 largefiles updated, 0 removed |
|
2164 | 2172 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
2165 | 2173 | $ hg status -S |
|
2166 | 2174 | |
|
2167 | 2175 | Test archiving a revision that references a subrepo that is not yet |
|
2168 | 2176 | cloned (see test-subrepo-recursion.t): |
|
2169 | 2177 | |
|
2170 | 2178 | $ hg clone -U . ../empty |
|
2171 | 2179 | $ cd ../empty |
|
2172 | 2180 | $ hg archive --subrepos -r tip ../archive.tar.gz |
|
2173 | 2181 | cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo |
|
2174 | 2182 | $ cd .. |
|
2175 | 2183 | |
|
2176 | 2184 | Test that addremove picks up largefiles prior to the initial commit (issue3541) |
|
2177 | 2185 | |
|
2178 | 2186 | $ hg init addrm2 |
|
2179 | 2187 | $ cd addrm2 |
|
2180 | 2188 | $ touch large.dat |
|
2181 | 2189 | $ touch large2.dat |
|
2182 | 2190 | $ touch normal |
|
2183 | 2191 | $ hg add --large large.dat |
|
2184 | 2192 | $ hg addremove -v |
|
2185 | 2193 | adding large2.dat as a largefile |
|
2186 | 2194 | adding normal |
|
2187 | 2195 | |
|
2188 | 2196 | Test that forgetting all largefiles reverts to islfilesrepo() == False |
|
2189 | 2197 | (addremove will add *.dat as normal files now) |
|
2190 | 2198 | $ hg forget large.dat |
|
2191 | 2199 | $ hg forget large2.dat |
|
2192 | 2200 | $ hg addremove -v |
|
2193 | 2201 | adding large.dat |
|
2194 | 2202 | adding large2.dat |
|
2195 | 2203 | |
|
2196 | 2204 | Test commit's addremove option prior to the first commit |
|
2197 | 2205 | $ hg forget large.dat |
|
2198 | 2206 | $ hg forget large2.dat |
|
2199 | 2207 | $ hg add --large large.dat |
|
2200 | 2208 | $ hg ci -Am "commit" |
|
2201 | 2209 | adding large2.dat as a largefile |
|
2202 | 2210 | Invoking status precommit hook |
|
2203 | 2211 | A large.dat |
|
2204 | 2212 | A large2.dat |
|
2205 | 2213 | A normal |
|
2206 | 2214 | $ find .hglf | sort |
|
2207 | 2215 | .hglf |
|
2208 | 2216 | .hglf/large.dat |
|
2209 | 2217 | .hglf/large2.dat |
|
2210 | 2218 | |
|
2211 | 2219 | Test actions on largefiles using relative paths from subdir |
|
2212 | 2220 | |
|
2213 | 2221 | $ mkdir sub |
|
2214 | 2222 | $ cd sub |
|
2215 | 2223 | $ echo anotherlarge > anotherlarge |
|
2216 | 2224 | $ hg add --large anotherlarge |
|
2217 | 2225 | $ hg st |
|
2218 | 2226 | A sub/anotherlarge |
|
2219 | 2227 | $ hg st anotherlarge |
|
2220 | 2228 | A anotherlarge |
|
2221 | 2229 | $ hg commit -m anotherlarge anotherlarge |
|
2222 | 2230 | Invoking status precommit hook |
|
2223 | 2231 | A sub/anotherlarge |
|
2224 | 2232 | $ hg log anotherlarge |
|
2225 | 2233 | changeset: 1:9627a577c5e9 |
|
2226 | 2234 | tag: tip |
|
2227 | 2235 | user: test |
|
2228 | 2236 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2229 | 2237 | summary: anotherlarge |
|
2230 | 2238 | |
|
2231 | 2239 | $ hg log -G anotherlarge |
|
2232 | 2240 | @ changeset: 1:9627a577c5e9 |
|
2233 | 2241 | | tag: tip |
|
2234 | 2242 | | user: test |
|
2235 | 2243 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2236 | 2244 | | summary: anotherlarge |
|
2237 | 2245 | | |
|
2238 | 2246 | $ echo more >> anotherlarge |
|
2239 | 2247 | $ hg st . |
|
2240 | 2248 | M anotherlarge |
|
2241 | 2249 | $ hg cat anotherlarge |
|
2242 | 2250 | anotherlarge |
|
2243 | 2251 | $ hg revert anotherlarge |
|
2244 | 2252 | $ hg st |
|
2245 | 2253 | ? sub/anotherlarge.orig |
|
2246 | 2254 | $ cd .. |
|
2247 | 2255 | |
|
2248 | 2256 | $ cd .. |
|
2249 | 2257 | |
|
2250 | 2258 | issue3651: summary/outgoing with largefiles shows "no remote repo" |
|
2251 | 2259 | unexpectedly |
|
2252 | 2260 | |
|
2253 | 2261 | $ mkdir issue3651 |
|
2254 | 2262 | $ cd issue3651 |
|
2255 | 2263 | |
|
2256 | 2264 | $ hg init src |
|
2257 | 2265 | $ echo a > src/a |
|
2258 | 2266 | $ hg -R src add --large src/a |
|
2259 | 2267 | $ hg -R src commit -m '#0' |
|
2260 | 2268 | Invoking status precommit hook |
|
2261 | 2269 | A a |
|
2262 | 2270 | |
|
2263 | 2271 | check messages when no remote repository is specified: |
|
2264 | 2272 | "no remote repo" route for "hg outgoing --large" is not tested here, |
|
2265 | 2273 | because it can't be reproduced easily. |
|
2266 | 2274 | |
|
2267 | 2275 | $ hg init clone1 |
|
2268 | 2276 | $ hg -R clone1 -q pull src |
|
2269 | 2277 | $ hg -R clone1 -q update |
|
2270 | 2278 | $ hg -R clone1 paths | grep default |
|
2271 | 2279 | [1] |
|
2272 | 2280 | |
|
2273 | 2281 | $ hg -R clone1 summary --large |
|
2274 | 2282 | parent: 0:fc0bd45326d3 tip |
|
2275 | 2283 | #0 |
|
2276 | 2284 | branch: default |
|
2277 | 2285 | commit: (clean) |
|
2278 | 2286 | update: (current) |
|
2279 | 2287 | largefiles: (no remote repo) |
|
2280 | 2288 | |
|
2281 | 2289 | check messages when there is no files to upload: |
|
2282 | 2290 | |
|
2283 | 2291 | $ hg -q clone src clone2 |
|
2284 | 2292 | $ hg -R clone2 paths | grep default |
|
2285 | 2293 | default = $TESTTMP/issue3651/src (glob) |
|
2286 | 2294 | |
|
2287 | 2295 | $ hg -R clone2 summary --large |
|
2288 | 2296 | parent: 0:fc0bd45326d3 tip |
|
2289 | 2297 | #0 |
|
2290 | 2298 | branch: default |
|
2291 | 2299 | commit: (clean) |
|
2292 | 2300 | update: (current) |
|
2293 | 2301 | largefiles: (no files to upload) |
|
2294 | 2302 | $ hg -R clone2 outgoing --large |
|
2295 | 2303 | comparing with $TESTTMP/issue3651/src (glob) |
|
2296 | 2304 | searching for changes |
|
2297 | 2305 | no changes found |
|
2298 | 2306 | largefiles: no files to upload |
|
2299 | 2307 | [1] |
|
2300 | 2308 | |
|
2301 | 2309 | $ hg -R clone2 outgoing --large --graph --template "{rev}" |
|
2302 | 2310 | comparing with $TESTTMP/issue3651/src (glob) |
|
2303 | 2311 | searching for changes |
|
2304 | 2312 | no changes found |
|
2305 | 2313 | largefiles: no files to upload |
|
2306 | 2314 | |
|
2307 | 2315 | check messages when there are files to upload: |
|
2308 | 2316 | |
|
2309 | 2317 | $ echo b > clone2/b |
|
2310 | 2318 | $ hg -R clone2 add --large clone2/b |
|
2311 | 2319 | $ hg -R clone2 commit -m '#1' |
|
2312 | 2320 | Invoking status precommit hook |
|
2313 | 2321 | A b |
|
2314 | 2322 | $ hg -R clone2 summary --large |
|
2315 | 2323 | parent: 1:1acbe71ce432 tip |
|
2316 | 2324 | #1 |
|
2317 | 2325 | branch: default |
|
2318 | 2326 | commit: (clean) |
|
2319 | 2327 | update: (current) |
|
2320 | 2328 | largefiles: 1 to upload |
|
2321 | 2329 | $ hg -R clone2 outgoing --large |
|
2322 | 2330 | comparing with $TESTTMP/issue3651/src (glob) |
|
2323 | 2331 | searching for changes |
|
2324 | 2332 | changeset: 1:1acbe71ce432 |
|
2325 | 2333 | tag: tip |
|
2326 | 2334 | user: test |
|
2327 | 2335 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2328 | 2336 | summary: #1 |
|
2329 | 2337 | |
|
2330 | 2338 | largefiles to upload: |
|
2331 | 2339 | b |
|
2332 | 2340 | |
|
2333 | 2341 | $ hg -R clone2 outgoing --large --graph --template "{rev}" |
|
2334 | 2342 | comparing with $TESTTMP/issue3651/src |
|
2335 | 2343 | searching for changes |
|
2336 | 2344 | @ 1 |
|
2337 | 2345 | |
|
2338 | 2346 | largefiles to upload: |
|
2339 | 2347 | b |
|
2340 | 2348 | |
|
2341 | 2349 | |
|
2342 | 2350 | $ cd .. |
|
2343 | 2351 | |
|
2344 | 2352 | merge action 'd' for 'local renamed directory to d2/g' which has no filename |
|
2345 | 2353 | |
|
2346 | 2354 | $ hg init merge-action |
|
2347 | 2355 | $ cd merge-action |
|
2348 | 2356 | $ touch l |
|
2349 | 2357 | $ hg add --large l |
|
2350 | 2358 | $ mkdir d1 |
|
2351 | 2359 | $ touch d1/f |
|
2352 | 2360 | $ hg ci -Aqm0 |
|
2353 | 2361 | Invoking status precommit hook |
|
2354 | 2362 | A d1/f |
|
2355 | 2363 | A l |
|
2356 | 2364 | $ echo > d1/f |
|
2357 | 2365 | $ touch d1/g |
|
2358 | 2366 | $ hg ci -Aqm1 |
|
2359 | 2367 | Invoking status precommit hook |
|
2360 | 2368 | M d1/f |
|
2361 | 2369 | A d1/g |
|
2362 | 2370 | $ hg up -qr0 |
|
2363 | 2371 | $ hg mv d1 d2 |
|
2364 | 2372 | moving d1/f to d2/f (glob) |
|
2365 | 2373 | $ hg ci -qm2 |
|
2366 | 2374 | Invoking status precommit hook |
|
2367 | 2375 | A d2/f |
|
2368 | 2376 | R d1/f |
|
2369 | 2377 | $ hg merge |
|
2370 | 2378 | merging d2/f and d1/f to d2/f |
|
2371 | 2379 | 1 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
2372 | 2380 | (branch merge, don't forget to commit) |
|
2373 | 2381 | getting changed largefiles |
|
2374 | 2382 | 0 largefiles updated, 0 removed |
|
2375 | 2383 | $ cd .. |
|
2376 | 2384 | |
|
2377 | 2385 | |
|
2378 | 2386 | Merge conflicts: |
|
2379 | 2387 | |
|
2380 | 2388 | $ hg init merge |
|
2381 | 2389 | $ cd merge |
|
2382 | 2390 | $ echo 0 > f-different |
|
2383 | 2391 | $ echo 0 > f-same |
|
2384 | 2392 | $ echo 0 > f-unchanged-1 |
|
2385 | 2393 | $ echo 0 > f-unchanged-2 |
|
2386 | 2394 | $ hg add --large * |
|
2387 | 2395 | $ hg ci -m0 |
|
2388 | 2396 | Invoking status precommit hook |
|
2389 | 2397 | A f-different |
|
2390 | 2398 | A f-same |
|
2391 | 2399 | A f-unchanged-1 |
|
2392 | 2400 | A f-unchanged-2 |
|
2393 | 2401 | $ echo tmp1 > f-unchanged-1 |
|
2394 | 2402 | $ echo tmp1 > f-unchanged-2 |
|
2395 | 2403 | $ echo tmp1 > f-same |
|
2396 | 2404 | $ hg ci -m1 |
|
2397 | 2405 | Invoking status precommit hook |
|
2398 | 2406 | M f-same |
|
2399 | 2407 | M f-unchanged-1 |
|
2400 | 2408 | M f-unchanged-2 |
|
2401 | 2409 | $ echo 2 > f-different |
|
2402 | 2410 | $ echo 0 > f-unchanged-1 |
|
2403 | 2411 | $ echo 1 > f-unchanged-2 |
|
2404 | 2412 | $ echo 1 > f-same |
|
2405 | 2413 | $ hg ci -m2 |
|
2406 | 2414 | Invoking status precommit hook |
|
2407 | 2415 | M f-different |
|
2408 | 2416 | M f-same |
|
2409 | 2417 | M f-unchanged-1 |
|
2410 | 2418 | M f-unchanged-2 |
|
2411 | 2419 | $ hg up -qr0 |
|
2412 | 2420 | $ echo tmp2 > f-unchanged-1 |
|
2413 | 2421 | $ echo tmp2 > f-unchanged-2 |
|
2414 | 2422 | $ echo tmp2 > f-same |
|
2415 | 2423 | $ hg ci -m3 |
|
2416 | 2424 | Invoking status precommit hook |
|
2417 | 2425 | M f-same |
|
2418 | 2426 | M f-unchanged-1 |
|
2419 | 2427 | M f-unchanged-2 |
|
2420 | 2428 | created new head |
|
2421 | 2429 | $ echo 1 > f-different |
|
2422 | 2430 | $ echo 1 > f-unchanged-1 |
|
2423 | 2431 | $ echo 0 > f-unchanged-2 |
|
2424 | 2432 | $ echo 1 > f-same |
|
2425 | 2433 | $ hg ci -m4 |
|
2426 | 2434 | Invoking status precommit hook |
|
2427 | 2435 | M f-different |
|
2428 | 2436 | M f-same |
|
2429 | 2437 | M f-unchanged-1 |
|
2430 | 2438 | M f-unchanged-2 |
|
2431 | 2439 | $ hg merge |
|
2432 | 2440 | largefile f-different has a merge conflict |
|
2433 | 2441 | ancestor was 09d2af8dd22201dd8d48e5dcfcaed281ff9422c7 |
|
2434 | 2442 | keep (l)ocal e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e or |
|
2435 | 2443 | take (o)ther 7448d8798a4380162d4b56f9b452e2f6f9e24e7a? l |
|
2436 | 2444 | 0 files updated, 4 files merged, 0 files removed, 0 files unresolved |
|
2437 | 2445 | (branch merge, don't forget to commit) |
|
2438 | 2446 | getting changed largefiles |
|
2439 | 2447 | 1 largefiles updated, 0 removed |
|
2440 | 2448 | $ cat f-different |
|
2441 | 2449 | 1 |
|
2442 | 2450 | $ cat f-same |
|
2443 | 2451 | 1 |
|
2444 | 2452 | $ cat f-unchanged-1 |
|
2445 | 2453 | 1 |
|
2446 | 2454 | $ cat f-unchanged-2 |
|
2447 | 2455 | 1 |
|
2448 | 2456 | $ cd .. |
|
2449 | 2457 | |
|
2450 | 2458 | Check whether "largefiles" feature is supported only in repositories |
|
2451 | 2459 | enabling largefiles extension. |
|
2452 | 2460 | |
|
2453 | 2461 | $ mkdir individualenabling |
|
2454 | 2462 | $ cd individualenabling |
|
2455 | 2463 | |
|
2456 | 2464 | $ hg init enabledlocally |
|
2457 | 2465 | $ echo large > enabledlocally/large |
|
2458 | 2466 | $ hg -R enabledlocally add --large enabledlocally/large |
|
2459 | 2467 | $ hg -R enabledlocally commit -m '#0' |
|
2460 | 2468 | Invoking status precommit hook |
|
2461 | 2469 | A large |
|
2462 | 2470 | |
|
2463 | 2471 | $ hg init notenabledlocally |
|
2464 | 2472 | $ echo large > notenabledlocally/large |
|
2465 | 2473 | $ hg -R notenabledlocally add --large notenabledlocally/large |
|
2466 | 2474 | $ hg -R notenabledlocally commit -m '#0' |
|
2467 | 2475 | Invoking status precommit hook |
|
2468 | 2476 | A large |
|
2469 | 2477 | |
|
2470 | 2478 | $ cat >> $HGRCPATH <<EOF |
|
2471 | 2479 | > [extensions] |
|
2472 | 2480 | > # disable globally |
|
2473 | 2481 | > largefiles=! |
|
2474 | 2482 | > EOF |
|
2475 | 2483 | $ cat >> enabledlocally/.hg/hgrc <<EOF |
|
2476 | 2484 | > [extensions] |
|
2477 | 2485 | > # enable locally |
|
2478 | 2486 | > largefiles= |
|
2479 | 2487 | > EOF |
|
2480 | 2488 | $ hg -R enabledlocally root |
|
2481 | 2489 | $TESTTMP/individualenabling/enabledlocally (glob) |
|
2482 | 2490 | $ hg -R notenabledlocally root |
|
2483 | 2491 | abort: repository requires features unknown to this Mercurial: largefiles! |
|
2484 | 2492 | (see http://mercurial.selenic.com/wiki/MissingRequirement for more information) |
|
2485 | 2493 | [255] |
|
2486 | 2494 | |
|
2487 | 2495 | $ hg init push-dst |
|
2488 | 2496 | $ hg -R enabledlocally push push-dst |
|
2489 | 2497 | pushing to push-dst |
|
2490 | 2498 | abort: required features are not supported in the destination: largefiles |
|
2491 | 2499 | [255] |
|
2492 | 2500 | |
|
2493 | 2501 | $ hg init pull-src |
|
2494 | 2502 | $ hg -R pull-src pull enabledlocally |
|
2495 | 2503 | pulling from enabledlocally |
|
2496 | 2504 | abort: required features are not supported in the destination: largefiles |
|
2497 | 2505 | [255] |
|
2498 | 2506 | |
|
2499 | 2507 | $ hg clone enabledlocally clone-dst |
|
2500 | 2508 | abort: repository requires features unknown to this Mercurial: largefiles! |
|
2501 | 2509 | (see http://mercurial.selenic.com/wiki/MissingRequirement for more information) |
|
2502 | 2510 | [255] |
|
2503 | 2511 | $ test -d clone-dst |
|
2504 | 2512 | [1] |
|
2505 | 2513 | $ hg clone --pull enabledlocally clone-pull-dst |
|
2506 | 2514 | abort: required features are not supported in the destination: largefiles |
|
2507 | 2515 | [255] |
|
2508 | 2516 | $ test -d clone-pull-dst |
|
2509 | 2517 | [1] |
|
2510 | 2518 | |
|
2511 | 2519 | #if serve |
|
2512 | 2520 | |
|
2513 | 2521 | Test largefiles specific peer setup, when largefiles is enabled |
|
2514 | 2522 | locally (issue4109) |
|
2515 | 2523 | |
|
2516 | 2524 | $ hg showconfig extensions | grep largefiles |
|
2517 | 2525 | extensions.largefiles=! |
|
2518 | 2526 | $ mkdir -p $TESTTMP/individualenabling/usercache |
|
2519 | 2527 | |
|
2520 | 2528 | $ hg serve -R enabledlocally -d -p $HGPORT --pid-file hg.pid |
|
2521 | 2529 | $ cat hg.pid >> $DAEMON_PIDS |
|
2522 | 2530 | |
|
2523 | 2531 | $ hg init pull-dst |
|
2524 | 2532 | $ cat > pull-dst/.hg/hgrc <<EOF |
|
2525 | 2533 | > [extensions] |
|
2526 | 2534 | > # enable locally |
|
2527 | 2535 | > largefiles= |
|
2528 | 2536 | > [largefiles] |
|
2529 | 2537 | > # ignore system cache to force largefiles specific wire proto access |
|
2530 | 2538 | > usercache=$TESTTMP/individualenabling/usercache |
|
2531 | 2539 | > EOF |
|
2532 | 2540 | $ hg -R pull-dst -q pull -u http://localhost:$HGPORT |
|
2533 | 2541 | |
|
2534 | 2542 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
|
2535 | 2543 | #endif |
|
2536 | 2544 | |
|
2537 | 2545 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now