Show More
@@ -355,11 +355,8 b' def reposetup(ui, repo):' | |||||
355 | lfdirstate.write() |
|
355 | lfdirstate.write() | |
356 | return result |
|
356 | return result | |
357 |
|
357 | |||
358 |
|
|
358 | lfiles = lfutil.listlfiles(self) | |
359 | if lfutil.isstandin(f): |
|
359 | match._files = self._subdirlfs(match.files(), lfiles) | |
360 | raise util.Abort( |
|
|||
361 | _('file "%s" is a largefile standin') % f, |
|
|||
362 | hint=('commit the largefile itself instead')) |
|
|||
363 |
|
360 | |||
364 | # Case 2: user calls commit with specified patterns: refresh |
|
361 | # Case 2: user calls commit with specified patterns: refresh | |
365 | # any matching big files. |
|
362 | # any matching big files. | |
@@ -390,7 +387,6 b' def reposetup(ui, repo):' | |||||
390 | # standins corresponding to the big files requested by the |
|
387 | # standins corresponding to the big files requested by the | |
391 | # user. Have to modify _files to prevent commit() from |
|
388 | # user. Have to modify _files to prevent commit() from | |
392 | # complaining "not tracked" for big files. |
|
389 | # complaining "not tracked" for big files. | |
393 | lfiles = lfutil.listlfiles(self) |
|
|||
394 | match = copy.copy(match) |
|
390 | match = copy.copy(match) | |
395 | origmatchfn = match.matchfn |
|
391 | origmatchfn = match.matchfn | |
396 |
|
392 | |||
@@ -463,6 +459,60 b' def reposetup(ui, repo):' | |||||
463 | return super(lfilesrepo, self).push(remote, force, revs, |
|
459 | return super(lfilesrepo, self).push(remote, force, revs, | |
464 | newbranch) |
|
460 | newbranch) | |
465 |
|
461 | |||
|
462 | def _subdirlfs(self, files, lfiles): | |||
|
463 | ''' | |||
|
464 | Adjust matched file list | |||
|
465 | If we pass a directory to commit whose only commitable files | |||
|
466 | are largefiles, the core commit code aborts before finding | |||
|
467 | the largefiles. | |||
|
468 | So we do the following: | |||
|
469 | For directories that only have largefiles as matches, | |||
|
470 | we explicitly add the largefiles to the matchlist and remove | |||
|
471 | the directory. | |||
|
472 | In other cases, we leave the match list unmodified. | |||
|
473 | ''' | |||
|
474 | actualfiles = [] | |||
|
475 | dirs = [] | |||
|
476 | regulars = [] | |||
|
477 | ||||
|
478 | for f in files: | |||
|
479 | if lfutil.isstandin(f + '/'): | |||
|
480 | raise util.Abort( | |||
|
481 | _('file "%s" is a largefile standin') % f, | |||
|
482 | hint=('commit the largefile itself instead')) | |||
|
483 | # Scan directories | |||
|
484 | if os.path.isdir(self.wjoin(f)): | |||
|
485 | dirs.append(f) | |||
|
486 | else: | |||
|
487 | regulars.append(f) | |||
|
488 | ||||
|
489 | for f in dirs: | |||
|
490 | matcheddir = False | |||
|
491 | d = self.dirstate.normalize(f) + '/' | |||
|
492 | # Check for matched normal files | |||
|
493 | for mf in regulars: | |||
|
494 | if self.dirstate.normalize(mf).startswith(d): | |||
|
495 | actualfiles.append(f) | |||
|
496 | matcheddir = True | |||
|
497 | break | |||
|
498 | if not matcheddir: | |||
|
499 | # If no normal match, manually append | |||
|
500 | # any matching largefiles | |||
|
501 | for lf in lfiles: | |||
|
502 | if self.dirstate.normalize(lf).startswith(d): | |||
|
503 | actualfiles.append(lf) | |||
|
504 | if not matcheddir: | |||
|
505 | actualfiles.append(lfutil.standin(f)) | |||
|
506 | matcheddir = True | |||
|
507 | # Nothing in dir, so readd it | |||
|
508 | # and let commit reject it | |||
|
509 | if not matcheddir: | |||
|
510 | actualfiles.append(f) | |||
|
511 | ||||
|
512 | # Always add normal files | |||
|
513 | actualfiles += regulars | |||
|
514 | return actualfiles | |||
|
515 | ||||
466 | repo.__class__ = lfilesrepo |
|
516 | repo.__class__ = lfilesrepo | |
467 |
|
517 | |||
468 | def checkrequireslfiles(ui, repo, **kwargs): |
|
518 | def checkrequireslfiles(ui, repo, **kwargs): |
@@ -345,6 +345,63 b' Corner cases for adding largefiles.' | |||||
345 | A sub2/large6 |
|
345 | A sub2/large6 | |
346 | A sub2/large7 |
|
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 | Test "hg status" with combination of 'file pattern' and 'directory |
|
405 | Test "hg status" with combination of 'file pattern' and 'directory | |
349 | pattern' for largefiles: |
|
406 | pattern' for largefiles: | |
350 |
|
407 |
General Comments 0
You need to be logged in to leave comments.
Login now