Show More
@@ -438,45 +438,27 b' def updatelfiles(ui, repo, filelist=None' | |||||
438 | if filelist is not None: |
|
438 | if filelist is not None: | |
439 | lfiles = [f for f in lfiles if f in filelist] |
|
439 | lfiles = [f for f in lfiles if f in filelist] | |
440 |
|
440 | |||
441 | if lfiles: |
|
441 | update = {} | |
442 | if printmessage: |
|
|||
443 | ui.status(_('getting changed largefiles\n')) |
|
|||
444 | cachelfiles(ui, repo, None, lfiles) |
|
|||
445 |
|
||||
446 | updated, removed = 0, 0 |
|
442 | updated, removed = 0, 0 | |
447 | for lfile in lfiles: |
|
443 | for lfile in lfiles: | |
448 | # updates a single largefile and copies the state of its standin from |
|
|||
449 | # the repository's dirstate to its state in the lfdirstate. |
|
|||
450 | abslfile = repo.wjoin(lfile) |
|
444 | abslfile = repo.wjoin(lfile) | |
451 | absstandin = repo.wjoin(lfutil.standin(lfile)) |
|
445 | absstandin = repo.wjoin(lfutil.standin(lfile)) | |
452 | if os.path.exists(absstandin): |
|
446 | if os.path.exists(absstandin): | |
453 | if (os.path.exists(absstandin + '.orig') and |
|
447 | if (os.path.exists(absstandin + '.orig') and | |
454 | os.path.exists(abslfile)): |
|
448 | os.path.exists(abslfile)): | |
455 | shutil.copyfile(abslfile, abslfile + '.orig') |
|
449 | shutil.copyfile(abslfile, abslfile + '.orig') | |
456 | update1 = 0 |
|
|||
457 | expecthash = lfutil.readstandin(repo, lfile) |
|
450 | expecthash = lfutil.readstandin(repo, lfile) | |
458 | if (expecthash != '' and |
|
451 | if (expecthash != '' and | |
459 | (not os.path.exists(abslfile) or |
|
452 | (not os.path.exists(abslfile) or | |
460 | expecthash != lfutil.hashfile(abslfile))): |
|
453 | expecthash != lfutil.hashfile(abslfile))): | |
461 | if not lfutil.copyfromcache(repo, expecthash, lfile): |
|
454 | if lfile not in repo[None]: # not switched to normal file | |
462 | # use normallookup() to allocate entry in largefiles |
|
455 | util.unlinkpath(abslfile, ignoremissing=True) | |
463 | # dirstate, because lack of it misleads |
|
456 | # use normallookup() to allocate entry in largefiles | |
464 | # lfilesrepo.status() into recognition that such cache |
|
457 | # dirstate, because lack of it misleads | |
465 | # missing files are REMOVED. |
|
458 | # lfilesrepo.status() into recognition that such cache | |
466 | if lfile not in repo[None]: # not switched to normal |
|
459 | # missing files are REMOVED. | |
467 | util.unlinkpath(abslfile, ignoremissing=True) |
|
460 | lfdirstate.normallookup(lfile) | |
468 | lfdirstate.normallookup(lfile) |
|
461 | update[lfile] = expecthash | |
469 | continue # don't try to set the mode |
|
|||
470 | else: |
|
|||
471 | # Synchronize largefile dirstate to the last modified |
|
|||
472 | # time of the file |
|
|||
473 | lfdirstate.normal(lfile) |
|
|||
474 | update1 = 1 |
|
|||
475 | mode = os.stat(absstandin).st_mode |
|
|||
476 | if mode != os.stat(abslfile).st_mode: |
|
|||
477 | os.chmod(abslfile, mode) |
|
|||
478 | update1 = 1 |
|
|||
479 | updated += update1 |
|
|||
480 | else: |
|
462 | else: | |
481 | # Remove lfiles for which the standin is deleted, unless the |
|
463 | # Remove lfiles for which the standin is deleted, unless the | |
482 | # lfile is added to the repository again. This happens when a |
|
464 | # lfile is added to the repository again. This happens when a | |
@@ -486,6 +468,40 b' def updatelfiles(ui, repo, filelist=None' | |||||
486 | repo.dirstate.normalize(lfile) not in repo[None]): |
|
468 | repo.dirstate.normalize(lfile) not in repo[None]): | |
487 | util.unlinkpath(abslfile) |
|
469 | util.unlinkpath(abslfile) | |
488 | removed += 1 |
|
470 | removed += 1 | |
|
471 | ||||
|
472 | # largefile processing might be slow and be interrupted - be prepared | |||
|
473 | lfdirstate.write() | |||
|
474 | ||||
|
475 | if lfiles: | |||
|
476 | if printmessage: | |||
|
477 | ui.status(_('getting changed largefiles\n')) | |||
|
478 | cachelfiles(ui, repo, None, lfiles) | |||
|
479 | ||||
|
480 | for lfile in lfiles: | |||
|
481 | update1 = 0 | |||
|
482 | ||||
|
483 | expecthash = update.get(lfile) | |||
|
484 | if expecthash: | |||
|
485 | if not lfutil.copyfromcache(repo, expecthash, lfile): | |||
|
486 | # failed ... but already removed and set to normallookup | |||
|
487 | continue | |||
|
488 | # Synchronize largefile dirstate to the last modified | |||
|
489 | # time of the file | |||
|
490 | lfdirstate.normal(lfile) | |||
|
491 | update1 = 1 | |||
|
492 | ||||
|
493 | # copy the state of largefile standin from the repository's | |||
|
494 | # dirstate to its state in the lfdirstate. | |||
|
495 | abslfile = repo.wjoin(lfile) | |||
|
496 | absstandin = repo.wjoin(lfutil.standin(lfile)) | |||
|
497 | if os.path.exists(absstandin): | |||
|
498 | mode = os.stat(absstandin).st_mode | |||
|
499 | if mode != os.stat(abslfile).st_mode: | |||
|
500 | os.chmod(abslfile, mode) | |||
|
501 | update1 = 1 | |||
|
502 | ||||
|
503 | updated += update1 | |||
|
504 | ||||
489 | state = repo.dirstate[lfutil.standin(lfile)] |
|
505 | state = repo.dirstate[lfutil.standin(lfile)] | |
490 | if state == 'n': |
|
506 | if state == 'n': | |
491 | # When rebasing, we need to synchronize the standin and the |
|
507 | # When rebasing, we need to synchronize the standin and the |
General Comments 0
You need to be logged in to leave comments.
Login now