##// END OF EJS Templates
merge with stable
Mads Kiilerich -
r18065:2acd9c14 merge default
parent child Browse files
Show More
@@ -359,11 +359,8 b' def reposetup(ui, repo):'
359 359 lfdirstate.write()
360 360 return result
361 361
362 for f in match.files():
363 if lfutil.isstandin(f):
364 raise util.Abort(
365 _('file "%s" is a largefile standin') % f,
366 hint=('commit the largefile itself instead'))
362 lfiles = lfutil.listlfiles(self)
363 match._files = self._subdirlfs(match.files(), lfiles)
367 364
368 365 # Case 2: user calls commit with specified patterns: refresh
369 366 # any matching big files.
@@ -394,7 +391,6 b' def reposetup(ui, repo):'
394 391 # standins corresponding to the big files requested by the
395 392 # user. Have to modify _files to prevent commit() from
396 393 # complaining "not tracked" for big files.
397 lfiles = lfutil.listlfiles(self)
398 394 match = copy.copy(match)
399 395 origmatchfn = match.matchfn
400 396
@@ -467,6 +463,60 b' def reposetup(ui, repo):'
467 463 return super(lfilesrepo, self).push(remote, force, revs,
468 464 newbranch)
469 465
466 def _subdirlfs(self, files, lfiles):
467 '''
468 Adjust matched file list
469 If we pass a directory to commit whose only commitable files
470 are largefiles, the core commit code aborts before finding
471 the largefiles.
472 So we do the following:
473 For directories that only have largefiles as matches,
474 we explicitly add the largefiles to the matchlist and remove
475 the directory.
476 In other cases, we leave the match list unmodified.
477 '''
478 actualfiles = []
479 dirs = []
480 regulars = []
481
482 for f in files:
483 if lfutil.isstandin(f + '/'):
484 raise util.Abort(
485 _('file "%s" is a largefile standin') % f,
486 hint=('commit the largefile itself instead'))
487 # Scan directories
488 if os.path.isdir(self.wjoin(f)):
489 dirs.append(f)
490 else:
491 regulars.append(f)
492
493 for f in dirs:
494 matcheddir = False
495 d = self.dirstate.normalize(f) + '/'
496 # Check for matched normal files
497 for mf in regulars:
498 if self.dirstate.normalize(mf).startswith(d):
499 actualfiles.append(f)
500 matcheddir = True
501 break
502 if not matcheddir:
503 # If no normal match, manually append
504 # any matching largefiles
505 for lf in lfiles:
506 if self.dirstate.normalize(lf).startswith(d):
507 actualfiles.append(lf)
508 if not matcheddir:
509 actualfiles.append(lfutil.standin(f))
510 matcheddir = True
511 # Nothing in dir, so readd it
512 # and let commit reject it
513 if not matcheddir:
514 actualfiles.append(f)
515
516 # Always add normal files
517 actualfiles += regulars
518 return actualfiles
519
470 520 repo.__class__ = lfilesrepo
471 521
472 522 def checkrequireslfiles(ui, repo, **kwargs):
@@ -345,6 +345,63 b' Corner cases for adding largefiles.'
345 345 A sub2/large6
346 346 A sub2/large7
347 347
348 Committing directories containing only largefiles.
349
350 $ mkdir -p z/y/x/m
351 $ touch z/y/x/m/large1
352 $ touch z/y/x/large2
353 $ hg add --large z/y/x/m/large1 z/y/x/large2
354 $ hg commit -m "Subdir with directory only containing largefiles" z
355 Invoking status precommit hook
356 M large3
357 A large5
358 A sub2/large6
359 A sub2/large7
360 A z/y/x/large2
361 A z/y/x/m/large1
362 $ hg rollback --quiet
363 $ touch z/y/x/m/normal
364 $ hg add z/y/x/m/normal
365 $ hg commit -m "Subdir with mixed contents" z
366 Invoking status precommit hook
367 M large3
368 A large5
369 A sub2/large6
370 A sub2/large7
371 A z/y/x/large2
372 A z/y/x/m/large1
373 A z/y/x/m/normal
374 $ hg st
375 M large3
376 A large5
377 A sub2/large6
378 A sub2/large7
379 $ hg rollback --quiet
380 $ hg revert z/y/x/large2 z/y/x/m/large1
381 $ rm z/y/x/large2 z/y/x/m/large1
382 $ hg commit -m "Subdir with normal contents" z
383 Invoking status precommit hook
384 M large3
385 A large5
386 A sub2/large6
387 A sub2/large7
388 A z/y/x/m/normal
389 $ hg st
390 M large3
391 A large5
392 A sub2/large6
393 A sub2/large7
394 $ hg rollback --quiet
395 $ hg revert --quiet z
396 $ hg commit -m "Empty subdir" z
397 abort: z: no match under directory!
398 [255]
399 $ rm -rf z
400 $ hg ci -m "standin" .hglf
401 abort: file ".hglf" is a largefile standin
402 (commit the largefile itself instead)
403 [255]
404
348 405 Test "hg status" with combination of 'file pattern' and 'directory
349 406 pattern' for largefiles:
350 407
General Comments 0
You need to be logged in to leave comments. Login now