Show More
@@ -517,53 +517,52 b' def updatelfiles(' | |||||
517 | filelist = set(filelist) |
|
517 | filelist = set(filelist) | |
518 | lfiles = [f for f in lfiles if f in filelist] |
|
518 | lfiles = [f for f in lfiles if f in filelist] | |
519 |
|
519 | |||
520 | with lfdirstate.changing_parents(repo): |
|
520 | update = {} | |
521 | update = {} |
|
521 | dropped = set() | |
522 | dropped = set() |
|
522 | updated, removed = 0, 0 | |
523 | updated, removed = 0, 0 |
|
523 | wvfs = repo.wvfs | |
524 |
|
|
524 | wctx = repo[None] | |
525 | wctx = repo[None] |
|
525 | for lfile in lfiles: | |
526 | for lfile in lfiles: |
|
526 | lfileorig = os.path.relpath( | |
527 | lfileorig = os.path.relpath( |
|
527 | scmutil.backuppath(ui, repo, lfile), start=repo.root | |
528 | scmutil.backuppath(ui, repo, lfile), start=repo.root |
|
528 | ) | |
529 | ) |
|
529 | standin = lfutil.standin(lfile) | |
530 | standin = lfutil.standin(lfile) |
|
530 | standinorig = os.path.relpath( | |
531 | standinorig = os.path.relpath( |
|
531 | scmutil.backuppath(ui, repo, standin), start=repo.root | |
532 | scmutil.backuppath(ui, repo, standin), start=repo.root |
|
532 | ) | |
533 | ) |
|
533 | if wvfs.exists(standin): | |
534 | if wvfs.exists(standin): |
|
534 | if wvfs.exists(standinorig) and wvfs.exists(lfile): | |
535 | if wvfs.exists(standinorig) and wvfs.exists(lfile): |
|
535 | shutil.copyfile(wvfs.join(lfile), wvfs.join(lfileorig)) | |
536 | shutil.copyfile(wvfs.join(lfile), wvfs.join(lfileorig)) |
|
536 | wvfs.unlinkpath(standinorig) | |
537 | wvfs.unlinkpath(standinorig) |
|
537 | expecthash = lfutil.readasstandin(wctx[standin]) | |
538 | expecthash = lfutil.readasstandin(wctx[standin]) |
|
538 | if expecthash != b'': | |
539 | if expecthash != b'': |
|
539 | if lfile not in wctx: # not switched to normal file | |
540 | if lfile not in wctx: # not switched to normal file |
|
540 | if repo.dirstate.get_entry(standin).any_tracked: | |
541 | if repo.dirstate.get_entry(standin).any_tracked: |
|
541 | wvfs.unlinkpath(lfile, ignoremissing=True) | |
542 | wvfs.unlinkpath(lfile, ignoremissing=True) |
|
542 | else: | |
543 |
|
|
543 | dropped.add(lfile) | |
544 | dropped.add(lfile) |
|
|||
545 |
|
544 | |||
546 |
|
|
545 | # allocate an entry in largefiles dirstate to prevent | |
547 |
|
|
546 | # lfilesrepo.status() from reporting missing files as | |
548 |
|
|
547 | # removed. | |
549 |
|
|
548 | lfdirstate.hacky_extension_update_file( | |
550 |
|
|
549 | lfile, | |
551 |
|
|
550 | p1_tracked=True, | |
552 |
|
|
551 | wc_tracked=True, | |
553 |
|
|
552 | possibly_dirty=True, | |
554 |
|
|
553 | ) | |
555 |
|
|
554 | update[lfile] = expecthash | |
556 |
|
|
555 | else: | |
557 |
|
|
556 | # Remove lfiles for which the standin is deleted, unless the | |
558 |
|
|
557 | # lfile is added to the repository again. This happens when a | |
559 |
|
|
558 | # largefile is converted back to a normal file: the standin | |
560 |
|
|
559 | # disappears, but a new (normal) file appears as the lfile. | |
561 |
|
|
560 | if ( | |
562 |
|
|
561 | wvfs.exists(lfile) | |
563 |
|
|
562 | and repo.dirstate.normalize(lfile) not in wctx | |
564 |
|
|
563 | ): | |
565 |
|
|
564 | wvfs.unlinkpath(lfile) | |
566 |
|
|
565 | removed += 1 | |
567 |
|
566 | |||
568 | # largefile processing might be slow and be interrupted - be prepared |
|
567 | # largefile processing might be slow and be interrupted - be prepared | |
569 | lfdirstate.write(repo.currenttransaction()) |
|
568 | lfdirstate.write(repo.currenttransaction()) |
General Comments 0
You need to be logged in to leave comments.
Login now