##// END OF EJS Templates
largefiles: remove the first `changing_parents` in `updatelfiles`...
marmoute -
r50913:ef1540c5 default
parent child Browse files
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 wvfs = repo.wvfs
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 else:
543 dropped.add(lfile)
544 dropped.add(lfile)
545
544
546 # allocate an entry in largefiles dirstate to prevent
545 # allocate an entry in largefiles dirstate to prevent
547 # lfilesrepo.status() from reporting missing files as
546 # lfilesrepo.status() from reporting missing files as
548 # removed.
547 # removed.
549 lfdirstate.hacky_extension_update_file(
548 lfdirstate.hacky_extension_update_file(
550 lfile,
549 lfile,
551 p1_tracked=True,
550 p1_tracked=True,
552 wc_tracked=True,
551 wc_tracked=True,
553 possibly_dirty=True,
552 possibly_dirty=True,
554 )
553 )
555 update[lfile] = expecthash
554 update[lfile] = expecthash
556 else:
555 else:
557 # Remove lfiles for which the standin is deleted, unless the
556 # Remove lfiles for which the standin is deleted, unless the
558 # lfile is added to the repository again. This happens when a
557 # lfile is added to the repository again. This happens when a
559 # largefile is converted back to a normal file: the standin
558 # largefile is converted back to a normal file: the standin
560 # disappears, but a new (normal) file appears as the lfile.
559 # disappears, but a new (normal) file appears as the lfile.
561 if (
560 if (
562 wvfs.exists(lfile)
561 wvfs.exists(lfile)
563 and repo.dirstate.normalize(lfile) not in wctx
562 and repo.dirstate.normalize(lfile) not in wctx
564 ):
563 ):
565 wvfs.unlinkpath(lfile)
564 wvfs.unlinkpath(lfile)
566 removed += 1
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