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