comparison hgext/largefiles/lfutil.py @ 48144:6f54afb094bd

dirstate: align the dirstate's API to the lower level ones This conclude the refactoring of this API. We can now finalize the dirstate v2 on disk format. Differential Revision: https://phab.mercurial-scm.org/D11587
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 30 Sep 2021 16:33:12 +0200
parents 82e142b9ad18
children df3021c1f093
comparison
equal deleted inserted replaced
48143:21542d4cb568 48144:6f54afb094bd
556 def synclfdirstate(repo, lfdirstate, lfile, normallookup): 556 def synclfdirstate(repo, lfdirstate, lfile, normallookup):
557 lfstandin = standin(lfile) 557 lfstandin = standin(lfile)
558 if lfstandin not in repo.dirstate: 558 if lfstandin not in repo.dirstate:
559 lfdirstate.update_file(lfile, p1_tracked=False, wc_tracked=False) 559 lfdirstate.update_file(lfile, p1_tracked=False, wc_tracked=False)
560 else: 560 else:
561 stat = repo.dirstate.get_entry(lfstandin) 561 entry = repo.dirstate.get_entry(lfstandin)
562 state, mtime = stat.state, stat.mtime 562 lfdirstate.update_file(
563 if state == b'n': 563 lfile,
564 if normallookup or mtime < 0 or not repo.wvfs.exists(lfile): 564 wc_tracked=entry.tracked,
565 # state 'n' doesn't ensure 'clean' in this case 565 p1_tracked=entry.p1_tracked,
566 lfdirstate.update_file( 566 p2_info=entry.p2_info,
567 lfile, p1_tracked=True, wc_tracked=True, possibly_dirty=True 567 possibly_dirty=True,
568 ) 568 )
569 else:
570 lfdirstate.update_file(lfile, p1_tracked=True, wc_tracked=True)
571 elif state == b'm':
572 lfdirstate.update_file(
573 lfile, p1_tracked=True, wc_tracked=True, merged=True
574 )
575 elif state == b'r':
576 lfdirstate.update_file(lfile, p1_tracked=True, wc_tracked=False)
577 elif state == b'a':
578 lfdirstate.update_file(lfile, p1_tracked=False, wc_tracked=True)
579 569
580 570
581 def markcommitted(orig, ctx, node): 571 def markcommitted(orig, ctx, node):
582 repo = ctx.repo() 572 repo = ctx.repo()
583 573