comparison hgext/largefiles/lfutil.py @ 47699:034979d24c7b

largefile: rearrange conditionnal in `synclfdirstate` We can liquidate the special case early, so do we. Differential Revision: https://phab.mercurial-scm.org/D11141
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 19 Jul 2021 03:25:21 +0200
parents b1b6d0cad455
children 9217ab0ecdb8
comparison
equal deleted inserted replaced
47698:9fa1085fbd63 47699:034979d24c7b
548 return standins 548 return standins
549 549
550 550
551 def synclfdirstate(repo, lfdirstate, lfile, normallookup): 551 def synclfdirstate(repo, lfdirstate, lfile, normallookup):
552 lfstandin = standin(lfile) 552 lfstandin = standin(lfile)
553 if lfstandin in repo.dirstate: 553 if lfstandin not in repo.dirstate:
554 lfdirstate.drop(lfile)
555 else:
554 stat = repo.dirstate._map[lfstandin] 556 stat = repo.dirstate._map[lfstandin]
555 state, mtime = stat.state, stat.mtime 557 state, mtime = stat.state, stat.mtime
556 else: 558 if state == b'n':
557 state, mtime = b'?', -1 559 if normallookup or mtime < 0 or not repo.wvfs.exists(lfile):
558 if state == b'n': 560 # state 'n' doesn't ensure 'clean' in this case
559 if normallookup or mtime < 0 or not repo.wvfs.exists(lfile): 561 lfdirstate.normallookup(lfile)
560 # state 'n' doesn't ensure 'clean' in this case 562 else:
563 lfdirstate.normal(lfile)
564 elif state == b'm':
561 lfdirstate.normallookup(lfile) 565 lfdirstate.normallookup(lfile)
562 else: 566 elif state == b'r':
563 lfdirstate.normal(lfile) 567 lfdirstate.remove(lfile)
564 elif state == b'm': 568 elif state == b'a':
565 lfdirstate.normallookup(lfile) 569 lfdirstate.add(lfile)
566 elif state == b'r':
567 lfdirstate.remove(lfile)
568 elif state == b'a':
569 lfdirstate.add(lfile)
570 elif state == b'?':
571 lfdirstate.drop(lfile)
572 570
573 571
574 def markcommitted(orig, ctx, node): 572 def markcommitted(orig, ctx, node):
575 repo = ctx.repo() 573 repo = ctx.repo()
576 574