##// END OF EJS Templates
largefiles: remove meaningless code path for "hg pull --rebase"...
FUJIWARA Katsunori -
r23183:51c9196a default
parent child Browse files
Show More
@@ -1,1322 +1,1298 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 from mercurial import hg, commands, util, cmdutil, scmutil, match as match_, \
14 from mercurial import hg, util, cmdutil, scmutil, match as match_, \
15 15 archival, pathutil, revset
16 16 from mercurial.i18n import _
17 17 from mercurial.node import hex
18 from hgext import rebase
19 18
20 19 import lfutil
21 20 import lfcommands
22 21 import basestore
23 22
24 23 # -- Utility functions: commonly/repeatedly needed functionality ---------------
25 24
26 25 def installnormalfilesmatchfn(manifest):
27 26 '''installmatchfn with a matchfn that ignores all largefiles'''
28 27 def overridematch(ctx, pats=[], opts={}, globbed=False,
29 28 default='relpath'):
30 29 match = oldmatch(ctx, pats, opts, globbed, default)
31 30 m = copy.copy(match)
32 31 notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in
33 32 manifest)
34 33 m._files = filter(notlfile, m._files)
35 34 m._fmap = set(m._files)
36 35 m._always = False
37 36 origmatchfn = m.matchfn
38 37 m.matchfn = lambda f: notlfile(f) and origmatchfn(f)
39 38 return m
40 39 oldmatch = installmatchfn(overridematch)
41 40
42 41 def installmatchfn(f):
43 42 '''monkey patch the scmutil module with a custom match function.
44 43 Warning: it is monkey patching the _module_ on runtime! Not thread safe!'''
45 44 oldmatch = scmutil.match
46 45 setattr(f, 'oldmatch', oldmatch)
47 46 scmutil.match = f
48 47 return oldmatch
49 48
50 49 def restorematchfn():
51 50 '''restores scmutil.match to what it was before installmatchfn
52 51 was called. no-op if scmutil.match is its original function.
53 52
54 53 Note that n calls to installmatchfn will require n calls to
55 54 restore matchfn to reverse'''
56 55 scmutil.match = getattr(scmutil.match, 'oldmatch')
57 56
58 57 def installmatchandpatsfn(f):
59 58 oldmatchandpats = scmutil.matchandpats
60 59 setattr(f, 'oldmatchandpats', oldmatchandpats)
61 60 scmutil.matchandpats = f
62 61 return oldmatchandpats
63 62
64 63 def restorematchandpatsfn():
65 64 '''restores scmutil.matchandpats to what it was before
66 65 installmatchandpatsfn was called. No-op if scmutil.matchandpats
67 66 is its original function.
68 67
69 68 Note that n calls to installmatchandpatsfn will require n calls
70 69 to restore matchfn to reverse'''
71 70 scmutil.matchandpats = getattr(scmutil.matchandpats, 'oldmatchandpats',
72 71 scmutil.matchandpats)
73 72
74 73 def addlargefiles(ui, repo, *pats, **opts):
75 74 large = opts.pop('large', None)
76 75 lfsize = lfutil.getminsize(
77 76 ui, lfutil.islfilesrepo(repo), opts.pop('lfsize', None))
78 77
79 78 lfmatcher = None
80 79 if lfutil.islfilesrepo(repo):
81 80 lfpats = ui.configlist(lfutil.longname, 'patterns', default=[])
82 81 if lfpats:
83 82 lfmatcher = match_.match(repo.root, '', list(lfpats))
84 83
85 84 lfnames = []
86 85 m = scmutil.match(repo[None], pats, opts)
87 86 m.bad = lambda x, y: None
88 87 wctx = repo[None]
89 88 for f in repo.walk(m):
90 89 exact = m.exact(f)
91 90 lfile = lfutil.standin(f) in wctx
92 91 nfile = f in wctx
93 92 exists = lfile or nfile
94 93
95 94 # Don't warn the user when they attempt to add a normal tracked file.
96 95 # The normal add code will do that for us.
97 96 if exact and exists:
98 97 if lfile:
99 98 ui.warn(_('%s already a largefile\n') % f)
100 99 continue
101 100
102 101 if (exact or not exists) and not lfutil.isstandin(f):
103 102 wfile = repo.wjoin(f)
104 103
105 104 # In case the file was removed previously, but not committed
106 105 # (issue3507)
107 106 if not os.path.exists(wfile):
108 107 continue
109 108
110 109 abovemin = (lfsize and
111 110 os.lstat(wfile).st_size >= lfsize * 1024 * 1024)
112 111 if large or abovemin or (lfmatcher and lfmatcher(f)):
113 112 lfnames.append(f)
114 113 if ui.verbose or not exact:
115 114 ui.status(_('adding %s as a largefile\n') % m.rel(f))
116 115
117 116 bad = []
118 117
119 118 # Need to lock, otherwise there could be a race condition between
120 119 # when standins are created and added to the repo.
121 120 wlock = repo.wlock()
122 121 try:
123 122 if not opts.get('dry_run'):
124 123 standins = []
125 124 lfdirstate = lfutil.openlfdirstate(ui, repo)
126 125 for f in lfnames:
127 126 standinname = lfutil.standin(f)
128 127 lfutil.writestandin(repo, standinname, hash='',
129 128 executable=lfutil.getexecutable(repo.wjoin(f)))
130 129 standins.append(standinname)
131 130 if lfdirstate[f] == 'r':
132 131 lfdirstate.normallookup(f)
133 132 else:
134 133 lfdirstate.add(f)
135 134 lfdirstate.write()
136 135 bad += [lfutil.splitstandin(f)
137 136 for f in repo[None].add(standins)
138 137 if f in m.files()]
139 138 finally:
140 139 wlock.release()
141 140 return bad
142 141
143 142 def removelargefiles(ui, repo, isaddremove, *pats, **opts):
144 143 after = opts.get('after')
145 144 if not pats and not after:
146 145 raise util.Abort(_('no files specified'))
147 146 m = scmutil.match(repo[None], pats, opts)
148 147 try:
149 148 repo.lfstatus = True
150 149 s = repo.status(match=m, clean=True)
151 150 finally:
152 151 repo.lfstatus = False
153 152 manifest = repo[None].manifest()
154 153 modified, added, deleted, clean = [[f for f in list
155 154 if lfutil.standin(f) in manifest]
156 155 for list in (s.modified, s.added,
157 156 s.deleted, s.clean)]
158 157
159 158 def warn(files, msg):
160 159 for f in files:
161 160 ui.warn(msg % m.rel(f))
162 161 return int(len(files) > 0)
163 162
164 163 result = 0
165 164
166 165 if after:
167 166 remove = deleted
168 167 result = warn(modified + added + clean,
169 168 _('not removing %s: file still exists\n'))
170 169 else:
171 170 remove = deleted + clean
172 171 result = warn(modified, _('not removing %s: file is modified (use -f'
173 172 ' to force removal)\n'))
174 173 result = warn(added, _('not removing %s: file has been marked for add'
175 174 ' (use forget to undo)\n')) or result
176 175
177 176 for f in sorted(remove):
178 177 if ui.verbose or not m.exact(f):
179 178 ui.status(_('removing %s\n') % m.rel(f))
180 179
181 180 # Need to lock because standin files are deleted then removed from the
182 181 # repository and we could race in-between.
183 182 wlock = repo.wlock()
184 183 try:
185 184 lfdirstate = lfutil.openlfdirstate(ui, repo)
186 185 for f in remove:
187 186 if not after:
188 187 # If this is being called by addremove, notify the user that we
189 188 # are removing the file.
190 189 if isaddremove:
191 190 ui.status(_('removing %s\n') % f)
192 191 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
193 192 lfdirstate.remove(f)
194 193 lfdirstate.write()
195 194 remove = [lfutil.standin(f) for f in remove]
196 195 # If this is being called by addremove, let the original addremove
197 196 # function handle this.
198 197 if not isaddremove:
199 198 for f in remove:
200 199 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
201 200 repo[None].forget(remove)
202 201 finally:
203 202 wlock.release()
204 203
205 204 return result
206 205
207 206 # For overriding mercurial.hgweb.webcommands so that largefiles will
208 207 # appear at their right place in the manifests.
209 208 def decodepath(orig, path):
210 209 return lfutil.splitstandin(path) or path
211 210
212 211 # -- Wrappers: modify existing commands --------------------------------
213 212
214 213 # Add works by going through the files that the user wanted to add and
215 214 # checking if they should be added as largefiles. Then it makes a new
216 215 # matcher which matches only the normal files and runs the original
217 216 # version of add.
218 217 def overrideadd(orig, ui, repo, *pats, **opts):
219 218 normal = opts.pop('normal')
220 219 if normal:
221 220 if opts.get('large'):
222 221 raise util.Abort(_('--normal cannot be used with --large'))
223 222 return orig(ui, repo, *pats, **opts)
224 223 bad = addlargefiles(ui, repo, *pats, **opts)
225 224 installnormalfilesmatchfn(repo[None].manifest())
226 225 result = orig(ui, repo, *pats, **opts)
227 226 restorematchfn()
228 227
229 228 return (result == 1 or bad) and 1 or 0
230 229
231 230 def overrideremove(orig, ui, repo, *pats, **opts):
232 231 installnormalfilesmatchfn(repo[None].manifest())
233 232 result = orig(ui, repo, *pats, **opts)
234 233 restorematchfn()
235 234 return removelargefiles(ui, repo, False, *pats, **opts) or result
236 235
237 236 def overridestatusfn(orig, repo, rev2, **opts):
238 237 try:
239 238 repo._repo.lfstatus = True
240 239 return orig(repo, rev2, **opts)
241 240 finally:
242 241 repo._repo.lfstatus = False
243 242
244 243 def overridestatus(orig, ui, repo, *pats, **opts):
245 244 try:
246 245 repo.lfstatus = True
247 246 return orig(ui, repo, *pats, **opts)
248 247 finally:
249 248 repo.lfstatus = False
250 249
251 250 def overridedirty(orig, repo, ignoreupdate=False):
252 251 try:
253 252 repo._repo.lfstatus = True
254 253 return orig(repo, ignoreupdate)
255 254 finally:
256 255 repo._repo.lfstatus = False
257 256
258 257 def overridelog(orig, ui, repo, *pats, **opts):
259 258 def overridematchandpats(ctx, pats=[], opts={}, globbed=False,
260 259 default='relpath'):
261 260 """Matcher that merges root directory with .hglf, suitable for log.
262 261 It is still possible to match .hglf directly.
263 262 For any listed files run log on the standin too.
264 263 matchfn tries both the given filename and with .hglf stripped.
265 264 """
266 265 matchandpats = oldmatchandpats(ctx, pats, opts, globbed, default)
267 266 m, p = copy.copy(matchandpats)
268 267
269 268 if m.always():
270 269 # We want to match everything anyway, so there's no benefit trying
271 270 # to add standins.
272 271 return matchandpats
273 272
274 273 pats = set(p)
275 274 # TODO: handling of patterns in both cases below
276 275 if m._cwd:
277 276 if os.path.isabs(m._cwd):
278 277 # TODO: handle largefile magic when invoked from other cwd
279 278 return matchandpats
280 279 back = (m._cwd.count('/') + 1) * '../'
281 280 pats.update(back + lfutil.standin(m._cwd + '/' + f) for f in p)
282 281 else:
283 282 pats.update(lfutil.standin(f) for f in p)
284 283
285 284 for i in range(0, len(m._files)):
286 285 standin = lfutil.standin(m._files[i])
287 286 if standin in repo[ctx.node()]:
288 287 m._files[i] = standin
289 288 elif m._files[i] not in repo[ctx.node()]:
290 289 m._files.append(standin)
291 290 pats.add(standin)
292 291
293 292 m._fmap = set(m._files)
294 293 m._always = False
295 294 origmatchfn = m.matchfn
296 295 def lfmatchfn(f):
297 296 lf = lfutil.splitstandin(f)
298 297 if lf is not None and origmatchfn(lf):
299 298 return True
300 299 r = origmatchfn(f)
301 300 return r
302 301 m.matchfn = lfmatchfn
303 302
304 303 return m, pats
305 304
306 305 # For hg log --patch, the match object is used in two different senses:
307 306 # (1) to determine what revisions should be printed out, and
308 307 # (2) to determine what files to print out diffs for.
309 308 # The magic matchandpats override should be used for case (1) but not for
310 309 # case (2).
311 310 def overridemakelogfilematcher(repo, pats, opts):
312 311 pctx = repo[None]
313 312 match, pats = oldmatchandpats(pctx, pats, opts)
314 313 return lambda rev: match
315 314
316 315 oldmatchandpats = installmatchandpatsfn(overridematchandpats)
317 316 oldmakelogfilematcher = cmdutil._makenofollowlogfilematcher
318 317 setattr(cmdutil, '_makenofollowlogfilematcher', overridemakelogfilematcher)
319 318
320 319 try:
321 320 return orig(ui, repo, *pats, **opts)
322 321 finally:
323 322 restorematchandpatsfn()
324 323 setattr(cmdutil, '_makenofollowlogfilematcher', oldmakelogfilematcher)
325 324
326 325 def overrideverify(orig, ui, repo, *pats, **opts):
327 326 large = opts.pop('large', False)
328 327 all = opts.pop('lfa', False)
329 328 contents = opts.pop('lfc', False)
330 329
331 330 result = orig(ui, repo, *pats, **opts)
332 331 if large or all or contents:
333 332 result = result or lfcommands.verifylfiles(ui, repo, all, contents)
334 333 return result
335 334
336 335 def overridedebugstate(orig, ui, repo, *pats, **opts):
337 336 large = opts.pop('large', False)
338 337 if large:
339 338 class fakerepo(object):
340 339 dirstate = lfutil.openlfdirstate(ui, repo)
341 340 orig(ui, fakerepo, *pats, **opts)
342 341 else:
343 342 orig(ui, repo, *pats, **opts)
344 343
345 344 # Override needs to refresh standins so that update's normal merge
346 345 # will go through properly. Then the other update hook (overriding repo.update)
347 346 # will get the new files. Filemerge is also overridden so that the merge
348 347 # will merge standins correctly.
349 348 def overrideupdate(orig, ui, repo, *pats, **opts):
350 349 # Need to lock between the standins getting updated and their
351 350 # largefiles getting updated
352 351 wlock = repo.wlock()
353 352 try:
354 353 if opts['check']:
355 354 lfdirstate = lfutil.openlfdirstate(ui, repo)
356 355 unsure, s = lfdirstate.status(
357 356 match_.always(repo.root, repo.getcwd()),
358 357 [], False, False, False)
359 358
360 359 mod = len(s.modified) > 0
361 360 for lfile in unsure:
362 361 standin = lfutil.standin(lfile)
363 362 if repo['.'][standin].data().strip() != \
364 363 lfutil.hashfile(repo.wjoin(lfile)):
365 364 mod = True
366 365 else:
367 366 lfdirstate.normal(lfile)
368 367 lfdirstate.write()
369 368 if mod:
370 369 raise util.Abort(_('uncommitted changes'))
371 370 return orig(ui, repo, *pats, **opts)
372 371 finally:
373 372 wlock.release()
374 373
375 374 # Before starting the manifest merge, merge.updates will call
376 375 # _checkunknown to check if there are any files in the merged-in
377 376 # changeset that collide with unknown files in the working copy.
378 377 #
379 378 # The largefiles are seen as unknown, so this prevents us from merging
380 379 # in a file 'foo' if we already have a largefile with the same name.
381 380 #
382 381 # The overridden function filters the unknown files by removing any
383 382 # largefiles. This makes the merge proceed and we can then handle this
384 383 # case further in the overridden manifestmerge function below.
385 384 def overridecheckunknownfile(origfn, repo, wctx, mctx, f):
386 385 if lfutil.standin(repo.dirstate.normalize(f)) in wctx:
387 386 return False
388 387 return origfn(repo, wctx, mctx, f)
389 388
390 389 # The manifest merge handles conflicts on the manifest level. We want
391 390 # to handle changes in largefile-ness of files at this level too.
392 391 #
393 392 # The strategy is to run the original manifestmerge and then process
394 393 # the action list it outputs. There are two cases we need to deal with:
395 394 #
396 395 # 1. Normal file in p1, largefile in p2. Here the largefile is
397 396 # detected via its standin file, which will enter the working copy
398 397 # with a "get" action. It is not "merge" since the standin is all
399 398 # Mercurial is concerned with at this level -- the link to the
400 399 # existing normal file is not relevant here.
401 400 #
402 401 # 2. Largefile in p1, normal file in p2. Here we get a "merge" action
403 402 # since the largefile will be present in the working copy and
404 403 # different from the normal file in p2. Mercurial therefore
405 404 # triggers a merge action.
406 405 #
407 406 # In both cases, we prompt the user and emit new actions to either
408 407 # remove the standin (if the normal file was kept) or to remove the
409 408 # normal file and get the standin (if the largefile was kept). The
410 409 # default prompt answer is to use the largefile version since it was
411 410 # presumably changed on purpose.
412 411 #
413 412 # Finally, the merge.applyupdates function will then take care of
414 413 # writing the files into the working copy and lfcommands.updatelfiles
415 414 # will update the largefiles.
416 415 def overridecalculateupdates(origfn, repo, p1, p2, pas, branchmerge, force,
417 416 partial, acceptremote, followcopies):
418 417 overwrite = force and not branchmerge
419 418 actions = origfn(repo, p1, p2, pas, branchmerge, force, partial,
420 419 acceptremote, followcopies)
421 420
422 421 if overwrite:
423 422 return actions
424 423
425 424 removes = set(a[0] for a in actions['r'])
426 425
427 426 newglist = []
428 427 lfmr = [] # LargeFiles: Mark as Removed
429 428 for action in actions['g']:
430 429 f, args, msg = action
431 430 splitstandin = f and lfutil.splitstandin(f)
432 431 if (splitstandin is not None and
433 432 splitstandin in p1 and splitstandin not in removes):
434 433 # Case 1: normal file in the working copy, largefile in
435 434 # the second parent
436 435 lfile = splitstandin
437 436 standin = f
438 437 msg = _('remote turned local normal file %s into a largefile\n'
439 438 'use (l)argefile or keep (n)ormal file?'
440 439 '$$ &Largefile $$ &Normal file') % lfile
441 440 if repo.ui.promptchoice(msg, 0) == 0:
442 441 actions['r'].append((lfile, None, msg))
443 442 newglist.append((standin, (p2.flags(standin),), msg))
444 443 else:
445 444 actions['r'].append((standin, None, msg))
446 445 elif lfutil.standin(f) in p1 and lfutil.standin(f) not in removes:
447 446 # Case 2: largefile in the working copy, normal file in
448 447 # the second parent
449 448 standin = lfutil.standin(f)
450 449 lfile = f
451 450 msg = _('remote turned local largefile %s into a normal file\n'
452 451 'keep (l)argefile or use (n)ormal file?'
453 452 '$$ &Largefile $$ &Normal file') % lfile
454 453 if repo.ui.promptchoice(msg, 0) == 0:
455 454 if branchmerge:
456 455 # largefile can be restored from standin safely
457 456 actions['r'].append((lfile, None, msg))
458 457 else:
459 458 # "lfile" should be marked as "removed" without
460 459 # removal of itself
461 460 lfmr.append((lfile, None, msg))
462 461
463 462 # linear-merge should treat this largefile as 're-added'
464 463 actions['a'].append((standin, None, msg))
465 464 else:
466 465 actions['r'].append((standin, None, msg))
467 466 newglist.append((lfile, (p2.flags(lfile),), msg))
468 467 else:
469 468 newglist.append(action)
470 469
471 470 newglist.sort()
472 471 actions['g'] = newglist
473 472 if lfmr:
474 473 lfmr.sort()
475 474 actions['lfmr'] = lfmr
476 475
477 476 return actions
478 477
479 478 def mergerecordupdates(orig, repo, actions, branchmerge):
480 479 if 'lfmr' in actions:
481 480 # this should be executed before 'orig', to execute 'remove'
482 481 # before all other actions
483 482 for lfile, args, msg in actions['lfmr']:
484 483 repo.dirstate.remove(lfile)
485 484
486 485 return orig(repo, actions, branchmerge)
487 486
488 487
489 488 # Override filemerge to prompt the user about how they wish to merge
490 489 # largefiles. This will handle identical edits without prompting the user.
491 490 def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca, labels=None):
492 491 if not lfutil.isstandin(orig):
493 492 return origfn(repo, mynode, orig, fcd, fco, fca, labels=labels)
494 493
495 494 ahash = fca.data().strip().lower()
496 495 dhash = fcd.data().strip().lower()
497 496 ohash = fco.data().strip().lower()
498 497 if (ohash != ahash and
499 498 ohash != dhash and
500 499 (dhash == ahash or
501 500 repo.ui.promptchoice(
502 501 _('largefile %s has a merge conflict\nancestor was %s\n'
503 502 'keep (l)ocal %s or\ntake (o)ther %s?'
504 503 '$$ &Local $$ &Other') %
505 504 (lfutil.splitstandin(orig), ahash, dhash, ohash),
506 505 0) == 1)):
507 506 repo.wwrite(fcd.path(), fco.data(), fco.flags())
508 507 return 0
509 508
510 509 # Copy first changes the matchers to match standins instead of
511 510 # largefiles. Then it overrides util.copyfile in that function it
512 511 # checks if the destination largefile already exists. It also keeps a
513 512 # list of copied files so that the largefiles can be copied and the
514 513 # dirstate updated.
515 514 def overridecopy(orig, ui, repo, pats, opts, rename=False):
516 515 # doesn't remove largefile on rename
517 516 if len(pats) < 2:
518 517 # this isn't legal, let the original function deal with it
519 518 return orig(ui, repo, pats, opts, rename)
520 519
521 520 def makestandin(relpath):
522 521 path = pathutil.canonpath(repo.root, repo.getcwd(), relpath)
523 522 return os.path.join(repo.wjoin(lfutil.standin(path)))
524 523
525 524 fullpats = scmutil.expandpats(pats)
526 525 dest = fullpats[-1]
527 526
528 527 if os.path.isdir(dest):
529 528 if not os.path.isdir(makestandin(dest)):
530 529 os.makedirs(makestandin(dest))
531 530 # This could copy both lfiles and normal files in one command,
532 531 # but we don't want to do that. First replace their matcher to
533 532 # only match normal files and run it, then replace it to just
534 533 # match largefiles and run it again.
535 534 nonormalfiles = False
536 535 nolfiles = False
537 536 installnormalfilesmatchfn(repo[None].manifest())
538 537 try:
539 538 try:
540 539 result = orig(ui, repo, pats, opts, rename)
541 540 except util.Abort, e:
542 541 if str(e) != _('no files to copy'):
543 542 raise e
544 543 else:
545 544 nonormalfiles = True
546 545 result = 0
547 546 finally:
548 547 restorematchfn()
549 548
550 549 # The first rename can cause our current working directory to be removed.
551 550 # In that case there is nothing left to copy/rename so just quit.
552 551 try:
553 552 repo.getcwd()
554 553 except OSError:
555 554 return result
556 555
557 556 try:
558 557 try:
559 558 # When we call orig below it creates the standins but we don't add
560 559 # them to the dir state until later so lock during that time.
561 560 wlock = repo.wlock()
562 561
563 562 manifest = repo[None].manifest()
564 563 def overridematch(ctx, pats=[], opts={}, globbed=False,
565 564 default='relpath'):
566 565 newpats = []
567 566 # The patterns were previously mangled to add the standin
568 567 # directory; we need to remove that now
569 568 for pat in pats:
570 569 if match_.patkind(pat) is None and lfutil.shortname in pat:
571 570 newpats.append(pat.replace(lfutil.shortname, ''))
572 571 else:
573 572 newpats.append(pat)
574 573 match = oldmatch(ctx, newpats, opts, globbed, default)
575 574 m = copy.copy(match)
576 575 lfile = lambda f: lfutil.standin(f) in manifest
577 576 m._files = [lfutil.standin(f) for f in m._files if lfile(f)]
578 577 m._fmap = set(m._files)
579 578 origmatchfn = m.matchfn
580 579 m.matchfn = lambda f: (lfutil.isstandin(f) and
581 580 (f in manifest) and
582 581 origmatchfn(lfutil.splitstandin(f)) or
583 582 None)
584 583 return m
585 584 oldmatch = installmatchfn(overridematch)
586 585 listpats = []
587 586 for pat in pats:
588 587 if match_.patkind(pat) is not None:
589 588 listpats.append(pat)
590 589 else:
591 590 listpats.append(makestandin(pat))
592 591
593 592 try:
594 593 origcopyfile = util.copyfile
595 594 copiedfiles = []
596 595 def overridecopyfile(src, dest):
597 596 if (lfutil.shortname in src and
598 597 dest.startswith(repo.wjoin(lfutil.shortname))):
599 598 destlfile = dest.replace(lfutil.shortname, '')
600 599 if not opts['force'] and os.path.exists(destlfile):
601 600 raise IOError('',
602 601 _('destination largefile already exists'))
603 602 copiedfiles.append((src, dest))
604 603 origcopyfile(src, dest)
605 604
606 605 util.copyfile = overridecopyfile
607 606 result += orig(ui, repo, listpats, opts, rename)
608 607 finally:
609 608 util.copyfile = origcopyfile
610 609
611 610 lfdirstate = lfutil.openlfdirstate(ui, repo)
612 611 for (src, dest) in copiedfiles:
613 612 if (lfutil.shortname in src and
614 613 dest.startswith(repo.wjoin(lfutil.shortname))):
615 614 srclfile = src.replace(repo.wjoin(lfutil.standin('')), '')
616 615 destlfile = dest.replace(repo.wjoin(lfutil.standin('')), '')
617 616 destlfiledir = os.path.dirname(repo.wjoin(destlfile)) or '.'
618 617 if not os.path.isdir(destlfiledir):
619 618 os.makedirs(destlfiledir)
620 619 if rename:
621 620 os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile))
622 621
623 622 # The file is gone, but this deletes any empty parent
624 623 # directories as a side-effect.
625 624 util.unlinkpath(repo.wjoin(srclfile), True)
626 625 lfdirstate.remove(srclfile)
627 626 else:
628 627 util.copyfile(repo.wjoin(srclfile),
629 628 repo.wjoin(destlfile))
630 629
631 630 lfdirstate.add(destlfile)
632 631 lfdirstate.write()
633 632 except util.Abort, e:
634 633 if str(e) != _('no files to copy'):
635 634 raise e
636 635 else:
637 636 nolfiles = True
638 637 finally:
639 638 restorematchfn()
640 639 wlock.release()
641 640
642 641 if nolfiles and nonormalfiles:
643 642 raise util.Abort(_('no files to copy'))
644 643
645 644 return result
646 645
647 646 # When the user calls revert, we have to be careful to not revert any
648 647 # changes to other largefiles accidentally. This means we have to keep
649 648 # track of the largefiles that are being reverted so we only pull down
650 649 # the necessary largefiles.
651 650 #
652 651 # Standins are only updated (to match the hash of largefiles) before
653 652 # commits. Update the standins then run the original revert, changing
654 653 # the matcher to hit standins instead of largefiles. Based on the
655 654 # resulting standins update the largefiles.
656 655 def overriderevert(orig, ui, repo, *pats, **opts):
657 656 # Because we put the standins in a bad state (by updating them)
658 657 # and then return them to a correct state we need to lock to
659 658 # prevent others from changing them in their incorrect state.
660 659 wlock = repo.wlock()
661 660 try:
662 661 lfdirstate = lfutil.openlfdirstate(ui, repo)
663 662 s = lfutil.lfdirstatestatus(lfdirstate, repo)
664 663 lfdirstate.write()
665 664 for lfile in s.modified:
666 665 lfutil.updatestandin(repo, lfutil.standin(lfile))
667 666 for lfile in s.deleted:
668 667 if (os.path.exists(repo.wjoin(lfutil.standin(lfile)))):
669 668 os.unlink(repo.wjoin(lfutil.standin(lfile)))
670 669
671 670 oldstandins = lfutil.getstandinsstate(repo)
672 671
673 672 def overridematch(ctx, pats=[], opts={}, globbed=False,
674 673 default='relpath'):
675 674 match = oldmatch(ctx, pats, opts, globbed, default)
676 675 m = copy.copy(match)
677 676 def tostandin(f):
678 677 if lfutil.standin(f) in ctx:
679 678 return lfutil.standin(f)
680 679 elif lfutil.standin(f) in repo[None]:
681 680 return None
682 681 return f
683 682 m._files = [tostandin(f) for f in m._files]
684 683 m._files = [f for f in m._files if f is not None]
685 684 m._fmap = set(m._files)
686 685 origmatchfn = m.matchfn
687 686 def matchfn(f):
688 687 if lfutil.isstandin(f):
689 688 return (origmatchfn(lfutil.splitstandin(f)) and
690 689 (f in repo[None] or f in ctx))
691 690 return origmatchfn(f)
692 691 m.matchfn = matchfn
693 692 return m
694 693 oldmatch = installmatchfn(overridematch)
695 694 try:
696 695 orig(ui, repo, *pats, **opts)
697 696 finally:
698 697 restorematchfn()
699 698
700 699 newstandins = lfutil.getstandinsstate(repo)
701 700 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
702 701 # lfdirstate should be 'normallookup'-ed for updated files,
703 702 # because reverting doesn't touch dirstate for 'normal' files
704 703 # when target revision is explicitly specified: in such case,
705 704 # 'n' and valid timestamp in dirstate doesn't ensure 'clean'
706 705 # of target (standin) file.
707 706 lfcommands.updatelfiles(ui, repo, filelist, printmessage=False,
708 707 normallookup=True)
709 708
710 709 finally:
711 710 wlock.release()
712 711
713 # When we rebase a repository with remotely changed largefiles, we need to
714 # take some extra care so that the largefiles are correctly updated in the
715 # working copy
712 # after pulling changesets, we need to take some extra care to get
713 # largefiles updated remotely
716 714 def overridepull(orig, ui, repo, source=None, **opts):
717 715 revsprepull = len(repo)
718 716 if not source:
719 717 source = 'default'
720 718 repo.lfpullsource = source
721 if opts.get('rebase', False):
722 repo._isrebasing = True
723 try:
724 if opts.get('update'):
725 del opts['update']
726 ui.debug('--update and --rebase are not compatible, ignoring '
727 'the update flag\n')
728 del opts['rebase']
729 origpostincoming = commands.postincoming
730 def _dummy(*args, **kwargs):
731 pass
732 commands.postincoming = _dummy
733 try:
734 result = commands.pull(ui, repo, source, **opts)
735 finally:
736 commands.postincoming = origpostincoming
737 revspostpull = len(repo)
738 if revspostpull > revsprepull:
739 result = result or rebase.rebase(ui, repo)
740 finally:
741 repo._isrebasing = False
742 else:
743 719 result = orig(ui, repo, source, **opts)
744 720 revspostpull = len(repo)
745 721 lfrevs = opts.get('lfrev', [])
746 722 if opts.get('all_largefiles'):
747 723 lfrevs.append('pulled()')
748 724 if lfrevs and revspostpull > revsprepull:
749 725 numcached = 0
750 726 repo.firstpulled = revsprepull # for pulled() revset expression
751 727 try:
752 728 for rev in scmutil.revrange(repo, lfrevs):
753 729 ui.note(_('pulling largefiles for revision %s\n') % rev)
754 730 (cached, missing) = lfcommands.cachelfiles(ui, repo, rev)
755 731 numcached += len(cached)
756 732 finally:
757 733 del repo.firstpulled
758 734 ui.status(_("%d largefiles cached\n") % numcached)
759 735 return result
760 736
761 737 def pulledrevsetsymbol(repo, subset, x):
762 738 """``pulled()``
763 739 Changesets that just has been pulled.
764 740
765 741 Only available with largefiles from pull --lfrev expressions.
766 742
767 743 .. container:: verbose
768 744
769 745 Some examples:
770 746
771 747 - pull largefiles for all new changesets::
772 748
773 749 hg pull -lfrev "pulled()"
774 750
775 751 - pull largefiles for all new branch heads::
776 752
777 753 hg pull -lfrev "head(pulled()) and not closed()"
778 754
779 755 """
780 756
781 757 try:
782 758 firstpulled = repo.firstpulled
783 759 except AttributeError:
784 760 raise util.Abort(_("pulled() only available in --lfrev"))
785 761 return revset.baseset([r for r in subset if r >= firstpulled])
786 762
787 763 def overrideclone(orig, ui, source, dest=None, **opts):
788 764 d = dest
789 765 if d is None:
790 766 d = hg.defaultdest(source)
791 767 if opts.get('all_largefiles') and not hg.islocal(d):
792 768 raise util.Abort(_(
793 769 '--all-largefiles is incompatible with non-local destination %s') %
794 770 d)
795 771
796 772 return orig(ui, source, dest, **opts)
797 773
798 774 def hgclone(orig, ui, opts, *args, **kwargs):
799 775 result = orig(ui, opts, *args, **kwargs)
800 776
801 777 if result is not None:
802 778 sourcerepo, destrepo = result
803 779 repo = destrepo.local()
804 780
805 781 # Caching is implicitly limited to 'rev' option, since the dest repo was
806 782 # truncated at that point. The user may expect a download count with
807 783 # this option, so attempt whether or not this is a largefile repo.
808 784 if opts.get('all_largefiles'):
809 785 success, missing = lfcommands.downloadlfiles(ui, repo, None)
810 786
811 787 if missing != 0:
812 788 return None
813 789
814 790 return result
815 791
816 792 def overriderebase(orig, ui, repo, **opts):
817 793 repo._isrebasing = True
818 794 try:
819 795 return orig(ui, repo, **opts)
820 796 finally:
821 797 repo._isrebasing = False
822 798
823 799 def overridearchive(orig, repo, dest, node, kind, decode=True, matchfn=None,
824 800 prefix=None, mtime=None, subrepos=None):
825 801 # No need to lock because we are only reading history and
826 802 # largefile caches, neither of which are modified.
827 803 lfcommands.cachelfiles(repo.ui, repo, node)
828 804
829 805 if kind not in archival.archivers:
830 806 raise util.Abort(_("unknown archive type '%s'") % kind)
831 807
832 808 ctx = repo[node]
833 809
834 810 if kind == 'files':
835 811 if prefix:
836 812 raise util.Abort(
837 813 _('cannot give prefix when archiving to files'))
838 814 else:
839 815 prefix = archival.tidyprefix(dest, kind, prefix)
840 816
841 817 def write(name, mode, islink, getdata):
842 818 if matchfn and not matchfn(name):
843 819 return
844 820 data = getdata()
845 821 if decode:
846 822 data = repo.wwritedata(name, data)
847 823 archiver.addfile(prefix + name, mode, islink, data)
848 824
849 825 archiver = archival.archivers[kind](dest, mtime or ctx.date()[0])
850 826
851 827 if repo.ui.configbool("ui", "archivemeta", True):
852 828 def metadata():
853 829 base = 'repo: %s\nnode: %s\nbranch: %s\n' % (
854 830 hex(repo.changelog.node(0)), hex(node), ctx.branch())
855 831
856 832 tags = ''.join('tag: %s\n' % t for t in ctx.tags()
857 833 if repo.tagtype(t) == 'global')
858 834 if not tags:
859 835 repo.ui.pushbuffer()
860 836 opts = {'template': '{latesttag}\n{latesttagdistance}',
861 837 'style': '', 'patch': None, 'git': None}
862 838 cmdutil.show_changeset(repo.ui, repo, opts).show(ctx)
863 839 ltags, dist = repo.ui.popbuffer().split('\n')
864 840 tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':'))
865 841 tags += 'latesttagdistance: %s\n' % dist
866 842
867 843 return base + tags
868 844
869 845 write('.hg_archival.txt', 0644, False, metadata)
870 846
871 847 for f in ctx:
872 848 ff = ctx.flags(f)
873 849 getdata = ctx[f].data
874 850 if lfutil.isstandin(f):
875 851 path = lfutil.findfile(repo, getdata().strip())
876 852 if path is None:
877 853 raise util.Abort(
878 854 _('largefile %s not found in repo store or system cache')
879 855 % lfutil.splitstandin(f))
880 856 f = lfutil.splitstandin(f)
881 857
882 858 def getdatafn():
883 859 fd = None
884 860 try:
885 861 fd = open(path, 'rb')
886 862 return fd.read()
887 863 finally:
888 864 if fd:
889 865 fd.close()
890 866
891 867 getdata = getdatafn
892 868 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata)
893 869
894 870 if subrepos:
895 871 for subpath in sorted(ctx.substate):
896 872 sub = ctx.sub(subpath)
897 873 submatch = match_.narrowmatcher(subpath, matchfn)
898 874 sub.archive(repo.ui, archiver, prefix, submatch)
899 875
900 876 archiver.done()
901 877
902 878 def hgsubrepoarchive(orig, repo, ui, archiver, prefix, match=None):
903 879 repo._get(repo._state + ('hg',))
904 880 rev = repo._state[1]
905 881 ctx = repo._repo[rev]
906 882
907 883 lfcommands.cachelfiles(ui, repo._repo, ctx.node())
908 884
909 885 def write(name, mode, islink, getdata):
910 886 # At this point, the standin has been replaced with the largefile name,
911 887 # so the normal matcher works here without the lfutil variants.
912 888 if match and not match(f):
913 889 return
914 890 data = getdata()
915 891
916 892 archiver.addfile(prefix + repo._path + '/' + name, mode, islink, data)
917 893
918 894 for f in ctx:
919 895 ff = ctx.flags(f)
920 896 getdata = ctx[f].data
921 897 if lfutil.isstandin(f):
922 898 path = lfutil.findfile(repo._repo, getdata().strip())
923 899 if path is None:
924 900 raise util.Abort(
925 901 _('largefile %s not found in repo store or system cache')
926 902 % lfutil.splitstandin(f))
927 903 f = lfutil.splitstandin(f)
928 904
929 905 def getdatafn():
930 906 fd = None
931 907 try:
932 908 fd = open(os.path.join(prefix, path), 'rb')
933 909 return fd.read()
934 910 finally:
935 911 if fd:
936 912 fd.close()
937 913
938 914 getdata = getdatafn
939 915
940 916 write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata)
941 917
942 918 for subpath in sorted(ctx.substate):
943 919 sub = ctx.sub(subpath)
944 920 submatch = match_.narrowmatcher(subpath, match)
945 921 sub.archive(ui, archiver, os.path.join(prefix, repo._path) + '/',
946 922 submatch)
947 923
948 924 # If a largefile is modified, the change is not reflected in its
949 925 # standin until a commit. cmdutil.bailifchanged() raises an exception
950 926 # if the repo has uncommitted changes. Wrap it to also check if
951 927 # largefiles were changed. This is used by bisect and backout.
952 928 def overridebailifchanged(orig, repo):
953 929 orig(repo)
954 930 repo.lfstatus = True
955 931 s = repo.status()
956 932 repo.lfstatus = False
957 933 if s.modified or s.added or s.removed or s.deleted:
958 934 raise util.Abort(_('uncommitted changes'))
959 935
960 936 # Fetch doesn't use cmdutil.bailifchanged so override it to add the check
961 937 def overridefetch(orig, ui, repo, *pats, **opts):
962 938 repo.lfstatus = True
963 939 s = repo.status()
964 940 repo.lfstatus = False
965 941 if s.modified or s.added or s.removed or s.deleted:
966 942 raise util.Abort(_('uncommitted changes'))
967 943 return orig(ui, repo, *pats, **opts)
968 944
969 945 def overrideforget(orig, ui, repo, *pats, **opts):
970 946 installnormalfilesmatchfn(repo[None].manifest())
971 947 result = orig(ui, repo, *pats, **opts)
972 948 restorematchfn()
973 949 m = scmutil.match(repo[None], pats, opts)
974 950
975 951 try:
976 952 repo.lfstatus = True
977 953 s = repo.status(match=m, clean=True)
978 954 finally:
979 955 repo.lfstatus = False
980 956 forget = sorted(s.modified + s.added + s.deleted + s.clean)
981 957 forget = [f for f in forget if lfutil.standin(f) in repo[None].manifest()]
982 958
983 959 for f in forget:
984 960 if lfutil.standin(f) not in repo.dirstate and not \
985 961 os.path.isdir(m.rel(lfutil.standin(f))):
986 962 ui.warn(_('not removing %s: file is already untracked\n')
987 963 % m.rel(f))
988 964 result = 1
989 965
990 966 for f in forget:
991 967 if ui.verbose or not m.exact(f):
992 968 ui.status(_('removing %s\n') % m.rel(f))
993 969
994 970 # Need to lock because standin files are deleted then removed from the
995 971 # repository and we could race in-between.
996 972 wlock = repo.wlock()
997 973 try:
998 974 lfdirstate = lfutil.openlfdirstate(ui, repo)
999 975 for f in forget:
1000 976 if lfdirstate[f] == 'a':
1001 977 lfdirstate.drop(f)
1002 978 else:
1003 979 lfdirstate.remove(f)
1004 980 lfdirstate.write()
1005 981 standins = [lfutil.standin(f) for f in forget]
1006 982 for f in standins:
1007 983 util.unlinkpath(repo.wjoin(f), ignoremissing=True)
1008 984 repo[None].forget(standins)
1009 985 finally:
1010 986 wlock.release()
1011 987
1012 988 return result
1013 989
1014 990 def _getoutgoings(repo, other, missing, addfunc):
1015 991 """get pairs of filename and largefile hash in outgoing revisions
1016 992 in 'missing'.
1017 993
1018 994 largefiles already existing on 'other' repository are ignored.
1019 995
1020 996 'addfunc' is invoked with each unique pairs of filename and
1021 997 largefile hash value.
1022 998 """
1023 999 knowns = set()
1024 1000 lfhashes = set()
1025 1001 def dedup(fn, lfhash):
1026 1002 k = (fn, lfhash)
1027 1003 if k not in knowns:
1028 1004 knowns.add(k)
1029 1005 lfhashes.add(lfhash)
1030 1006 lfutil.getlfilestoupload(repo, missing, dedup)
1031 1007 if lfhashes:
1032 1008 lfexists = basestore._openstore(repo, other).exists(lfhashes)
1033 1009 for fn, lfhash in knowns:
1034 1010 if not lfexists[lfhash]: # lfhash doesn't exist on "other"
1035 1011 addfunc(fn, lfhash)
1036 1012
1037 1013 def outgoinghook(ui, repo, other, opts, missing):
1038 1014 if opts.pop('large', None):
1039 1015 lfhashes = set()
1040 1016 if ui.debugflag:
1041 1017 toupload = {}
1042 1018 def addfunc(fn, lfhash):
1043 1019 if fn not in toupload:
1044 1020 toupload[fn] = []
1045 1021 toupload[fn].append(lfhash)
1046 1022 lfhashes.add(lfhash)
1047 1023 def showhashes(fn):
1048 1024 for lfhash in sorted(toupload[fn]):
1049 1025 ui.debug(' %s\n' % (lfhash))
1050 1026 else:
1051 1027 toupload = set()
1052 1028 def addfunc(fn, lfhash):
1053 1029 toupload.add(fn)
1054 1030 lfhashes.add(lfhash)
1055 1031 def showhashes(fn):
1056 1032 pass
1057 1033 _getoutgoings(repo, other, missing, addfunc)
1058 1034
1059 1035 if not toupload:
1060 1036 ui.status(_('largefiles: no files to upload\n'))
1061 1037 else:
1062 1038 ui.status(_('largefiles to upload (%d entities):\n')
1063 1039 % (len(lfhashes)))
1064 1040 for file in sorted(toupload):
1065 1041 ui.status(lfutil.splitstandin(file) + '\n')
1066 1042 showhashes(file)
1067 1043 ui.status('\n')
1068 1044
1069 1045 def summaryremotehook(ui, repo, opts, changes):
1070 1046 largeopt = opts.get('large', False)
1071 1047 if changes is None:
1072 1048 if largeopt:
1073 1049 return (False, True) # only outgoing check is needed
1074 1050 else:
1075 1051 return (False, False)
1076 1052 elif largeopt:
1077 1053 url, branch, peer, outgoing = changes[1]
1078 1054 if peer is None:
1079 1055 # i18n: column positioning for "hg summary"
1080 1056 ui.status(_('largefiles: (no remote repo)\n'))
1081 1057 return
1082 1058
1083 1059 toupload = set()
1084 1060 lfhashes = set()
1085 1061 def addfunc(fn, lfhash):
1086 1062 toupload.add(fn)
1087 1063 lfhashes.add(lfhash)
1088 1064 _getoutgoings(repo, peer, outgoing.missing, addfunc)
1089 1065
1090 1066 if not toupload:
1091 1067 # i18n: column positioning for "hg summary"
1092 1068 ui.status(_('largefiles: (no files to upload)\n'))
1093 1069 else:
1094 1070 # i18n: column positioning for "hg summary"
1095 1071 ui.status(_('largefiles: %d entities for %d files to upload\n')
1096 1072 % (len(lfhashes), len(toupload)))
1097 1073
1098 1074 def overridesummary(orig, ui, repo, *pats, **opts):
1099 1075 try:
1100 1076 repo.lfstatus = True
1101 1077 orig(ui, repo, *pats, **opts)
1102 1078 finally:
1103 1079 repo.lfstatus = False
1104 1080
1105 1081 def scmutiladdremove(orig, repo, pats=[], opts={}, dry_run=None,
1106 1082 similarity=None):
1107 1083 if not lfutil.islfilesrepo(repo):
1108 1084 return orig(repo, pats, opts, dry_run, similarity)
1109 1085 # Get the list of missing largefiles so we can remove them
1110 1086 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1111 1087 unsure, s = lfdirstate.status(match_.always(repo.root, repo.getcwd()), [],
1112 1088 False, False, False)
1113 1089
1114 1090 # Call into the normal remove code, but the removing of the standin, we want
1115 1091 # to have handled by original addremove. Monkey patching here makes sure
1116 1092 # we don't remove the standin in the largefiles code, preventing a very
1117 1093 # confused state later.
1118 1094 if s.deleted:
1119 1095 m = [repo.wjoin(f) for f in s.deleted]
1120 1096 removelargefiles(repo.ui, repo, True, *m, **opts)
1121 1097 # Call into the normal add code, and any files that *should* be added as
1122 1098 # largefiles will be
1123 1099 addlargefiles(repo.ui, repo, *pats, **opts)
1124 1100 # Now that we've handled largefiles, hand off to the original addremove
1125 1101 # function to take care of the rest. Make sure it doesn't do anything with
1126 1102 # largefiles by installing a matcher that will ignore them.
1127 1103 installnormalfilesmatchfn(repo[None].manifest())
1128 1104 result = orig(repo, pats, opts, dry_run, similarity)
1129 1105 restorematchfn()
1130 1106 return result
1131 1107
1132 1108 # Calling purge with --all will cause the largefiles to be deleted.
1133 1109 # Override repo.status to prevent this from happening.
1134 1110 def overridepurge(orig, ui, repo, *dirs, **opts):
1135 1111 # XXX large file status is buggy when used on repo proxy.
1136 1112 # XXX this needs to be investigate.
1137 1113 repo = repo.unfiltered()
1138 1114 oldstatus = repo.status
1139 1115 def overridestatus(node1='.', node2=None, match=None, ignored=False,
1140 1116 clean=False, unknown=False, listsubrepos=False):
1141 1117 r = oldstatus(node1, node2, match, ignored, clean, unknown,
1142 1118 listsubrepos)
1143 1119 lfdirstate = lfutil.openlfdirstate(ui, repo)
1144 1120 unknown = [f for f in r.unknown if lfdirstate[f] == '?']
1145 1121 ignored = [f for f in r.ignored if lfdirstate[f] == '?']
1146 1122 return scmutil.status(r.modified, r.added, r.removed, r.deleted,
1147 1123 unknown, ignored, r.clean)
1148 1124 repo.status = overridestatus
1149 1125 orig(ui, repo, *dirs, **opts)
1150 1126 repo.status = oldstatus
1151 1127 def overriderollback(orig, ui, repo, **opts):
1152 1128 wlock = repo.wlock()
1153 1129 try:
1154 1130 before = repo.dirstate.parents()
1155 1131 orphans = set(f for f in repo.dirstate
1156 1132 if lfutil.isstandin(f) and repo.dirstate[f] != 'r')
1157 1133 result = orig(ui, repo, **opts)
1158 1134 after = repo.dirstate.parents()
1159 1135 if before == after:
1160 1136 return result # no need to restore standins
1161 1137
1162 1138 pctx = repo['.']
1163 1139 for f in repo.dirstate:
1164 1140 if lfutil.isstandin(f):
1165 1141 orphans.discard(f)
1166 1142 if repo.dirstate[f] == 'r':
1167 1143 repo.wvfs.unlinkpath(f, ignoremissing=True)
1168 1144 elif f in pctx:
1169 1145 fctx = pctx[f]
1170 1146 repo.wwrite(f, fctx.data(), fctx.flags())
1171 1147 else:
1172 1148 # content of standin is not so important in 'a',
1173 1149 # 'm' or 'n' (coming from the 2nd parent) cases
1174 1150 lfutil.writestandin(repo, f, '', False)
1175 1151 for standin in orphans:
1176 1152 repo.wvfs.unlinkpath(standin, ignoremissing=True)
1177 1153
1178 1154 lfdirstate = lfutil.openlfdirstate(ui, repo)
1179 1155 orphans = set(lfdirstate)
1180 1156 lfiles = lfutil.listlfiles(repo)
1181 1157 for file in lfiles:
1182 1158 lfutil.synclfdirstate(repo, lfdirstate, file, True)
1183 1159 orphans.discard(file)
1184 1160 for lfile in orphans:
1185 1161 lfdirstate.drop(lfile)
1186 1162 lfdirstate.write()
1187 1163 finally:
1188 1164 wlock.release()
1189 1165 return result
1190 1166
1191 1167 def overridetransplant(orig, ui, repo, *revs, **opts):
1192 1168 try:
1193 1169 oldstandins = lfutil.getstandinsstate(repo)
1194 1170 repo._istransplanting = True
1195 1171 result = orig(ui, repo, *revs, **opts)
1196 1172 newstandins = lfutil.getstandinsstate(repo)
1197 1173 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
1198 1174 lfcommands.updatelfiles(repo.ui, repo, filelist=filelist,
1199 1175 printmessage=True)
1200 1176 finally:
1201 1177 repo._istransplanting = False
1202 1178 return result
1203 1179
1204 1180 def overridecat(orig, ui, repo, file1, *pats, **opts):
1205 1181 ctx = scmutil.revsingle(repo, opts.get('rev'))
1206 1182 err = 1
1207 1183 notbad = set()
1208 1184 m = scmutil.match(ctx, (file1,) + pats, opts)
1209 1185 origmatchfn = m.matchfn
1210 1186 def lfmatchfn(f):
1211 1187 if origmatchfn(f):
1212 1188 return True
1213 1189 lf = lfutil.splitstandin(f)
1214 1190 if lf is None:
1215 1191 return False
1216 1192 notbad.add(lf)
1217 1193 return origmatchfn(lf)
1218 1194 m.matchfn = lfmatchfn
1219 1195 origbadfn = m.bad
1220 1196 def lfbadfn(f, msg):
1221 1197 if not f in notbad:
1222 1198 origbadfn(f, msg)
1223 1199 m.bad = lfbadfn
1224 1200 for f in ctx.walk(m):
1225 1201 fp = cmdutil.makefileobj(repo, opts.get('output'), ctx.node(),
1226 1202 pathname=f)
1227 1203 lf = lfutil.splitstandin(f)
1228 1204 if lf is None or origmatchfn(f):
1229 1205 # duplicating unreachable code from commands.cat
1230 1206 data = ctx[f].data()
1231 1207 if opts.get('decode'):
1232 1208 data = repo.wwritedata(f, data)
1233 1209 fp.write(data)
1234 1210 else:
1235 1211 hash = lfutil.readstandin(repo, lf, ctx.rev())
1236 1212 if not lfutil.inusercache(repo.ui, hash):
1237 1213 store = basestore._openstore(repo)
1238 1214 success, missing = store.get([(lf, hash)])
1239 1215 if len(success) != 1:
1240 1216 raise util.Abort(
1241 1217 _('largefile %s is not in cache and could not be '
1242 1218 'downloaded') % lf)
1243 1219 path = lfutil.usercachepath(repo.ui, hash)
1244 1220 fpin = open(path, "rb")
1245 1221 for chunk in util.filechunkiter(fpin, 128 * 1024):
1246 1222 fp.write(chunk)
1247 1223 fpin.close()
1248 1224 fp.close()
1249 1225 err = 0
1250 1226 return err
1251 1227
1252 1228 def mercurialsinkbefore(orig, sink):
1253 1229 sink.repo._isconverting = True
1254 1230 orig(sink)
1255 1231
1256 1232 def mercurialsinkafter(orig, sink):
1257 1233 sink.repo._isconverting = False
1258 1234 orig(sink)
1259 1235
1260 1236 def mergeupdate(orig, repo, node, branchmerge, force, partial,
1261 1237 *args, **kwargs):
1262 1238 wlock = repo.wlock()
1263 1239 try:
1264 1240 # branch | | |
1265 1241 # merge | force | partial | action
1266 1242 # -------+-------+---------+--------------
1267 1243 # x | x | x | linear-merge
1268 1244 # o | x | x | branch-merge
1269 1245 # x | o | x | overwrite (as clean update)
1270 1246 # o | o | x | force-branch-merge (*1)
1271 1247 # x | x | o | (*)
1272 1248 # o | x | o | (*)
1273 1249 # x | o | o | overwrite (as revert)
1274 1250 # o | o | o | (*)
1275 1251 #
1276 1252 # (*) don't care
1277 1253 # (*1) deprecated, but used internally (e.g: "rebase --collapse")
1278 1254
1279 1255 linearmerge = not branchmerge and not force and not partial
1280 1256
1281 1257 if linearmerge or (branchmerge and force and not partial):
1282 1258 # update standins for linear-merge or force-branch-merge,
1283 1259 # because largefiles in the working directory may be modified
1284 1260 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1285 1261 unsure, s = lfdirstate.status(match_.always(repo.root,
1286 1262 repo.getcwd()),
1287 1263 [], False, False, False)
1288 1264 for lfile in unsure + s.modified + s.added:
1289 1265 lfutil.updatestandin(repo, lfutil.standin(lfile))
1290 1266
1291 1267 if linearmerge:
1292 1268 # Only call updatelfiles on the standins that have changed
1293 1269 # to save time
1294 1270 oldstandins = lfutil.getstandinsstate(repo)
1295 1271
1296 1272 result = orig(repo, node, branchmerge, force, partial, *args, **kwargs)
1297 1273
1298 1274 filelist = None
1299 1275 if linearmerge:
1300 1276 newstandins = lfutil.getstandinsstate(repo)
1301 1277 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
1302 1278
1303 1279 # suppress status message while automated committing
1304 1280 printmessage = not (getattr(repo, "_isrebasing", False) or
1305 1281 getattr(repo, "_istransplanting", False))
1306 1282 lfcommands.updatelfiles(repo.ui, repo, filelist=filelist,
1307 1283 printmessage=printmessage,
1308 1284 normallookup=partial)
1309 1285
1310 1286 return result
1311 1287 finally:
1312 1288 wlock.release()
1313 1289
1314 1290 def scmutilmarktouched(orig, repo, files, *args, **kwargs):
1315 1291 result = orig(repo, files, *args, **kwargs)
1316 1292
1317 1293 filelist = [lfutil.splitstandin(f) for f in files if lfutil.isstandin(f)]
1318 1294 if filelist:
1319 1295 lfcommands.updatelfiles(repo.ui, repo, filelist=filelist,
1320 1296 printmessage=False, normallookup=True)
1321 1297
1322 1298 return result
@@ -1,835 +1,864 b''
1 1 This file contains testcases that tend to be related to special cases or less
2 2 common commands affecting largefile.
3 3
4 4 Each sections should be independent of each others.
5 5
6 6 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
7 7 $ mkdir "${USERCACHE}"
8 8 $ cat >> $HGRCPATH <<EOF
9 9 > [extensions]
10 10 > largefiles=
11 11 > purge=
12 12 > rebase=
13 13 > transplant=
14 14 > [phases]
15 15 > publish=False
16 16 > [largefiles]
17 17 > minsize=2
18 18 > patterns=glob:**.dat
19 19 > usercache=${USERCACHE}
20 20 > [hooks]
21 21 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
22 22 > EOF
23 23
24 24
25 25
26 26 Test copies and moves from a directory other than root (issue3516)
27 27 =========================================================================
28 28
29 29 $ hg init lf_cpmv
30 30 $ cd lf_cpmv
31 31 $ mkdir dira
32 32 $ mkdir dira/dirb
33 33 $ touch dira/dirb/largefile
34 34 $ hg add --large dira/dirb/largefile
35 35 $ hg commit -m "added"
36 36 Invoking status precommit hook
37 37 A dira/dirb/largefile
38 38 $ cd dira
39 39 $ hg cp dirb/largefile foo/largefile
40 40 $ hg ci -m "deep copy"
41 41 Invoking status precommit hook
42 42 A dira/foo/largefile
43 43 $ find . | sort
44 44 .
45 45 ./dirb
46 46 ./dirb/largefile
47 47 ./foo
48 48 ./foo/largefile
49 49 $ hg mv foo/largefile baz/largefile
50 50 $ hg ci -m "moved"
51 51 Invoking status precommit hook
52 52 A dira/baz/largefile
53 53 R dira/foo/largefile
54 54 $ find . | sort
55 55 .
56 56 ./baz
57 57 ./baz/largefile
58 58 ./dirb
59 59 ./dirb/largefile
60 60 $ cd ..
61 61 $ hg mv dira dirc
62 62 moving .hglf/dira/baz/largefile to .hglf/dirc/baz/largefile (glob)
63 63 moving .hglf/dira/dirb/largefile to .hglf/dirc/dirb/largefile (glob)
64 64 $ find * | sort
65 65 dirc
66 66 dirc/baz
67 67 dirc/baz/largefile
68 68 dirc/dirb
69 69 dirc/dirb/largefile
70 70 $ hg up -qC
71 71 $ cd ..
72 72
73 73 Clone a local repository owned by another user
74 74 ===================================================
75 75
76 76 #if unix-permissions
77 77
78 78 We have to simulate that here by setting $HOME and removing write permissions
79 79 $ ORIGHOME="$HOME"
80 80 $ mkdir alice
81 81 $ HOME="`pwd`/alice"
82 82 $ cd alice
83 83 $ hg init pubrepo
84 84 $ cd pubrepo
85 85 $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null
86 86 $ hg add --large a-large-file
87 87 $ hg commit -m "Add a large file"
88 88 Invoking status precommit hook
89 89 A a-large-file
90 90 $ cd ..
91 91 $ chmod -R a-w pubrepo
92 92 $ cd ..
93 93 $ mkdir bob
94 94 $ HOME="`pwd`/bob"
95 95 $ cd bob
96 96 $ hg clone --pull ../alice/pubrepo pubrepo
97 97 requesting all changes
98 98 adding changesets
99 99 adding manifests
100 100 adding file changes
101 101 added 1 changesets with 1 changes to 1 files
102 102 updating to branch default
103 103 getting changed largefiles
104 104 1 largefiles updated, 0 removed
105 105 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 106 $ cd ..
107 107 $ chmod -R u+w alice/pubrepo
108 108 $ HOME="$ORIGHOME"
109 109
110 110 #endif
111 111
112 112
113 113 Symlink to a large largefile should behave the same as a symlink to a normal file
114 114 =====================================================================================
115 115
116 116 #if symlink
117 117
118 118 $ hg init largesymlink
119 119 $ cd largesymlink
120 120 $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
121 121 $ hg add --large largefile
122 122 $ hg commit -m "commit a large file"
123 123 Invoking status precommit hook
124 124 A largefile
125 125 $ ln -s largefile largelink
126 126 $ hg add largelink
127 127 $ hg commit -m "commit a large symlink"
128 128 Invoking status precommit hook
129 129 A largelink
130 130 $ rm -f largelink
131 131 $ hg up >/dev/null
132 132 $ test -f largelink
133 133 [1]
134 134 $ test -L largelink
135 135 [1]
136 136 $ rm -f largelink # make next part of the test independent of the previous
137 137 $ hg up -C >/dev/null
138 138 $ test -f largelink
139 139 $ test -L largelink
140 140 $ cd ..
141 141
142 142 #endif
143 143
144 144
145 145 test for pattern matching on 'hg status':
146 146 ==============================================
147 147
148 148
149 149 to boost performance, largefiles checks whether specified patterns are
150 150 related to largefiles in working directory (NOT to STANDIN) or not.
151 151
152 152 $ hg init statusmatch
153 153 $ cd statusmatch
154 154
155 155 $ mkdir -p a/b/c/d
156 156 $ echo normal > a/b/c/d/e.normal.txt
157 157 $ hg add a/b/c/d/e.normal.txt
158 158 $ echo large > a/b/c/d/e.large.txt
159 159 $ hg add --large a/b/c/d/e.large.txt
160 160 $ mkdir -p a/b/c/x
161 161 $ echo normal > a/b/c/x/y.normal.txt
162 162 $ hg add a/b/c/x/y.normal.txt
163 163 $ hg commit -m 'add files'
164 164 Invoking status precommit hook
165 165 A a/b/c/d/e.large.txt
166 166 A a/b/c/d/e.normal.txt
167 167 A a/b/c/x/y.normal.txt
168 168
169 169 (1) no pattern: no performance boost
170 170 $ hg status -A
171 171 C a/b/c/d/e.large.txt
172 172 C a/b/c/d/e.normal.txt
173 173 C a/b/c/x/y.normal.txt
174 174
175 175 (2) pattern not related to largefiles: performance boost
176 176 $ hg status -A a/b/c/x
177 177 C a/b/c/x/y.normal.txt
178 178
179 179 (3) pattern related to largefiles: no performance boost
180 180 $ hg status -A a/b/c/d
181 181 C a/b/c/d/e.large.txt
182 182 C a/b/c/d/e.normal.txt
183 183
184 184 (4) pattern related to STANDIN (not to largefiles): performance boost
185 185 $ hg status -A .hglf/a
186 186 C .hglf/a/b/c/d/e.large.txt
187 187
188 188 (5) mixed case: no performance boost
189 189 $ hg status -A a/b/c/x a/b/c/d
190 190 C a/b/c/d/e.large.txt
191 191 C a/b/c/d/e.normal.txt
192 192 C a/b/c/x/y.normal.txt
193 193
194 194 verify that largefiles doesn't break filesets
195 195
196 196 $ hg log --rev . --exclude "set:binary()"
197 197 changeset: 0:41bd42f10efa
198 198 tag: tip
199 199 user: test
200 200 date: Thu Jan 01 00:00:00 1970 +0000
201 201 summary: add files
202 202
203 203 verify that large files in subrepos handled properly
204 204 $ hg init subrepo
205 205 $ echo "subrepo = subrepo" > .hgsub
206 206 $ hg add .hgsub
207 207 $ hg ci -m "add subrepo"
208 208 Invoking status precommit hook
209 209 A .hgsub
210 210 ? .hgsubstate
211 211 $ echo "rev 1" > subrepo/large.txt
212 212 $ hg -R subrepo add --large subrepo/large.txt
213 213 $ hg sum
214 214 parent: 1:8ee150ea2e9c tip
215 215 add subrepo
216 216 branch: default
217 217 commit: 1 subrepos
218 218 update: (current)
219 219 $ hg st
220 220 $ hg st -S
221 221 A subrepo/large.txt
222 222 $ hg ci -S -m "commit top repo"
223 223 committing subrepository subrepo
224 224 Invoking status precommit hook
225 225 A large.txt
226 226 Invoking status precommit hook
227 227 M .hgsubstate
228 228 # No differences
229 229 $ hg st -S
230 230 $ hg sum
231 231 parent: 2:ce4cd0c527a6 tip
232 232 commit top repo
233 233 branch: default
234 234 commit: (clean)
235 235 update: (current)
236 236 $ echo "rev 2" > subrepo/large.txt
237 237 $ hg st -S
238 238 M subrepo/large.txt
239 239 $ hg sum
240 240 parent: 2:ce4cd0c527a6 tip
241 241 commit top repo
242 242 branch: default
243 243 commit: 1 subrepos
244 244 update: (current)
245 245 $ hg ci -m "this commit should fail without -S"
246 246 abort: uncommitted changes in subrepo subrepo
247 247 (use --subrepos for recursive commit)
248 248 [255]
249 249
250 250 Add a normal file to the subrepo, then test archiving
251 251
252 252 $ echo 'normal file' > subrepo/normal.txt
253 253 $ hg -R subrepo add subrepo/normal.txt
254 254
255 255 Lock in subrepo, otherwise the change isn't archived
256 256
257 257 $ hg ci -S -m "add normal file to top level"
258 258 committing subrepository subrepo
259 259 Invoking status precommit hook
260 260 M large.txt
261 261 A normal.txt
262 262 Invoking status precommit hook
263 263 M .hgsubstate
264 264 $ hg archive -S ../lf_subrepo_archive
265 265 $ find ../lf_subrepo_archive | sort
266 266 ../lf_subrepo_archive
267 267 ../lf_subrepo_archive/.hg_archival.txt
268 268 ../lf_subrepo_archive/.hgsub
269 269 ../lf_subrepo_archive/.hgsubstate
270 270 ../lf_subrepo_archive/a
271 271 ../lf_subrepo_archive/a/b
272 272 ../lf_subrepo_archive/a/b/c
273 273 ../lf_subrepo_archive/a/b/c/d
274 274 ../lf_subrepo_archive/a/b/c/d/e.large.txt
275 275 ../lf_subrepo_archive/a/b/c/d/e.normal.txt
276 276 ../lf_subrepo_archive/a/b/c/x
277 277 ../lf_subrepo_archive/a/b/c/x/y.normal.txt
278 278 ../lf_subrepo_archive/subrepo
279 279 ../lf_subrepo_archive/subrepo/large.txt
280 280 ../lf_subrepo_archive/subrepo/normal.txt
281 281
282 282 Test update with subrepos.
283 283
284 284 $ hg update 0
285 285 getting changed largefiles
286 286 0 largefiles updated, 1 removed
287 287 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
288 288 $ hg status -S
289 289 $ hg update tip
290 290 getting changed largefiles
291 291 1 largefiles updated, 0 removed
292 292 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
293 293 $ hg status -S
294 294 # modify a large file
295 295 $ echo "modified" > subrepo/large.txt
296 296 $ hg st -S
297 297 M subrepo/large.txt
298 298 # update -C should revert the change.
299 299 $ hg update -C
300 300 getting changed largefiles
301 301 1 largefiles updated, 0 removed
302 302 getting changed largefiles
303 303 0 largefiles updated, 0 removed
304 304 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
305 305 $ hg status -S
306 306
307 307 Test archiving a revision that references a subrepo that is not yet
308 308 cloned (see test-subrepo-recursion.t):
309 309
310 310 $ hg clone -U . ../empty
311 311 $ cd ../empty
312 312 $ hg archive --subrepos -r tip ../archive.tar.gz
313 313 cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo
314 314 $ cd ..
315 315
316 316
317 317
318 318
319 319
320 320
321 321 Test addremove, forget and others
322 322 ==============================================
323 323
324 324 Test that addremove picks up largefiles prior to the initial commit (issue3541)
325 325
326 326 $ hg init addrm2
327 327 $ cd addrm2
328 328 $ touch large.dat
329 329 $ touch large2.dat
330 330 $ touch normal
331 331 $ hg add --large large.dat
332 332 $ hg addremove -v
333 333 adding large2.dat as a largefile
334 334 adding normal
335 335
336 336 Test that forgetting all largefiles reverts to islfilesrepo() == False
337 337 (addremove will add *.dat as normal files now)
338 338 $ hg forget large.dat
339 339 $ hg forget large2.dat
340 340 $ hg addremove -v
341 341 adding large.dat
342 342 adding large2.dat
343 343
344 344 Test commit's addremove option prior to the first commit
345 345 $ hg forget large.dat
346 346 $ hg forget large2.dat
347 347 $ hg add --large large.dat
348 348 $ hg ci -Am "commit"
349 349 adding large2.dat as a largefile
350 350 Invoking status precommit hook
351 351 A large.dat
352 352 A large2.dat
353 353 A normal
354 354 $ find .hglf | sort
355 355 .hglf
356 356 .hglf/large.dat
357 357 .hglf/large2.dat
358 358
359 359 Test actions on largefiles using relative paths from subdir
360 360
361 361 $ mkdir sub
362 362 $ cd sub
363 363 $ echo anotherlarge > anotherlarge
364 364 $ hg add --large anotherlarge
365 365 $ hg st
366 366 A sub/anotherlarge
367 367 $ hg st anotherlarge
368 368 A anotherlarge
369 369 $ hg commit -m anotherlarge anotherlarge
370 370 Invoking status precommit hook
371 371 A sub/anotherlarge
372 372 $ hg log anotherlarge
373 373 changeset: 1:9627a577c5e9
374 374 tag: tip
375 375 user: test
376 376 date: Thu Jan 01 00:00:00 1970 +0000
377 377 summary: anotherlarge
378 378
379 379 $ hg log -G anotherlarge
380 380 @ changeset: 1:9627a577c5e9
381 381 | tag: tip
382 382 | user: test
383 383 | date: Thu Jan 01 00:00:00 1970 +0000
384 384 | summary: anotherlarge
385 385 |
386 386 $ echo more >> anotherlarge
387 387 $ hg st .
388 388 M anotherlarge
389 389 $ hg cat anotherlarge
390 390 anotherlarge
391 391 $ hg revert anotherlarge
392 392 $ hg st
393 393 ? sub/anotherlarge.orig
394 394 $ cd ..
395 395
396 396 $ cd ..
397 397
398 398 Check error message while exchange
399 399 =========================================================
400 400
401 401 issue3651: summary/outgoing with largefiles shows "no remote repo"
402 402 unexpectedly
403 403
404 404 $ mkdir issue3651
405 405 $ cd issue3651
406 406
407 407 $ hg init src
408 408 $ echo a > src/a
409 409 $ hg -R src add --large src/a
410 410 $ hg -R src commit -m '#0'
411 411 Invoking status precommit hook
412 412 A a
413 413
414 414 check messages when no remote repository is specified:
415 415 "no remote repo" route for "hg outgoing --large" is not tested here,
416 416 because it can't be reproduced easily.
417 417
418 418 $ hg init clone1
419 419 $ hg -R clone1 -q pull src
420 420 $ hg -R clone1 -q update
421 421 $ hg -R clone1 paths | grep default
422 422 [1]
423 423
424 424 $ hg -R clone1 summary --large
425 425 parent: 0:fc0bd45326d3 tip
426 426 #0
427 427 branch: default
428 428 commit: (clean)
429 429 update: (current)
430 430 largefiles: (no remote repo)
431 431
432 432 check messages when there is no files to upload:
433 433
434 434 $ hg -q clone src clone2
435 435 $ hg -R clone2 paths | grep default
436 436 default = $TESTTMP/issue3651/src (glob)
437 437
438 438 $ hg -R clone2 summary --large
439 439 parent: 0:fc0bd45326d3 tip
440 440 #0
441 441 branch: default
442 442 commit: (clean)
443 443 update: (current)
444 444 largefiles: (no files to upload)
445 445 $ hg -R clone2 outgoing --large
446 446 comparing with $TESTTMP/issue3651/src (glob)
447 447 searching for changes
448 448 no changes found
449 449 largefiles: no files to upload
450 450 [1]
451 451
452 452 $ hg -R clone2 outgoing --large --graph --template "{rev}"
453 453 comparing with $TESTTMP/issue3651/src (glob)
454 454 searching for changes
455 455 no changes found
456 456 largefiles: no files to upload
457 457
458 458 check messages when there are files to upload:
459 459
460 460 $ echo b > clone2/b
461 461 $ hg -R clone2 add --large clone2/b
462 462 $ hg -R clone2 commit -m '#1'
463 463 Invoking status precommit hook
464 464 A b
465 465 $ hg -R clone2 summary --large
466 466 parent: 1:1acbe71ce432 tip
467 467 #1
468 468 branch: default
469 469 commit: (clean)
470 470 update: (current)
471 471 largefiles: 1 entities for 1 files to upload
472 472 $ hg -R clone2 outgoing --large
473 473 comparing with $TESTTMP/issue3651/src (glob)
474 474 searching for changes
475 475 changeset: 1:1acbe71ce432
476 476 tag: tip
477 477 user: test
478 478 date: Thu Jan 01 00:00:00 1970 +0000
479 479 summary: #1
480 480
481 481 largefiles to upload (1 entities):
482 482 b
483 483
484 484 $ hg -R clone2 outgoing --large --graph --template "{rev}"
485 485 comparing with $TESTTMP/issue3651/src
486 486 searching for changes
487 487 @ 1
488 488
489 489 largefiles to upload (1 entities):
490 490 b
491 491
492 492
493 493 $ cp clone2/b clone2/b1
494 494 $ cp clone2/b clone2/b2
495 495 $ hg -R clone2 add --large clone2/b1 clone2/b2
496 496 $ hg -R clone2 commit -m '#2: add largefiles referring same entity'
497 497 Invoking status precommit hook
498 498 A b1
499 499 A b2
500 500 $ hg -R clone2 summary --large
501 501 parent: 2:6095d0695d70 tip
502 502 #2: add largefiles referring same entity
503 503 branch: default
504 504 commit: (clean)
505 505 update: (current)
506 506 largefiles: 1 entities for 3 files to upload
507 507 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
508 508 comparing with $TESTTMP/issue3651/src (glob)
509 509 searching for changes
510 510 1:1acbe71ce432
511 511 2:6095d0695d70
512 512 largefiles to upload (1 entities):
513 513 b
514 514 b1
515 515 b2
516 516
517 517 $ hg -R clone2 cat -r 1 clone2/.hglf/b
518 518 89e6c98d92887913cadf06b2adb97f26cde4849b
519 519 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug
520 520 comparing with $TESTTMP/issue3651/src (glob)
521 521 query 1; heads
522 522 searching for changes
523 523 all remote heads known locally
524 524 1:1acbe71ce432
525 525 2:6095d0695d70
526 526 largefiles to upload (1 entities):
527 527 b
528 528 89e6c98d92887913cadf06b2adb97f26cde4849b
529 529 b1
530 530 89e6c98d92887913cadf06b2adb97f26cde4849b
531 531 b2
532 532 89e6c98d92887913cadf06b2adb97f26cde4849b
533 533
534 534
535 535 $ echo bbb > clone2/b
536 536 $ hg -R clone2 commit -m '#3: add new largefile entity as existing file'
537 537 Invoking status precommit hook
538 538 M b
539 539 $ echo bbbb > clone2/b
540 540 $ hg -R clone2 commit -m '#4: add new largefile entity as existing file'
541 541 Invoking status precommit hook
542 542 M b
543 543 $ cp clone2/b1 clone2/b
544 544 $ hg -R clone2 commit -m '#5: refer existing largefile entity again'
545 545 Invoking status precommit hook
546 546 M b
547 547 $ hg -R clone2 summary --large
548 548 parent: 5:036794ea641c tip
549 549 #5: refer existing largefile entity again
550 550 branch: default
551 551 commit: (clean)
552 552 update: (current)
553 553 largefiles: 3 entities for 3 files to upload
554 554 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
555 555 comparing with $TESTTMP/issue3651/src (glob)
556 556 searching for changes
557 557 1:1acbe71ce432
558 558 2:6095d0695d70
559 559 3:7983dce246cc
560 560 4:233f12ada4ae
561 561 5:036794ea641c
562 562 largefiles to upload (3 entities):
563 563 b
564 564 b1
565 565 b2
566 566
567 567 $ hg -R clone2 cat -r 3 clone2/.hglf/b
568 568 c801c9cfe94400963fcb683246217d5db77f9a9a
569 569 $ hg -R clone2 cat -r 4 clone2/.hglf/b
570 570 13f9ed0898e315bf59dc2973fec52037b6f441a2
571 571 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug
572 572 comparing with $TESTTMP/issue3651/src (glob)
573 573 query 1; heads
574 574 searching for changes
575 575 all remote heads known locally
576 576 1:1acbe71ce432
577 577 2:6095d0695d70
578 578 3:7983dce246cc
579 579 4:233f12ada4ae
580 580 5:036794ea641c
581 581 largefiles to upload (3 entities):
582 582 b
583 583 13f9ed0898e315bf59dc2973fec52037b6f441a2
584 584 89e6c98d92887913cadf06b2adb97f26cde4849b
585 585 c801c9cfe94400963fcb683246217d5db77f9a9a
586 586 b1
587 587 89e6c98d92887913cadf06b2adb97f26cde4849b
588 588 b2
589 589 89e6c98d92887913cadf06b2adb97f26cde4849b
590 590
591 591
592 592 Pushing revision #1 causes uploading entity 89e6c98d9288, which is
593 593 shared also by largefiles b1, b2 in revision #2 and b in revision #5.
594 594
595 595 Then, entity 89e6c98d9288 is not treated as "outgoing entity" at "hg
596 596 summary" and "hg outgoing", even though files in outgoing revision #2
597 597 and #5 refer it.
598 598
599 599 $ hg -R clone2 push -r 1 -q
600 600 $ hg -R clone2 summary --large
601 601 parent: 5:036794ea641c tip
602 602 #5: refer existing largefile entity again
603 603 branch: default
604 604 commit: (clean)
605 605 update: (current)
606 606 largefiles: 2 entities for 1 files to upload
607 607 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
608 608 comparing with $TESTTMP/issue3651/src (glob)
609 609 searching for changes
610 610 2:6095d0695d70
611 611 3:7983dce246cc
612 612 4:233f12ada4ae
613 613 5:036794ea641c
614 614 largefiles to upload (2 entities):
615 615 b
616 616
617 617 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug
618 618 comparing with $TESTTMP/issue3651/src (glob)
619 619 query 1; heads
620 620 searching for changes
621 621 all remote heads known locally
622 622 2:6095d0695d70
623 623 3:7983dce246cc
624 624 4:233f12ada4ae
625 625 5:036794ea641c
626 626 largefiles to upload (2 entities):
627 627 b
628 628 13f9ed0898e315bf59dc2973fec52037b6f441a2
629 629 c801c9cfe94400963fcb683246217d5db77f9a9a
630 630
631 631
632 632 $ cd ..
633 633
634 634 merge action 'd' for 'local renamed directory to d2/g' which has no filename
635 635 ==================================================================================
636 636
637 637 $ hg init merge-action
638 638 $ cd merge-action
639 639 $ touch l
640 640 $ hg add --large l
641 641 $ mkdir d1
642 642 $ touch d1/f
643 643 $ hg ci -Aqm0
644 644 Invoking status precommit hook
645 645 A d1/f
646 646 A l
647 647 $ echo > d1/f
648 648 $ touch d1/g
649 649 $ hg ci -Aqm1
650 650 Invoking status precommit hook
651 651 M d1/f
652 652 A d1/g
653 653 $ hg up -qr0
654 654 $ hg mv d1 d2
655 655 moving d1/f to d2/f (glob)
656 656 $ hg ci -qm2
657 657 Invoking status precommit hook
658 658 A d2/f
659 659 R d1/f
660 660 $ hg merge
661 661 merging d2/f and d1/f to d2/f
662 662 getting changed largefiles
663 663 0 largefiles updated, 0 removed
664 664 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
665 665 (branch merge, don't forget to commit)
666 666 $ cd ..
667 667
668 668
669 669 Merge conflicts:
670 670 =====================
671 671
672 672 $ hg init merge
673 673 $ cd merge
674 674 $ echo 0 > f-different
675 675 $ echo 0 > f-same
676 676 $ echo 0 > f-unchanged-1
677 677 $ echo 0 > f-unchanged-2
678 678 $ hg add --large *
679 679 $ hg ci -m0
680 680 Invoking status precommit hook
681 681 A f-different
682 682 A f-same
683 683 A f-unchanged-1
684 684 A f-unchanged-2
685 685 $ echo tmp1 > f-unchanged-1
686 686 $ echo tmp1 > f-unchanged-2
687 687 $ echo tmp1 > f-same
688 688 $ hg ci -m1
689 689 Invoking status precommit hook
690 690 M f-same
691 691 M f-unchanged-1
692 692 M f-unchanged-2
693 693 $ echo 2 > f-different
694 694 $ echo 0 > f-unchanged-1
695 695 $ echo 1 > f-unchanged-2
696 696 $ echo 1 > f-same
697 697 $ hg ci -m2
698 698 Invoking status precommit hook
699 699 M f-different
700 700 M f-same
701 701 M f-unchanged-1
702 702 M f-unchanged-2
703 703 $ hg up -qr0
704 704 $ echo tmp2 > f-unchanged-1
705 705 $ echo tmp2 > f-unchanged-2
706 706 $ echo tmp2 > f-same
707 707 $ hg ci -m3
708 708 Invoking status precommit hook
709 709 M f-same
710 710 M f-unchanged-1
711 711 M f-unchanged-2
712 712 created new head
713 713 $ echo 1 > f-different
714 714 $ echo 1 > f-unchanged-1
715 715 $ echo 0 > f-unchanged-2
716 716 $ echo 1 > f-same
717 717 $ hg ci -m4
718 718 Invoking status precommit hook
719 719 M f-different
720 720 M f-same
721 721 M f-unchanged-1
722 722 M f-unchanged-2
723 723 $ hg merge
724 724 largefile f-different has a merge conflict
725 725 ancestor was 09d2af8dd22201dd8d48e5dcfcaed281ff9422c7
726 726 keep (l)ocal e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e or
727 727 take (o)ther 7448d8798a4380162d4b56f9b452e2f6f9e24e7a? l
728 728 getting changed largefiles
729 729 1 largefiles updated, 0 removed
730 730 0 files updated, 4 files merged, 0 files removed, 0 files unresolved
731 731 (branch merge, don't forget to commit)
732 732 $ cat f-different
733 733 1
734 734 $ cat f-same
735 735 1
736 736 $ cat f-unchanged-1
737 737 1
738 738 $ cat f-unchanged-2
739 739 1
740 740 $ cd ..
741 741
742 742 Test largefile insulation (do not enabled a side effect
743 743 ========================================================
744 744
745 745 Check whether "largefiles" feature is supported only in repositories
746 746 enabling largefiles extension.
747 747
748 748 $ mkdir individualenabling
749 749 $ cd individualenabling
750 750
751 751 $ hg init enabledlocally
752 752 $ echo large > enabledlocally/large
753 753 $ hg -R enabledlocally add --large enabledlocally/large
754 754 $ hg -R enabledlocally commit -m '#0'
755 755 Invoking status precommit hook
756 756 A large
757 757
758 758 $ hg init notenabledlocally
759 759 $ echo large > notenabledlocally/large
760 760 $ hg -R notenabledlocally add --large notenabledlocally/large
761 761 $ hg -R notenabledlocally commit -m '#0'
762 762 Invoking status precommit hook
763 763 A large
764 764
765 765 $ cat >> $HGRCPATH <<EOF
766 766 > [extensions]
767 767 > # disable globally
768 768 > largefiles=!
769 769 > EOF
770 770 $ cat >> enabledlocally/.hg/hgrc <<EOF
771 771 > [extensions]
772 772 > # enable locally
773 773 > largefiles=
774 774 > EOF
775 775 $ hg -R enabledlocally root
776 776 $TESTTMP/individualenabling/enabledlocally (glob)
777 777 $ hg -R notenabledlocally root
778 778 abort: repository requires features unknown to this Mercurial: largefiles!
779 779 (see http://mercurial.selenic.com/wiki/MissingRequirement for more information)
780 780 [255]
781 781
782 782 $ hg init push-dst
783 783 $ hg -R enabledlocally push push-dst
784 784 pushing to push-dst
785 785 abort: required features are not supported in the destination: largefiles
786 786 [255]
787 787
788 788 $ hg init pull-src
789 789 $ hg -R pull-src pull enabledlocally
790 790 pulling from enabledlocally
791 791 abort: required features are not supported in the destination: largefiles
792 792 [255]
793 793
794 794 $ hg clone enabledlocally clone-dst
795 795 abort: repository requires features unknown to this Mercurial: largefiles!
796 796 (see http://mercurial.selenic.com/wiki/MissingRequirement for more information)
797 797 [255]
798 798 $ test -d clone-dst
799 799 [1]
800 800 $ hg clone --pull enabledlocally clone-pull-dst
801 801 abort: required features are not supported in the destination: largefiles
802 802 [255]
803 803 $ test -d clone-pull-dst
804 804 [1]
805 805
806 806 #if serve
807 807
808 808 Test largefiles specific peer setup, when largefiles is enabled
809 809 locally (issue4109)
810 810
811 811 $ hg showconfig extensions | grep largefiles
812 812 extensions.largefiles=!
813 813 $ mkdir -p $TESTTMP/individualenabling/usercache
814 814
815 815 $ hg serve -R enabledlocally -d -p $HGPORT --pid-file hg.pid
816 816 $ cat hg.pid >> $DAEMON_PIDS
817 817
818 818 $ hg init pull-dst
819 819 $ cat > pull-dst/.hg/hgrc <<EOF
820 820 > [extensions]
821 821 > # enable locally
822 822 > largefiles=
823 823 > [largefiles]
824 824 > # ignore system cache to force largefiles specific wire proto access
825 825 > usercache=$TESTTMP/individualenabling/usercache
826 826 > EOF
827 827 $ hg -R pull-dst -q pull -u http://localhost:$HGPORT
828 828
829 829 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
830 830 #endif
831 831
832 832 $ cd ..
833 833
834 834
835 Test "pull --rebase" when rebase is enabled before largefiles (issue3861)
836 =========================================================================
835 837
838 $ hg showconfig extensions | grep largefiles
839 extensions.largefiles=!
840
841 $ mkdir issue3861
842 $ cd issue3861
843 $ hg init src
844 $ hg clone -q src dst
845 $ echo a > src/a
846 $ hg -R src commit -Aqm "#0"
847 Invoking status precommit hook
848 A a
849
850 $ cat >> dst/.hg/hgrc <<EOF
851 > [extensions]
852 > largefiles=
853 > EOF
854 $ hg -R dst pull --rebase
855 pulling from $TESTTMP/issue3861/src (glob)
856 requesting all changes
857 adding changesets
858 adding manifests
859 adding file changes
860 added 1 changesets with 1 changes to 1 files
861 nothing to rebase - working directory parent is already an ancestor of destination bf5e395ced2c
862 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
863
864 $ cd ..
@@ -1,1824 +1,1823 b''
1 1 This file used to contains all largefile tests.
2 2 Do not add any new tests in this file as it his already far too long to run.
3 3
4 4 It contains all the testing of the basic concepts of large file in a single block.
5 5
6 6 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
7 7 $ mkdir "${USERCACHE}"
8 8 $ cat >> $HGRCPATH <<EOF
9 9 > [extensions]
10 10 > largefiles=
11 11 > purge=
12 12 > rebase=
13 13 > transplant=
14 14 > [phases]
15 15 > publish=False
16 16 > [largefiles]
17 17 > minsize=2
18 18 > patterns=glob:**.dat
19 19 > usercache=${USERCACHE}
20 20 > [hooks]
21 21 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
22 22 > EOF
23 23
24 24 Create the repo with a couple of revisions of both large and normal
25 25 files.
26 26 Test status and dirstate of largefiles and that summary output is correct.
27 27
28 28 $ hg init a
29 29 $ cd a
30 30 $ mkdir sub
31 31 $ echo normal1 > normal1
32 32 $ echo normal2 > sub/normal2
33 33 $ echo large1 > large1
34 34 $ echo large2 > sub/large2
35 35 $ hg add normal1 sub/normal2
36 36 $ hg add --large large1 sub/large2
37 37 $ hg commit -m "add files"
38 38 Invoking status precommit hook
39 39 A large1
40 40 A normal1
41 41 A sub/large2
42 42 A sub/normal2
43 43 $ touch large1 sub/large2
44 44 $ sleep 1
45 45 $ hg st
46 46 $ hg debugstate --nodates
47 47 n 644 41 .hglf/large1
48 48 n 644 41 .hglf/sub/large2
49 49 n 644 8 normal1
50 50 n 644 8 sub/normal2
51 51 $ hg debugstate --large --nodates
52 52 n 644 7 large1
53 53 n 644 7 sub/large2
54 54 $ echo normal11 > normal1
55 55 $ echo normal22 > sub/normal2
56 56 $ echo large11 > large1
57 57 $ echo large22 > sub/large2
58 58 $ hg commit -m "edit files"
59 59 Invoking status precommit hook
60 60 M large1
61 61 M normal1
62 62 M sub/large2
63 63 M sub/normal2
64 64 $ hg sum --large
65 65 parent: 1:ce8896473775 tip
66 66 edit files
67 67 branch: default
68 68 commit: (clean)
69 69 update: (current)
70 70 largefiles: (no remote repo)
71 71
72 72 Commit preserved largefile contents.
73 73
74 74 $ cat normal1
75 75 normal11
76 76 $ cat large1
77 77 large11
78 78 $ cat sub/normal2
79 79 normal22
80 80 $ cat sub/large2
81 81 large22
82 82
83 83 Test status, subdir and unknown files
84 84
85 85 $ echo unknown > sub/unknown
86 86 $ hg st --all
87 87 ? sub/unknown
88 88 C large1
89 89 C normal1
90 90 C sub/large2
91 91 C sub/normal2
92 92 $ hg st --all sub
93 93 ? sub/unknown
94 94 C sub/large2
95 95 C sub/normal2
96 96 $ rm sub/unknown
97 97
98 98 Test messages and exit codes for remove warning cases
99 99
100 100 $ hg remove -A large1
101 101 not removing large1: file still exists
102 102 [1]
103 103 $ echo 'modified' > large1
104 104 $ hg remove large1
105 105 not removing large1: file is modified (use -f to force removal)
106 106 [1]
107 107 $ echo 'new' > normalnew
108 108 $ hg add normalnew
109 109 $ echo 'new' > largenew
110 110 $ hg add --large normalnew
111 111 normalnew already tracked!
112 112 $ hg remove normalnew largenew
113 113 not removing largenew: file is untracked
114 114 not removing normalnew: file has been marked for add (use forget to undo)
115 115 [1]
116 116 $ rm normalnew largenew
117 117 $ hg up -Cq
118 118
119 119 Remove both largefiles and normal files.
120 120
121 121 $ hg remove normal1 large1
122 122 $ hg status large1
123 123 R large1
124 124 $ hg commit -m "remove files"
125 125 Invoking status precommit hook
126 126 R large1
127 127 R normal1
128 128 $ ls
129 129 sub
130 130 $ echo "testlargefile" > large1-test
131 131 $ hg add --large large1-test
132 132 $ hg st
133 133 A large1-test
134 134 $ hg rm large1-test
135 135 not removing large1-test: file has been marked for add (use forget to undo)
136 136 [1]
137 137 $ hg st
138 138 A large1-test
139 139 $ hg forget large1-test
140 140 $ hg st
141 141 ? large1-test
142 142 $ hg remove large1-test
143 143 not removing large1-test: file is untracked
144 144 [1]
145 145 $ hg forget large1-test
146 146 not removing large1-test: file is already untracked
147 147 [1]
148 148 $ rm large1-test
149 149
150 150 Copy both largefiles and normal files (testing that status output is correct).
151 151
152 152 $ hg cp sub/normal2 normal1
153 153 $ hg cp sub/large2 large1
154 154 $ hg commit -m "copy files"
155 155 Invoking status precommit hook
156 156 A large1
157 157 A normal1
158 158 $ cat normal1
159 159 normal22
160 160 $ cat large1
161 161 large22
162 162
163 163 Test moving largefiles and verify that normal files are also unaffected.
164 164
165 165 $ hg mv normal1 normal3
166 166 $ hg mv large1 large3
167 167 $ hg mv sub/normal2 sub/normal4
168 168 $ hg mv sub/large2 sub/large4
169 169 $ hg commit -m "move files"
170 170 Invoking status precommit hook
171 171 A large3
172 172 A normal3
173 173 A sub/large4
174 174 A sub/normal4
175 175 R large1
176 176 R normal1
177 177 R sub/large2
178 178 R sub/normal2
179 179 $ cat normal3
180 180 normal22
181 181 $ cat large3
182 182 large22
183 183 $ cat sub/normal4
184 184 normal22
185 185 $ cat sub/large4
186 186 large22
187 187
188 188
189 189 #if serve
190 190 Test display of largefiles in hgweb
191 191
192 192 $ hg serve -d -p $HGPORT --pid-file ../hg.pid
193 193 $ cat ../hg.pid >> $DAEMON_PIDS
194 194 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/?style=raw'
195 195 200 Script output follows
196 196
197 197
198 198 drwxr-xr-x sub
199 199 -rw-r--r-- 41 large3
200 200 -rw-r--r-- 9 normal3
201 201
202 202
203 203 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/tip/sub/?style=raw'
204 204 200 Script output follows
205 205
206 206
207 207 -rw-r--r-- 41 large4
208 208 -rw-r--r-- 9 normal4
209 209
210 210
211 211 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
212 212 #endif
213 213
214 214 Test archiving the various revisions. These hit corner cases known with
215 215 archiving.
216 216
217 217 $ hg archive -r 0 ../archive0
218 218 $ hg archive -r 1 ../archive1
219 219 $ hg archive -r 2 ../archive2
220 220 $ hg archive -r 3 ../archive3
221 221 $ hg archive -r 4 ../archive4
222 222 $ cd ../archive0
223 223 $ cat normal1
224 224 normal1
225 225 $ cat large1
226 226 large1
227 227 $ cat sub/normal2
228 228 normal2
229 229 $ cat sub/large2
230 230 large2
231 231 $ cd ../archive1
232 232 $ cat normal1
233 233 normal11
234 234 $ cat large1
235 235 large11
236 236 $ cat sub/normal2
237 237 normal22
238 238 $ cat sub/large2
239 239 large22
240 240 $ cd ../archive2
241 241 $ ls
242 242 sub
243 243 $ cat sub/normal2
244 244 normal22
245 245 $ cat sub/large2
246 246 large22
247 247 $ cd ../archive3
248 248 $ cat normal1
249 249 normal22
250 250 $ cat large1
251 251 large22
252 252 $ cat sub/normal2
253 253 normal22
254 254 $ cat sub/large2
255 255 large22
256 256 $ cd ../archive4
257 257 $ cat normal3
258 258 normal22
259 259 $ cat large3
260 260 large22
261 261 $ cat sub/normal4
262 262 normal22
263 263 $ cat sub/large4
264 264 large22
265 265
266 266 Commit corner case: specify files to commit.
267 267
268 268 $ cd ../a
269 269 $ echo normal3 > normal3
270 270 $ echo large3 > large3
271 271 $ echo normal4 > sub/normal4
272 272 $ echo large4 > sub/large4
273 273 $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again"
274 274 Invoking status precommit hook
275 275 M large3
276 276 M normal3
277 277 M sub/large4
278 278 M sub/normal4
279 279 $ cat normal3
280 280 normal3
281 281 $ cat large3
282 282 large3
283 283 $ cat sub/normal4
284 284 normal4
285 285 $ cat sub/large4
286 286 large4
287 287
288 288 One more commit corner case: commit from a subdirectory.
289 289
290 290 $ cd ../a
291 291 $ echo normal33 > normal3
292 292 $ echo large33 > large3
293 293 $ echo normal44 > sub/normal4
294 294 $ echo large44 > sub/large4
295 295 $ cd sub
296 296 $ hg commit -m "edit files yet again"
297 297 Invoking status precommit hook
298 298 M large3
299 299 M normal3
300 300 M sub/large4
301 301 M sub/normal4
302 302 $ cat ../normal3
303 303 normal33
304 304 $ cat ../large3
305 305 large33
306 306 $ cat normal4
307 307 normal44
308 308 $ cat large4
309 309 large44
310 310
311 311 Committing standins is not allowed.
312 312
313 313 $ cd ..
314 314 $ echo large3 > large3
315 315 $ hg commit .hglf/large3 -m "try to commit standin"
316 316 abort: file ".hglf/large3" is a largefile standin
317 317 (commit the largefile itself instead)
318 318 [255]
319 319
320 320 Corner cases for adding largefiles.
321 321
322 322 $ echo large5 > large5
323 323 $ hg add --large large5
324 324 $ hg add --large large5
325 325 large5 already a largefile
326 326 $ mkdir sub2
327 327 $ echo large6 > sub2/large6
328 328 $ echo large7 > sub2/large7
329 329 $ hg add --large sub2
330 330 adding sub2/large6 as a largefile (glob)
331 331 adding sub2/large7 as a largefile (glob)
332 332 $ hg st
333 333 M large3
334 334 A large5
335 335 A sub2/large6
336 336 A sub2/large7
337 337
338 338 Committing directories containing only largefiles.
339 339
340 340 $ mkdir -p z/y/x/m
341 341 $ touch z/y/x/m/large1
342 342 $ touch z/y/x/large2
343 343 $ hg add --large z/y/x/m/large1 z/y/x/large2
344 344 $ hg commit -m "Subdir with directory only containing largefiles" z
345 345 Invoking status precommit hook
346 346 M large3
347 347 A large5
348 348 A sub2/large6
349 349 A sub2/large7
350 350 A z/y/x/large2
351 351 A z/y/x/m/large1
352 352
353 353 (and a bit of log testing)
354 354
355 355 $ hg log -T '{rev}\n' z/y/x/m/large1
356 356 7
357 357 $ hg log -T '{rev}\n' z/y/x/m # with only a largefile
358 358 7
359 359
360 360 $ hg rollback --quiet
361 361 $ touch z/y/x/m/normal
362 362 $ hg add z/y/x/m/normal
363 363 $ hg commit -m "Subdir with mixed contents" z
364 364 Invoking status precommit hook
365 365 M large3
366 366 A large5
367 367 A sub2/large6
368 368 A sub2/large7
369 369 A z/y/x/large2
370 370 A z/y/x/m/large1
371 371 A z/y/x/m/normal
372 372 $ hg st
373 373 M large3
374 374 A large5
375 375 A sub2/large6
376 376 A sub2/large7
377 377 $ hg rollback --quiet
378 378 $ hg revert z/y/x/large2 z/y/x/m/large1
379 379 $ rm z/y/x/large2 z/y/x/m/large1
380 380 $ hg commit -m "Subdir with normal contents" z
381 381 Invoking status precommit hook
382 382 M large3
383 383 A large5
384 384 A sub2/large6
385 385 A sub2/large7
386 386 A z/y/x/m/normal
387 387 $ hg st
388 388 M large3
389 389 A large5
390 390 A sub2/large6
391 391 A sub2/large7
392 392 $ hg rollback --quiet
393 393 $ hg revert --quiet z
394 394 $ hg commit -m "Empty subdir" z
395 395 abort: z: no match under directory!
396 396 [255]
397 397 $ rm -rf z
398 398 $ hg ci -m "standin" .hglf
399 399 abort: file ".hglf" is a largefile standin
400 400 (commit the largefile itself instead)
401 401 [255]
402 402
403 403 Test "hg status" with combination of 'file pattern' and 'directory
404 404 pattern' for largefiles:
405 405
406 406 $ hg status sub2/large6 sub2
407 407 A sub2/large6
408 408 A sub2/large7
409 409
410 410 Config settings (pattern **.dat, minsize 2 MB) are respected.
411 411
412 412 $ echo testdata > test.dat
413 413 $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null
414 414 $ hg add
415 415 adding reallylarge as a largefile
416 416 adding test.dat as a largefile
417 417
418 418 Test that minsize and --lfsize handle float values;
419 419 also tests that --lfsize overrides largefiles.minsize.
420 420 (0.250 MB = 256 kB = 262144 B)
421 421
422 422 $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null
423 423 $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null
424 424 $ hg --config largefiles.minsize=.25 add
425 425 adding ratherlarge as a largefile
426 426 adding medium
427 427 $ hg forget medium
428 428 $ hg --config largefiles.minsize=.25 add --lfsize=.125
429 429 adding medium as a largefile
430 430 $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null
431 431 $ hg --config largefiles.minsize=.25 add --lfsize=.125
432 432 adding notlarge
433 433 $ hg forget notlarge
434 434
435 435 Test forget on largefiles.
436 436
437 437 $ hg forget large3 large5 test.dat reallylarge ratherlarge medium
438 438 $ hg commit -m "add/edit more largefiles"
439 439 Invoking status precommit hook
440 440 A sub2/large6
441 441 A sub2/large7
442 442 R large3
443 443 ? large5
444 444 ? medium
445 445 ? notlarge
446 446 ? ratherlarge
447 447 ? reallylarge
448 448 ? test.dat
449 449 $ hg st
450 450 ? large3
451 451 ? large5
452 452 ? medium
453 453 ? notlarge
454 454 ? ratherlarge
455 455 ? reallylarge
456 456 ? test.dat
457 457
458 458 Purge with largefiles: verify that largefiles are still in the working
459 459 dir after a purge.
460 460
461 461 $ hg purge --all
462 462 $ cat sub/large4
463 463 large44
464 464 $ cat sub2/large6
465 465 large6
466 466 $ cat sub2/large7
467 467 large7
468 468
469 469 Test addremove: verify that files that should be added as largefiles are added as
470 470 such and that already-existing largefiles are not added as normal files by
471 471 accident.
472 472
473 473 $ rm normal3
474 474 $ rm sub/large4
475 475 $ echo "testing addremove with patterns" > testaddremove.dat
476 476 $ echo "normaladdremove" > normaladdremove
477 477 $ hg addremove
478 478 removing sub/large4
479 479 adding testaddremove.dat as a largefile
480 480 removing normal3
481 481 adding normaladdremove
482 482
483 483 Test addremove with -R
484 484
485 485 $ hg up -C
486 486 getting changed largefiles
487 487 1 largefiles updated, 0 removed
488 488 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
489 489 $ rm normal3
490 490 $ rm sub/large4
491 491 $ echo "testing addremove with patterns" > testaddremove.dat
492 492 $ echo "normaladdremove" > normaladdremove
493 493 $ cd ..
494 494 $ hg -R a addremove
495 495 removing sub/large4
496 496 adding a/testaddremove.dat as a largefile (glob)
497 497 removing normal3
498 498 adding normaladdremove
499 499 $ cd a
500 500
501 501 Test 3364
502 502 $ hg clone . ../addrm
503 503 updating to branch default
504 504 getting changed largefiles
505 505 3 largefiles updated, 0 removed
506 506 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
507 507 $ cd ../addrm
508 508 $ cat >> .hg/hgrc <<EOF
509 509 > [hooks]
510 510 > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A"
511 511 > EOF
512 512 $ touch foo
513 513 $ hg add --large foo
514 514 $ hg ci -m "add foo"
515 515 Invoking status precommit hook
516 516 A foo
517 517 Invoking status postcommit hook
518 518 C foo
519 519 C normal3
520 520 C sub/large4
521 521 C sub/normal4
522 522 C sub2/large6
523 523 C sub2/large7
524 524 $ rm foo
525 525 $ hg st
526 526 ! foo
527 527 hmm.. no precommit invoked, but there is a postcommit??
528 528 $ hg ci -m "will not checkin"
529 529 nothing changed
530 530 Invoking status postcommit hook
531 531 ! foo
532 532 C normal3
533 533 C sub/large4
534 534 C sub/normal4
535 535 C sub2/large6
536 536 C sub2/large7
537 537 [1]
538 538 $ hg addremove
539 539 removing foo
540 540 $ hg st
541 541 R foo
542 542 $ hg ci -m "used to say nothing changed"
543 543 Invoking status precommit hook
544 544 R foo
545 545 Invoking status postcommit hook
546 546 C normal3
547 547 C sub/large4
548 548 C sub/normal4
549 549 C sub2/large6
550 550 C sub2/large7
551 551 $ hg st
552 552
553 553 Test 3507 (both normal files and largefiles were a problem)
554 554
555 555 $ touch normal
556 556 $ touch large
557 557 $ hg add normal
558 558 $ hg add --large large
559 559 $ hg ci -m "added"
560 560 Invoking status precommit hook
561 561 A large
562 562 A normal
563 563 Invoking status postcommit hook
564 564 C large
565 565 C normal
566 566 C normal3
567 567 C sub/large4
568 568 C sub/normal4
569 569 C sub2/large6
570 570 C sub2/large7
571 571 $ hg remove normal
572 572 $ hg addremove --traceback
573 573 $ hg ci -m "addremoved normal"
574 574 Invoking status precommit hook
575 575 R normal
576 576 Invoking status postcommit hook
577 577 C large
578 578 C normal3
579 579 C sub/large4
580 580 C sub/normal4
581 581 C sub2/large6
582 582 C sub2/large7
583 583 $ hg up -C '.^'
584 584 getting changed largefiles
585 585 0 largefiles updated, 0 removed
586 586 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
587 587 $ hg remove large
588 588 $ hg addremove --traceback
589 589 $ hg ci -m "removed large"
590 590 Invoking status precommit hook
591 591 R large
592 592 created new head
593 593 Invoking status postcommit hook
594 594 C normal
595 595 C normal3
596 596 C sub/large4
597 597 C sub/normal4
598 598 C sub2/large6
599 599 C sub2/large7
600 600
601 601 Test commit -A (issue3542)
602 602 $ echo large8 > large8
603 603 $ hg add --large large8
604 604 $ hg ci -Am 'this used to add large8 as normal and commit both'
605 605 Invoking status precommit hook
606 606 A large8
607 607 Invoking status postcommit hook
608 608 C large8
609 609 C normal
610 610 C normal3
611 611 C sub/large4
612 612 C sub/normal4
613 613 C sub2/large6
614 614 C sub2/large7
615 615 $ rm large8
616 616 $ hg ci -Am 'this used to not notice the rm'
617 617 removing large8
618 618 Invoking status precommit hook
619 619 R large8
620 620 Invoking status postcommit hook
621 621 C normal
622 622 C normal3
623 623 C sub/large4
624 624 C sub/normal4
625 625 C sub2/large6
626 626 C sub2/large7
627 627
628 628 Test that a standin can't be added as a large file
629 629
630 630 $ touch large
631 631 $ hg add --large large
632 632 $ hg ci -m "add"
633 633 Invoking status precommit hook
634 634 A large
635 635 Invoking status postcommit hook
636 636 C large
637 637 C normal
638 638 C normal3
639 639 C sub/large4
640 640 C sub/normal4
641 641 C sub2/large6
642 642 C sub2/large7
643 643 $ hg remove large
644 644 $ touch large
645 645 $ hg addremove --config largefiles.patterns=**large --traceback
646 646 adding large as a largefile
647 647
648 648 Test that outgoing --large works (with revsets too)
649 649 $ hg outgoing --rev '.^' --large
650 650 comparing with $TESTTMP/a (glob)
651 651 searching for changes
652 652 changeset: 8:c02fd3b77ec4
653 653 user: test
654 654 date: Thu Jan 01 00:00:00 1970 +0000
655 655 summary: add foo
656 656
657 657 changeset: 9:289dd08c9bbb
658 658 user: test
659 659 date: Thu Jan 01 00:00:00 1970 +0000
660 660 summary: used to say nothing changed
661 661
662 662 changeset: 10:34f23ac6ac12
663 663 user: test
664 664 date: Thu Jan 01 00:00:00 1970 +0000
665 665 summary: added
666 666
667 667 changeset: 12:710c1b2f523c
668 668 parent: 10:34f23ac6ac12
669 669 user: test
670 670 date: Thu Jan 01 00:00:00 1970 +0000
671 671 summary: removed large
672 672
673 673 changeset: 13:0a3e75774479
674 674 user: test
675 675 date: Thu Jan 01 00:00:00 1970 +0000
676 676 summary: this used to add large8 as normal and commit both
677 677
678 678 changeset: 14:84f3d378175c
679 679 user: test
680 680 date: Thu Jan 01 00:00:00 1970 +0000
681 681 summary: this used to not notice the rm
682 682
683 683 largefiles to upload (1 entities):
684 684 large8
685 685
686 686 $ cd ../a
687 687
688 688 Clone a largefiles repo.
689 689
690 690 $ hg clone . ../b
691 691 updating to branch default
692 692 getting changed largefiles
693 693 3 largefiles updated, 0 removed
694 694 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
695 695 $ cd ../b
696 696 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
697 697 7:daea875e9014 add/edit more largefiles
698 698 6:4355d653f84f edit files yet again
699 699 5:9d5af5072dbd edit files again
700 700 4:74c02385b94c move files
701 701 3:9e8fbc4bce62 copy files
702 702 2:51a0ae4d5864 remove files
703 703 1:ce8896473775 edit files
704 704 0:30d30fe6a5be add files
705 705 $ cat normal3
706 706 normal33
707 707
708 708 Test graph log
709 709
710 710 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
711 711 @ 7:daea875e9014 add/edit more largefiles
712 712 |
713 713 o 6:4355d653f84f edit files yet again
714 714 |
715 715 o 5:9d5af5072dbd edit files again
716 716 |
717 717 o 4:74c02385b94c move files
718 718 |
719 719 o 3:9e8fbc4bce62 copy files
720 720 |
721 721 o 2:51a0ae4d5864 remove files
722 722 |
723 723 o 1:ce8896473775 edit files
724 724 |
725 725 o 0:30d30fe6a5be add files
726 726
727 727
728 728 Test log with --patch
729 729
730 730 $ hg log --patch -r 6::7
731 731 changeset: 6:4355d653f84f
732 732 user: test
733 733 date: Thu Jan 01 00:00:00 1970 +0000
734 734 summary: edit files yet again
735 735
736 736 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3
737 737 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
738 738 +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
739 739 @@ -1,1 +1,1 @@
740 740 -baaf12afde9d8d67f25dab6dced0d2bf77dba47c
741 741 +7838695e10da2bb75ac1156565f40a2595fa2fa0
742 742 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
743 743 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
744 744 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
745 745 @@ -1,1 +1,1 @@
746 746 -aeb2210d19f02886dde00dac279729a48471e2f9
747 747 +971fb41e78fea4f8e0ba5244784239371cb00591
748 748 diff -r 9d5af5072dbd -r 4355d653f84f normal3
749 749 --- a/normal3 Thu Jan 01 00:00:00 1970 +0000
750 750 +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000
751 751 @@ -1,1 +1,1 @@
752 752 -normal3
753 753 +normal33
754 754 diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4
755 755 --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
756 756 +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
757 757 @@ -1,1 +1,1 @@
758 758 -normal4
759 759 +normal44
760 760
761 761 changeset: 7:daea875e9014
762 762 tag: tip
763 763 user: test
764 764 date: Thu Jan 01 00:00:00 1970 +0000
765 765 summary: add/edit more largefiles
766 766
767 767 diff -r 4355d653f84f -r daea875e9014 .hglf/large3
768 768 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
769 769 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
770 770 @@ -1,1 +0,0 @@
771 771 -7838695e10da2bb75ac1156565f40a2595fa2fa0
772 772 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6
773 773 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
774 774 +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000
775 775 @@ -0,0 +1,1 @@
776 776 +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30
777 777 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7
778 778 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
779 779 +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000
780 780 @@ -0,0 +1,1 @@
781 781 +bb3151689acb10f0c3125c560d5e63df914bc1af
782 782
783 783
784 784 $ hg log --patch -r 6::7 sub/
785 785 changeset: 6:4355d653f84f
786 786 user: test
787 787 date: Thu Jan 01 00:00:00 1970 +0000
788 788 summary: edit files yet again
789 789
790 790 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
791 791 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
792 792 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
793 793 @@ -1,1 +1,1 @@
794 794 -aeb2210d19f02886dde00dac279729a48471e2f9
795 795 +971fb41e78fea4f8e0ba5244784239371cb00591
796 796 diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4
797 797 --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
798 798 +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
799 799 @@ -1,1 +1,1 @@
800 800 -normal4
801 801 +normal44
802 802
803 803
804 804 log with both --follow and --patch
805 805
806 806 $ hg log --follow --patch --limit 2
807 807 changeset: 7:daea875e9014
808 808 tag: tip
809 809 user: test
810 810 date: Thu Jan 01 00:00:00 1970 +0000
811 811 summary: add/edit more largefiles
812 812
813 813 diff -r 4355d653f84f -r daea875e9014 .hglf/large3
814 814 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
815 815 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
816 816 @@ -1,1 +0,0 @@
817 817 -7838695e10da2bb75ac1156565f40a2595fa2fa0
818 818 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6
819 819 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
820 820 +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000
821 821 @@ -0,0 +1,1 @@
822 822 +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30
823 823 diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7
824 824 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
825 825 +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000
826 826 @@ -0,0 +1,1 @@
827 827 +bb3151689acb10f0c3125c560d5e63df914bc1af
828 828
829 829 changeset: 6:4355d653f84f
830 830 user: test
831 831 date: Thu Jan 01 00:00:00 1970 +0000
832 832 summary: edit files yet again
833 833
834 834 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3
835 835 --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
836 836 +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000
837 837 @@ -1,1 +1,1 @@
838 838 -baaf12afde9d8d67f25dab6dced0d2bf77dba47c
839 839 +7838695e10da2bb75ac1156565f40a2595fa2fa0
840 840 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
841 841 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
842 842 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
843 843 @@ -1,1 +1,1 @@
844 844 -aeb2210d19f02886dde00dac279729a48471e2f9
845 845 +971fb41e78fea4f8e0ba5244784239371cb00591
846 846 diff -r 9d5af5072dbd -r 4355d653f84f normal3
847 847 --- a/normal3 Thu Jan 01 00:00:00 1970 +0000
848 848 +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000
849 849 @@ -1,1 +1,1 @@
850 850 -normal3
851 851 +normal33
852 852 diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4
853 853 --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
854 854 +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000
855 855 @@ -1,1 +1,1 @@
856 856 -normal4
857 857 +normal44
858 858
859 859 $ hg log --follow --patch sub/large4
860 860 changeset: 6:4355d653f84f
861 861 user: test
862 862 date: Thu Jan 01 00:00:00 1970 +0000
863 863 summary: edit files yet again
864 864
865 865 diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4
866 866 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
867 867 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
868 868 @@ -1,1 +1,1 @@
869 869 -aeb2210d19f02886dde00dac279729a48471e2f9
870 870 +971fb41e78fea4f8e0ba5244784239371cb00591
871 871
872 872 changeset: 5:9d5af5072dbd
873 873 user: test
874 874 date: Thu Jan 01 00:00:00 1970 +0000
875 875 summary: edit files again
876 876
877 877 diff -r 74c02385b94c -r 9d5af5072dbd .hglf/sub/large4
878 878 --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
879 879 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
880 880 @@ -1,1 +1,1 @@
881 881 -eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
882 882 +aeb2210d19f02886dde00dac279729a48471e2f9
883 883
884 884 changeset: 4:74c02385b94c
885 885 user: test
886 886 date: Thu Jan 01 00:00:00 1970 +0000
887 887 summary: move files
888 888
889 889 diff -r 9e8fbc4bce62 -r 74c02385b94c .hglf/sub/large4
890 890 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
891 891 +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000
892 892 @@ -0,0 +1,1 @@
893 893 +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
894 894
895 895 changeset: 1:ce8896473775
896 896 user: test
897 897 date: Thu Jan 01 00:00:00 1970 +0000
898 898 summary: edit files
899 899
900 900 diff -r 30d30fe6a5be -r ce8896473775 .hglf/sub/large2
901 901 --- a/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000
902 902 +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000
903 903 @@ -1,1 +1,1 @@
904 904 -1deebade43c8c498a3c8daddac0244dc55d1331d
905 905 +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
906 906
907 907 changeset: 0:30d30fe6a5be
908 908 user: test
909 909 date: Thu Jan 01 00:00:00 1970 +0000
910 910 summary: add files
911 911
912 912 diff -r 000000000000 -r 30d30fe6a5be .hglf/sub/large2
913 913 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
914 914 +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000
915 915 @@ -0,0 +1,1 @@
916 916 +1deebade43c8c498a3c8daddac0244dc55d1331d
917 917
918 918 $ cat sub/normal4
919 919 normal44
920 920 $ cat sub/large4
921 921 large44
922 922 $ cat sub2/large6
923 923 large6
924 924 $ cat sub2/large7
925 925 large7
926 926 $ hg log -qf sub2/large7
927 927 7:daea875e9014
928 928 $ hg log -Gqf sub2/large7
929 929 @ 7:daea875e9014
930 930 |
931 931 $ cd ..
932 932
933 933 Test log from outside repo
934 934
935 935 $ hg log b/sub -T '{rev}:{node|short} {desc|firstline}\n'
936 936 6:4355d653f84f edit files yet again
937 937 5:9d5af5072dbd edit files again
938 938 4:74c02385b94c move files
939 939 1:ce8896473775 edit files
940 940 0:30d30fe6a5be add files
941 941
942 942 Test clone at revision
943 943
944 944 $ hg clone a -r 3 c
945 945 adding changesets
946 946 adding manifests
947 947 adding file changes
948 948 added 4 changesets with 10 changes to 4 files
949 949 updating to branch default
950 950 getting changed largefiles
951 951 2 largefiles updated, 0 removed
952 952 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
953 953 $ cd c
954 954 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
955 955 3:9e8fbc4bce62 copy files
956 956 2:51a0ae4d5864 remove files
957 957 1:ce8896473775 edit files
958 958 0:30d30fe6a5be add files
959 959 $ cat normal1
960 960 normal22
961 961 $ cat large1
962 962 large22
963 963 $ cat sub/normal2
964 964 normal22
965 965 $ cat sub/large2
966 966 large22
967 967
968 968 Old revisions of a clone have correct largefiles content (this also
969 969 tests update).
970 970
971 971 $ hg update -r 1
972 972 getting changed largefiles
973 973 1 largefiles updated, 0 removed
974 974 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
975 975 $ cat large1
976 976 large11
977 977 $ cat sub/large2
978 978 large22
979 979 $ cd ..
980 980
981 981 Test cloning with --all-largefiles flag
982 982
983 983 $ rm "${USERCACHE}"/*
984 984 $ hg clone --all-largefiles a a-backup
985 985 updating to branch default
986 986 getting changed largefiles
987 987 3 largefiles updated, 0 removed
988 988 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
989 989 8 additional largefiles cached
990 990
991 991 $ rm "${USERCACHE}"/*
992 992 $ hg clone --all-largefiles -u 0 a a-clone0
993 993 updating to branch default
994 994 getting changed largefiles
995 995 2 largefiles updated, 0 removed
996 996 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
997 997 9 additional largefiles cached
998 998 $ hg -R a-clone0 sum
999 999 parent: 0:30d30fe6a5be
1000 1000 add files
1001 1001 branch: default
1002 1002 commit: (clean)
1003 1003 update: 7 new changesets (update)
1004 1004
1005 1005 $ rm "${USERCACHE}"/*
1006 1006 $ hg clone --all-largefiles -u 1 a a-clone1
1007 1007 updating to branch default
1008 1008 getting changed largefiles
1009 1009 2 largefiles updated, 0 removed
1010 1010 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1011 1011 8 additional largefiles cached
1012 1012 $ hg -R a-clone1 verify --large --lfa --lfc
1013 1013 checking changesets
1014 1014 checking manifests
1015 1015 crosschecking files in changesets and manifests
1016 1016 checking files
1017 1017 10 files, 8 changesets, 24 total revisions
1018 1018 searching 8 changesets for largefiles
1019 1019 verified contents of 13 revisions of 6 largefiles
1020 1020 $ hg -R a-clone1 sum
1021 1021 parent: 1:ce8896473775
1022 1022 edit files
1023 1023 branch: default
1024 1024 commit: (clean)
1025 1025 update: 6 new changesets (update)
1026 1026
1027 1027 $ rm "${USERCACHE}"/*
1028 1028 $ hg clone --all-largefiles -U a a-clone-u
1029 1029 11 additional largefiles cached
1030 1030 $ hg -R a-clone-u sum
1031 1031 parent: -1:000000000000 (no revision checked out)
1032 1032 branch: default
1033 1033 commit: (clean)
1034 1034 update: 8 new changesets (update)
1035 1035
1036 1036 Show computed destination directory:
1037 1037
1038 1038 $ mkdir xyz
1039 1039 $ cd xyz
1040 1040 $ hg clone ../a
1041 1041 destination directory: a
1042 1042 updating to branch default
1043 1043 getting changed largefiles
1044 1044 3 largefiles updated, 0 removed
1045 1045 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1046 1046 $ cd ..
1047 1047
1048 1048 Clone URL without path:
1049 1049
1050 1050 $ hg clone file://
1051 1051 abort: repository / not found!
1052 1052 [255]
1053 1053
1054 1054 Ensure base clone command argument validation
1055 1055
1056 1056 $ hg clone -U -u 0 a a-clone-failure
1057 1057 abort: cannot specify both --noupdate and --updaterev
1058 1058 [255]
1059 1059
1060 1060 $ hg clone --all-largefiles a ssh://localhost/a
1061 1061 abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a
1062 1062 [255]
1063 1063
1064 1064 Test pulling with --all-largefiles flag. Also test that the largefiles are
1065 1065 downloaded from 'default' instead of 'default-push' when no source is specified
1066 1066 (issue3584)
1067 1067
1068 1068 $ rm -Rf a-backup
1069 1069 $ hg clone -r 1 a a-backup
1070 1070 adding changesets
1071 1071 adding manifests
1072 1072 adding file changes
1073 1073 added 2 changesets with 8 changes to 4 files
1074 1074 updating to branch default
1075 1075 getting changed largefiles
1076 1076 2 largefiles updated, 0 removed
1077 1077 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1078 1078 $ rm "${USERCACHE}"/*
1079 1079 $ cd a-backup
1080 1080 $ hg pull --all-largefiles --config paths.default-push=bogus/path
1081 1081 pulling from $TESTTMP/a (glob)
1082 1082 searching for changes
1083 1083 adding changesets
1084 1084 adding manifests
1085 1085 adding file changes
1086 1086 added 6 changesets with 16 changes to 8 files
1087 1087 (run 'hg update' to get a working copy)
1088 1088 6 largefiles cached
1089 1089
1090 1090 redo pull with --lfrev and check it pulls largefiles for the right revs
1091 1091
1092 1092 $ hg rollback
1093 1093 repository tip rolled back to revision 1 (undo pull)
1094 1094 $ hg pull -v --lfrev 'heads(pulled())+min(pulled())'
1095 1095 pulling from $TESTTMP/a (glob)
1096 1096 searching for changes
1097 1097 all local heads known remotely
1098 1098 6 changesets found
1099 1099 adding changesets
1100 1100 adding manifests
1101 1101 adding file changes
1102 1102 added 6 changesets with 16 changes to 8 files
1103 1103 calling hook changegroup.lfiles: hgext.largefiles.reposetup.checkrequireslfiles
1104 1104 (run 'hg update' to get a working copy)
1105 1105 pulling largefiles for revision 7
1106 1106 found 971fb41e78fea4f8e0ba5244784239371cb00591 in store
1107 1107 found 0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 in store
1108 1108 found bb3151689acb10f0c3125c560d5e63df914bc1af in store
1109 1109 pulling largefiles for revision 2
1110 1110 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1111 1111 0 largefiles cached
1112 1112
1113 1113 lfpull
1114 1114
1115 1115 $ hg lfpull -r : --config largefiles.usercache=usercache-lfpull
1116 1116 2 largefiles cached
1117 1117 $ hg lfpull -v -r 4+2 --config largefiles.usercache=usercache-lfpull
1118 1118 pulling largefiles for revision 4
1119 1119 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1120 1120 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1121 1121 pulling largefiles for revision 2
1122 1122 found eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 in store
1123 1123 0 largefiles cached
1124 1124
1125 1125 $ ls usercache-lfpull/* | sort
1126 1126 usercache-lfpull/1deebade43c8c498a3c8daddac0244dc55d1331d
1127 1127 usercache-lfpull/4669e532d5b2c093a78eca010077e708a071bb64
1128 1128
1129 1129 $ cd ..
1130 1130
1131 1131 Rebasing between two repositories does not revert largefiles to old
1132 1132 revisions (this was a very bad bug that took a lot of work to fix).
1133 1133
1134 1134 $ hg clone a d
1135 1135 updating to branch default
1136 1136 getting changed largefiles
1137 1137 3 largefiles updated, 0 removed
1138 1138 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1139 1139 $ cd b
1140 1140 $ echo large4-modified > sub/large4
1141 1141 $ echo normal3-modified > normal3
1142 1142 $ hg commit -m "modify normal file and largefile in repo b"
1143 1143 Invoking status precommit hook
1144 1144 M normal3
1145 1145 M sub/large4
1146 1146 $ cd ../d
1147 1147 $ echo large6-modified > sub2/large6
1148 1148 $ echo normal4-modified > sub/normal4
1149 1149 $ hg commit -m "modify normal file largefile in repo d"
1150 1150 Invoking status precommit hook
1151 1151 M sub/normal4
1152 1152 M sub2/large6
1153 1153 $ cd ..
1154 1154 $ hg clone d e
1155 1155 updating to branch default
1156 1156 getting changed largefiles
1157 1157 3 largefiles updated, 0 removed
1158 1158 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1159 1159 $ cd d
1160 1160
1161 1161 More rebase testing, but also test that the largefiles are downloaded from
1162 1162 'default-push' when no source is specified (issue3584). (The largefile from the
1163 1163 pulled revision is however not downloaded but found in the local cache.)
1164 1164 Largefiles are fetched for the new pulled revision, not for existing revisions,
1165 1165 rebased or not.
1166 1166
1167 1167 $ [ ! -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
1168 1168 $ hg pull --rebase --all-largefiles --config paths.default-push=bogus/path --config paths.default=../b
1169 1169 pulling from $TESTTMP/b (glob)
1170 1170 searching for changes
1171 1171 adding changesets
1172 1172 adding manifests
1173 1173 adding file changes
1174 1174 added 1 changesets with 2 changes to 2 files (+1 heads)
1175 0 largefiles cached
1175 1176 Invoking status precommit hook
1176 1177 M sub/normal4
1177 1178 M sub2/large6
1178 1179 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
1179 0 largefiles cached
1180 nothing to rebase - working directory parent is also destination
1181 1180 $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
1182 1181 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1183 1182 9:598410d3eb9a modify normal file largefile in repo d
1184 1183 8:a381d2c8c80e modify normal file and largefile in repo b
1185 1184 7:daea875e9014 add/edit more largefiles
1186 1185 6:4355d653f84f edit files yet again
1187 1186 5:9d5af5072dbd edit files again
1188 1187 4:74c02385b94c move files
1189 1188 3:9e8fbc4bce62 copy files
1190 1189 2:51a0ae4d5864 remove files
1191 1190 1:ce8896473775 edit files
1192 1191 0:30d30fe6a5be add files
1193 1192 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n'
1194 1193 @ 9:598410d3eb9a modify normal file largefile in repo d
1195 1194 |
1196 1195 o 8:a381d2c8c80e modify normal file and largefile in repo b
1197 1196 |
1198 1197 o 7:daea875e9014 add/edit more largefiles
1199 1198 |
1200 1199 o 6:4355d653f84f edit files yet again
1201 1200 |
1202 1201 o 5:9d5af5072dbd edit files again
1203 1202 |
1204 1203 o 4:74c02385b94c move files
1205 1204 |
1206 1205 o 3:9e8fbc4bce62 copy files
1207 1206 |
1208 1207 o 2:51a0ae4d5864 remove files
1209 1208 |
1210 1209 o 1:ce8896473775 edit files
1211 1210 |
1212 1211 o 0:30d30fe6a5be add files
1213 1212
1214 1213 $ cat normal3
1215 1214 normal3-modified
1216 1215 $ cat sub/normal4
1217 1216 normal4-modified
1218 1217 $ cat sub/large4
1219 1218 large4-modified
1220 1219 $ cat sub2/large6
1221 1220 large6-modified
1222 1221 $ cat sub2/large7
1223 1222 large7
1224 1223 $ cd ../e
1225 1224 $ hg pull ../b
1226 1225 pulling from ../b
1227 1226 searching for changes
1228 1227 adding changesets
1229 1228 adding manifests
1230 1229 adding file changes
1231 1230 added 1 changesets with 2 changes to 2 files (+1 heads)
1232 1231 (run 'hg heads' to see heads, 'hg merge' to merge)
1233 1232 $ hg rebase
1234 1233 Invoking status precommit hook
1235 1234 M sub/normal4
1236 1235 M sub2/large6
1237 1236 saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
1238 1237 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1239 1238 9:598410d3eb9a modify normal file largefile in repo d
1240 1239 8:a381d2c8c80e modify normal file and largefile in repo b
1241 1240 7:daea875e9014 add/edit more largefiles
1242 1241 6:4355d653f84f edit files yet again
1243 1242 5:9d5af5072dbd edit files again
1244 1243 4:74c02385b94c move files
1245 1244 3:9e8fbc4bce62 copy files
1246 1245 2:51a0ae4d5864 remove files
1247 1246 1:ce8896473775 edit files
1248 1247 0:30d30fe6a5be add files
1249 1248 $ cat normal3
1250 1249 normal3-modified
1251 1250 $ cat sub/normal4
1252 1251 normal4-modified
1253 1252 $ cat sub/large4
1254 1253 large4-modified
1255 1254 $ cat sub2/large6
1256 1255 large6-modified
1257 1256 $ cat sub2/large7
1258 1257 large7
1259 1258
1260 1259 Log on largefiles
1261 1260
1262 1261 - same output
1263 1262 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1264 1263 8:a381d2c8c80e modify normal file and largefile in repo b
1265 1264 6:4355d653f84f edit files yet again
1266 1265 5:9d5af5072dbd edit files again
1267 1266 4:74c02385b94c move files
1268 1267 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1269 1268 o 8:a381d2c8c80e modify normal file and largefile in repo b
1270 1269 |
1271 1270 o 6:4355d653f84f edit files yet again
1272 1271 |
1273 1272 o 5:9d5af5072dbd edit files again
1274 1273 |
1275 1274 o 4:74c02385b94c move files
1276 1275 |
1277 1276 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub/large4
1278 1277 8:a381d2c8c80e modify normal file and largefile in repo b
1279 1278 6:4355d653f84f edit files yet again
1280 1279 5:9d5af5072dbd edit files again
1281 1280 4:74c02385b94c move files
1282 1281 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub/large4
1283 1282 o 8:a381d2c8c80e modify normal file and largefile in repo b
1284 1283 |
1285 1284 o 6:4355d653f84f edit files yet again
1286 1285 |
1287 1286 o 5:9d5af5072dbd edit files again
1288 1287 |
1289 1288 o 4:74c02385b94c move files
1290 1289 |
1291 1290
1292 1291 - .hglf only matches largefiles, without .hglf it matches 9 bco sub/normal
1293 1292 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1294 1293 8:a381d2c8c80e modify normal file and largefile in repo b
1295 1294 6:4355d653f84f edit files yet again
1296 1295 5:9d5af5072dbd edit files again
1297 1296 4:74c02385b94c move files
1298 1297 1:ce8896473775 edit files
1299 1298 0:30d30fe6a5be add files
1300 1299 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' .hglf/sub
1301 1300 o 8:a381d2c8c80e modify normal file and largefile in repo b
1302 1301 |
1303 1302 o 6:4355d653f84f edit files yet again
1304 1303 |
1305 1304 o 5:9d5af5072dbd edit files again
1306 1305 |
1307 1306 o 4:74c02385b94c move files
1308 1307 |
1309 1308 o 1:ce8896473775 edit files
1310 1309 |
1311 1310 o 0:30d30fe6a5be add files
1312 1311
1313 1312 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' sub
1314 1313 9:598410d3eb9a modify normal file largefile in repo d
1315 1314 8:a381d2c8c80e modify normal file and largefile in repo b
1316 1315 6:4355d653f84f edit files yet again
1317 1316 5:9d5af5072dbd edit files again
1318 1317 4:74c02385b94c move files
1319 1318 1:ce8896473775 edit files
1320 1319 0:30d30fe6a5be add files
1321 1320 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' sub
1322 1321 @ 9:598410d3eb9a modify normal file largefile in repo d
1323 1322 |
1324 1323 o 8:a381d2c8c80e modify normal file and largefile in repo b
1325 1324 |
1326 1325 o 6:4355d653f84f edit files yet again
1327 1326 |
1328 1327 o 5:9d5af5072dbd edit files again
1329 1328 |
1330 1329 o 4:74c02385b94c move files
1331 1330 |
1332 1331 o 1:ce8896473775 edit files
1333 1332 |
1334 1333 o 0:30d30fe6a5be add files
1335 1334
1336 1335 - globbing gives same result
1337 1336 $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1338 1337 9:598410d3eb9a modify normal file largefile in repo d
1339 1338 8:a381d2c8c80e modify normal file and largefile in repo b
1340 1339 6:4355d653f84f edit files yet again
1341 1340 5:9d5af5072dbd edit files again
1342 1341 4:74c02385b94c move files
1343 1342 1:ce8896473775 edit files
1344 1343 0:30d30fe6a5be add files
1345 1344 $ hg log -G --template '{rev}:{node|short} {desc|firstline}\n' 'glob:sub/*'
1346 1345 @ 9:598410d3eb9a modify normal file largefile in repo d
1347 1346 |
1348 1347 o 8:a381d2c8c80e modify normal file and largefile in repo b
1349 1348 |
1350 1349 o 6:4355d653f84f edit files yet again
1351 1350 |
1352 1351 o 5:9d5af5072dbd edit files again
1353 1352 |
1354 1353 o 4:74c02385b94c move files
1355 1354 |
1356 1355 o 1:ce8896473775 edit files
1357 1356 |
1358 1357 o 0:30d30fe6a5be add files
1359 1358
1360 1359 Rollback on largefiles.
1361 1360
1362 1361 $ echo large4-modified-again > sub/large4
1363 1362 $ hg commit -m "Modify large4 again"
1364 1363 Invoking status precommit hook
1365 1364 M sub/large4
1366 1365 $ hg rollback
1367 1366 repository tip rolled back to revision 9 (undo commit)
1368 1367 working directory now based on revision 9
1369 1368 $ hg st
1370 1369 M sub/large4
1371 1370 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1372 1371 9:598410d3eb9a modify normal file largefile in repo d
1373 1372 8:a381d2c8c80e modify normal file and largefile in repo b
1374 1373 7:daea875e9014 add/edit more largefiles
1375 1374 6:4355d653f84f edit files yet again
1376 1375 5:9d5af5072dbd edit files again
1377 1376 4:74c02385b94c move files
1378 1377 3:9e8fbc4bce62 copy files
1379 1378 2:51a0ae4d5864 remove files
1380 1379 1:ce8896473775 edit files
1381 1380 0:30d30fe6a5be add files
1382 1381 $ cat sub/large4
1383 1382 large4-modified-again
1384 1383
1385 1384 "update --check" refuses to update with uncommitted changes.
1386 1385 $ hg update --check 8
1387 1386 abort: uncommitted changes
1388 1387 [255]
1389 1388
1390 1389 "update --clean" leaves correct largefiles in working copy, even when there is
1391 1390 .orig files from revert in .hglf.
1392 1391
1393 1392 $ echo mistake > sub2/large7
1394 1393 $ hg revert sub2/large7
1395 1394 $ cat sub2/large7
1396 1395 large7
1397 1396 $ cat sub2/large7.orig
1398 1397 mistake
1399 1398 $ test ! -f .hglf/sub2/large7.orig
1400 1399
1401 1400 $ hg -q update --clean -r null
1402 1401 $ hg update --clean
1403 1402 getting changed largefiles
1404 1403 3 largefiles updated, 0 removed
1405 1404 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1406 1405 $ cat normal3
1407 1406 normal3-modified
1408 1407 $ cat sub/normal4
1409 1408 normal4-modified
1410 1409 $ cat sub/large4
1411 1410 large4-modified
1412 1411 $ cat sub2/large6
1413 1412 large6-modified
1414 1413 $ cat sub2/large7
1415 1414 large7
1416 1415 $ cat sub2/large7.orig
1417 1416 mistake
1418 1417 $ test ! -f .hglf/sub2/large7.orig
1419 1418
1420 1419 verify that largefile .orig file no longer is overwritten on every update -C:
1421 1420 $ hg update --clean
1422 1421 getting changed largefiles
1423 1422 0 largefiles updated, 0 removed
1424 1423 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1425 1424 $ cat sub2/large7.orig
1426 1425 mistake
1427 1426 $ rm sub2/large7.orig
1428 1427
1429 1428 Now "update check" is happy.
1430 1429 $ hg update --check 8
1431 1430 getting changed largefiles
1432 1431 1 largefiles updated, 0 removed
1433 1432 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1434 1433 $ hg update --check
1435 1434 getting changed largefiles
1436 1435 1 largefiles updated, 0 removed
1437 1436 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1438 1437
1439 1438 Test removing empty largefiles directories on update
1440 1439 $ test -d sub2 && echo "sub2 exists"
1441 1440 sub2 exists
1442 1441 $ hg update -q null
1443 1442 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1444 1443 [1]
1445 1444 $ hg update -q
1446 1445
1447 1446 Test hg remove removes empty largefiles directories
1448 1447 $ test -d sub2 && echo "sub2 exists"
1449 1448 sub2 exists
1450 1449 $ hg remove sub2/*
1451 1450 $ test -d sub2 && echo "error: sub2 should not exist anymore"
1452 1451 [1]
1453 1452 $ hg revert sub2/large6 sub2/large7
1454 1453
1455 1454 "revert" works on largefiles (and normal files too).
1456 1455 $ echo hack3 >> normal3
1457 1456 $ echo hack4 >> sub/normal4
1458 1457 $ echo hack4 >> sub/large4
1459 1458 $ rm sub2/large6
1460 1459 $ hg revert sub2/large6
1461 1460 $ hg rm sub2/large6
1462 1461 $ echo new >> sub2/large8
1463 1462 $ hg add --large sub2/large8
1464 1463 # XXX we don't really want to report that we're reverting the standin;
1465 1464 # that's just an implementation detail. But I don't see an obvious fix. ;-(
1466 1465 $ hg revert sub
1467 1466 reverting .hglf/sub/large4 (glob)
1468 1467 reverting sub/normal4 (glob)
1469 1468 $ hg status
1470 1469 M normal3
1471 1470 A sub2/large8
1472 1471 R sub2/large6
1473 1472 ? sub/large4.orig
1474 1473 ? sub/normal4.orig
1475 1474 $ cat sub/normal4
1476 1475 normal4-modified
1477 1476 $ cat sub/large4
1478 1477 large4-modified
1479 1478 $ hg revert -a --no-backup
1480 1479 undeleting .hglf/sub2/large6 (glob)
1481 1480 forgetting .hglf/sub2/large8 (glob)
1482 1481 reverting normal3
1483 1482 $ hg status
1484 1483 ? sub/large4.orig
1485 1484 ? sub/normal4.orig
1486 1485 ? sub2/large8
1487 1486 $ cat normal3
1488 1487 normal3-modified
1489 1488 $ cat sub2/large6
1490 1489 large6-modified
1491 1490 $ rm sub/*.orig sub2/large8
1492 1491
1493 1492 revert some files to an older revision
1494 1493 $ hg revert --no-backup -r 8 sub2
1495 1494 reverting .hglf/sub2/large6 (glob)
1496 1495 $ cat sub2/large6
1497 1496 large6
1498 1497 $ hg revert --no-backup -C -r '.^' sub2
1499 1498 $ hg revert --no-backup sub2
1500 1499 reverting .hglf/sub2/large6 (glob)
1501 1500 $ hg status
1502 1501
1503 1502 "verify --large" actually verifies largefiles
1504 1503
1505 1504 - Where Do We Come From? What Are We? Where Are We Going?
1506 1505 $ pwd
1507 1506 $TESTTMP/e
1508 1507 $ hg paths
1509 1508 default = $TESTTMP/d (glob)
1510 1509
1511 1510 $ hg verify --large
1512 1511 checking changesets
1513 1512 checking manifests
1514 1513 crosschecking files in changesets and manifests
1515 1514 checking files
1516 1515 10 files, 10 changesets, 28 total revisions
1517 1516 searching 1 changesets for largefiles
1518 1517 verified existence of 3 revisions of 3 largefiles
1519 1518
1520 1519 - introduce missing blob in local store repo and make sure that this is caught:
1521 1520 $ mv $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 .
1522 1521 $ hg verify --large
1523 1522 checking changesets
1524 1523 checking manifests
1525 1524 crosschecking files in changesets and manifests
1526 1525 checking files
1527 1526 10 files, 10 changesets, 28 total revisions
1528 1527 searching 1 changesets for largefiles
1529 1528 changeset 9:598410d3eb9a: sub/large4 references missing $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob)
1530 1529 verified existence of 3 revisions of 3 largefiles
1531 1530 [1]
1532 1531
1533 1532 - introduce corruption and make sure that it is caught when checking content:
1534 1533 $ echo '5 cents' > $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928
1535 1534 $ hg verify -q --large --lfc
1536 1535 changeset 9:598410d3eb9a: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 (glob)
1537 1536 [1]
1538 1537
1539 1538 - cleanup
1540 1539 $ mv e166e74c7303192238d60af5a9c4ce9bef0b7928 $TESTTMP/d/.hg/largefiles/
1541 1540
1542 1541 - verifying all revisions will fail because we didn't clone all largefiles to d:
1543 1542 $ echo 'T-shirt' > $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1544 1543 $ hg verify -q --lfa --lfc
1545 1544 changeset 0:30d30fe6a5be: large1 references missing $TESTTMP/d/.hg/largefiles/4669e532d5b2c093a78eca010077e708a071bb64 (glob)
1546 1545 changeset 0:30d30fe6a5be: sub/large2 references missing $TESTTMP/d/.hg/largefiles/1deebade43c8c498a3c8daddac0244dc55d1331d (glob)
1547 1546 changeset 1:ce8896473775: large1 references missing $TESTTMP/d/.hg/largefiles/5f78770c0e77ba4287ad6ef3071c9bf9c379742f (glob)
1548 1547 changeset 1:ce8896473775: sub/large2 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1549 1548 changeset 3:9e8fbc4bce62: large1 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1550 1549 changeset 4:74c02385b94c: large3 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1551 1550 changeset 4:74c02385b94c: sub/large4 references corrupted $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 (glob)
1552 1551 changeset 5:9d5af5072dbd: large3 references missing $TESTTMP/d/.hg/largefiles/baaf12afde9d8d67f25dab6dced0d2bf77dba47c (glob)
1553 1552 changeset 5:9d5af5072dbd: sub/large4 references missing $TESTTMP/d/.hg/largefiles/aeb2210d19f02886dde00dac279729a48471e2f9 (glob)
1554 1553 changeset 6:4355d653f84f: large3 references missing $TESTTMP/d/.hg/largefiles/7838695e10da2bb75ac1156565f40a2595fa2fa0 (glob)
1555 1554 [1]
1556 1555
1557 1556 - cleanup
1558 1557 $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
1559 1558 $ rm -f .hglf/sub/*.orig
1560 1559
1561 1560 Update to revision with missing largefile - and make sure it really is missing
1562 1561
1563 1562 $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0
1564 1563 $ hg up -r 6
1565 1564 getting changed largefiles
1566 1565 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1567 1566 1 largefiles updated, 2 removed
1568 1567 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
1569 1568 $ rm normal3
1570 1569 $ echo >> sub/normal4
1571 1570 $ hg ci -m 'commit with missing files'
1572 1571 Invoking status precommit hook
1573 1572 M sub/normal4
1574 1573 ! large3
1575 1574 ! normal3
1576 1575 created new head
1577 1576 $ hg st
1578 1577 ! large3
1579 1578 ! normal3
1580 1579 $ hg up -r.
1581 1580 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1582 1581 $ hg st
1583 1582 ! large3
1584 1583 ! normal3
1585 1584 $ hg up -Cr.
1586 1585 getting changed largefiles
1587 1586 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1588 1587 0 largefiles updated, 0 removed
1589 1588 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1590 1589 $ hg st
1591 1590 ! large3
1592 1591 $ hg rollback
1593 1592 repository tip rolled back to revision 9 (undo commit)
1594 1593 working directory now based on revision 6
1595 1594
1596 1595 Merge with revision with missing largefile - and make sure it tries to fetch it.
1597 1596
1598 1597 $ hg up -Cqr null
1599 1598 $ echo f > f
1600 1599 $ hg ci -Am branch
1601 1600 adding f
1602 1601 Invoking status precommit hook
1603 1602 A f
1604 1603 created new head
1605 1604 $ hg merge -r 6
1606 1605 getting changed largefiles
1607 1606 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1608 1607 1 largefiles updated, 0 removed
1609 1608 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1610 1609 (branch merge, don't forget to commit)
1611 1610
1612 1611 $ hg rollback -q
1613 1612 $ hg up -Cq
1614 1613
1615 1614 Pulling 0 revisions with --all-largefiles should not fetch for all revisions
1616 1615
1617 1616 $ hg pull --all-largefiles
1618 1617 pulling from $TESTTMP/d (glob)
1619 1618 searching for changes
1620 1619 no changes found
1621 1620
1622 1621 Merging does not revert to old versions of largefiles and also check
1623 1622 that merging after having pulled from a non-default remote works
1624 1623 correctly.
1625 1624
1626 1625 $ cd ..
1627 1626 $ hg clone -r 7 e temp
1628 1627 adding changesets
1629 1628 adding manifests
1630 1629 adding file changes
1631 1630 added 8 changesets with 24 changes to 10 files
1632 1631 updating to branch default
1633 1632 getting changed largefiles
1634 1633 3 largefiles updated, 0 removed
1635 1634 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1636 1635 $ hg clone temp f
1637 1636 updating to branch default
1638 1637 getting changed largefiles
1639 1638 3 largefiles updated, 0 removed
1640 1639 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1641 1640 # Delete the largefiles in the largefiles system cache so that we have an
1642 1641 # opportunity to test that caching after a pull works.
1643 1642 $ rm "${USERCACHE}"/*
1644 1643 $ cd f
1645 1644 $ echo "large4-merge-test" > sub/large4
1646 1645 $ hg commit -m "Modify large4 to test merge"
1647 1646 Invoking status precommit hook
1648 1647 M sub/large4
1649 1648 # Test --cache-largefiles flag
1650 1649 $ hg pull --lfrev 'heads(pulled())' ../e
1651 1650 pulling from ../e
1652 1651 searching for changes
1653 1652 adding changesets
1654 1653 adding manifests
1655 1654 adding file changes
1656 1655 added 2 changesets with 4 changes to 4 files (+1 heads)
1657 1656 (run 'hg heads' to see heads, 'hg merge' to merge)
1658 1657 2 largefiles cached
1659 1658 $ hg merge
1660 1659 largefile sub/large4 has a merge conflict
1661 1660 ancestor was 971fb41e78fea4f8e0ba5244784239371cb00591
1662 1661 keep (l)ocal d846f26643bfa8ec210be40cc93cc6b7ff1128ea or
1663 1662 take (o)ther e166e74c7303192238d60af5a9c4ce9bef0b7928? l
1664 1663 getting changed largefiles
1665 1664 1 largefiles updated, 0 removed
1666 1665 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
1667 1666 (branch merge, don't forget to commit)
1668 1667 $ hg commit -m "Merge repos e and f"
1669 1668 Invoking status precommit hook
1670 1669 M normal3
1671 1670 M sub/normal4
1672 1671 M sub2/large6
1673 1672 $ cat normal3
1674 1673 normal3-modified
1675 1674 $ cat sub/normal4
1676 1675 normal4-modified
1677 1676 $ cat sub/large4
1678 1677 large4-merge-test
1679 1678 $ cat sub2/large6
1680 1679 large6-modified
1681 1680 $ cat sub2/large7
1682 1681 large7
1683 1682
1684 1683 Test status after merging with a branch that introduces a new largefile:
1685 1684
1686 1685 $ echo large > large
1687 1686 $ hg add --large large
1688 1687 $ hg commit -m 'add largefile'
1689 1688 Invoking status precommit hook
1690 1689 A large
1691 1690 $ hg update -q ".^"
1692 1691 $ echo change >> normal3
1693 1692 $ hg commit -m 'some change'
1694 1693 Invoking status precommit hook
1695 1694 M normal3
1696 1695 created new head
1697 1696 $ hg merge
1698 1697 getting changed largefiles
1699 1698 1 largefiles updated, 0 removed
1700 1699 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1701 1700 (branch merge, don't forget to commit)
1702 1701 $ hg status
1703 1702 M large
1704 1703
1705 1704 - make sure update of merge with removed largefiles fails as expected
1706 1705 $ hg rm sub2/large6
1707 1706 $ hg up -r.
1708 1707 abort: outstanding uncommitted merge
1709 1708 [255]
1710 1709
1711 1710 - revert should be able to revert files introduced in a pending merge
1712 1711 $ hg revert --all -r .
1713 1712 removing .hglf/large (glob)
1714 1713 undeleting .hglf/sub2/large6 (glob)
1715 1714
1716 1715 Test that a normal file and a largefile with the same name and path cannot
1717 1716 coexist.
1718 1717
1719 1718 $ rm sub2/large7
1720 1719 $ echo "largeasnormal" > sub2/large7
1721 1720 $ hg add sub2/large7
1722 1721 sub2/large7 already a largefile
1723 1722
1724 1723 Test that transplanting a largefile change works correctly.
1725 1724
1726 1725 $ cd ..
1727 1726 $ hg clone -r 8 d g
1728 1727 adding changesets
1729 1728 adding manifests
1730 1729 adding file changes
1731 1730 added 9 changesets with 26 changes to 10 files
1732 1731 updating to branch default
1733 1732 getting changed largefiles
1734 1733 3 largefiles updated, 0 removed
1735 1734 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
1736 1735 $ cd g
1737 1736 $ hg transplant -s ../d 598410d3eb9a
1738 1737 searching for changes
1739 1738 searching for changes
1740 1739 adding changesets
1741 1740 adding manifests
1742 1741 adding file changes
1743 1742 added 1 changesets with 2 changes to 2 files
1744 1743 getting changed largefiles
1745 1744 0 largefiles updated, 0 removed
1746 1745 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1747 1746 9:598410d3eb9a modify normal file largefile in repo d
1748 1747 8:a381d2c8c80e modify normal file and largefile in repo b
1749 1748 7:daea875e9014 add/edit more largefiles
1750 1749 6:4355d653f84f edit files yet again
1751 1750 5:9d5af5072dbd edit files again
1752 1751 4:74c02385b94c move files
1753 1752 3:9e8fbc4bce62 copy files
1754 1753 2:51a0ae4d5864 remove files
1755 1754 1:ce8896473775 edit files
1756 1755 0:30d30fe6a5be add files
1757 1756 $ cat normal3
1758 1757 normal3-modified
1759 1758 $ cat sub/normal4
1760 1759 normal4-modified
1761 1760 $ cat sub/large4
1762 1761 large4-modified
1763 1762 $ cat sub2/large6
1764 1763 large6-modified
1765 1764 $ cat sub2/large7
1766 1765 large7
1767 1766
1768 1767 Cat a largefile
1769 1768 $ hg cat normal3
1770 1769 normal3-modified
1771 1770 $ hg cat sub/large4
1772 1771 large4-modified
1773 1772 $ rm "${USERCACHE}"/*
1774 1773 $ hg cat -r a381d2c8c80e -o cat.out sub/large4
1775 1774 $ cat cat.out
1776 1775 large4-modified
1777 1776 $ rm cat.out
1778 1777 $ hg cat -r a381d2c8c80e normal3
1779 1778 normal3-modified
1780 1779 $ hg cat -r '.^' normal3
1781 1780 normal3-modified
1782 1781 $ hg cat -r '.^' sub/large4 doesntexist
1783 1782 large4-modified
1784 1783 doesntexist: no such file in rev a381d2c8c80e
1785 1784 $ hg --cwd sub cat -r '.^' large4
1786 1785 large4-modified
1787 1786 $ hg --cwd sub cat -r '.^' ../normal3
1788 1787 normal3-modified
1789 1788 Cat a standin
1790 1789 $ hg cat .hglf/sub/large4
1791 1790 e166e74c7303192238d60af5a9c4ce9bef0b7928
1792 1791 $ hg cat .hglf/normal3
1793 1792 .hglf/normal3: no such file in rev 598410d3eb9a
1794 1793 [1]
1795 1794
1796 1795 Test that renaming a largefile results in correct output for status
1797 1796
1798 1797 $ hg rename sub/large4 large4-renamed
1799 1798 $ hg commit -m "test rename output"
1800 1799 Invoking status precommit hook
1801 1800 A large4-renamed
1802 1801 R sub/large4
1803 1802 $ cat large4-renamed
1804 1803 large4-modified
1805 1804 $ cd sub2
1806 1805 $ hg rename large6 large6-renamed
1807 1806 $ hg st
1808 1807 A sub2/large6-renamed
1809 1808 R sub2/large6
1810 1809 $ cd ..
1811 1810
1812 1811 Test --normal flag
1813 1812
1814 1813 $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null
1815 1814 $ hg add --normal --large new-largefile
1816 1815 abort: --normal cannot be used with --large
1817 1816 [255]
1818 1817 $ hg add --normal new-largefile
1819 1818 new-largefile: up to 69 MB of RAM may be required to manage this file
1820 1819 (use 'hg revert new-largefile' to cancel the pending addition)
1821 1820 $ cd ..
1822 1821
1823 1822
1824 1823
General Comments 0
You need to be logged in to leave comments. Login now