comparison hgext/largefiles/overrides.py @ 48106:82e142b9ad18

dirstate-item: use item's property instead of `state` in largefile Differential Revision: https://phab.mercurial-scm.org/D11543
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 29 Sep 2021 18:39:02 +0200
parents e4c79a1a0b67
children 5ced12cfa41b
comparison
equal deleted inserted replaced
48105:207df24a31f6 48106:82e142b9ad18
932 matchfiles = [] 932 matchfiles = []
933 for f in m._files: 933 for f in m._files:
934 standin = lfutil.standin(f) 934 standin = lfutil.standin(f)
935 if standin in ctx or standin in mctx: 935 if standin in ctx or standin in mctx:
936 matchfiles.append(standin) 936 matchfiles.append(standin)
937 elif standin in wctx or lfdirstate[f] == b'r': 937 elif standin in wctx or lfdirstate.get_entry(f).removed:
938 continue 938 continue
939 else: 939 else:
940 matchfiles.append(f) 940 matchfiles.append(f)
941 m._files = matchfiles 941 m._files = matchfiles
942 m._fileset = set(m._files) 942 m._fileset = set(m._files)
1589 ): 1589 ):
1590 r = oldstatus( 1590 r = oldstatus(
1591 node1, node2, match, ignored, clean, unknown, listsubrepos 1591 node1, node2, match, ignored, clean, unknown, listsubrepos
1592 ) 1592 )
1593 lfdirstate = lfutil.openlfdirstate(ui, repo) 1593 lfdirstate = lfutil.openlfdirstate(ui, repo)
1594 unknown = [f for f in r.unknown if lfdirstate[f] == b'?'] 1594 unknown = [
1595 ignored = [f for f in r.ignored if lfdirstate[f] == b'?'] 1595 f for f in r.unknown if not lfdirstate.get_entry(f).any_tracked
1596 ]
1597 ignored = [
1598 f for f in r.ignored if not lfdirstate.get_entry(f).any_tracked
1599 ]
1596 return scmutil.status( 1600 return scmutil.status(
1597 r.modified, r.added, r.removed, r.deleted, unknown, ignored, r.clean 1601 r.modified, r.added, r.removed, r.deleted, unknown, ignored, r.clean
1598 ) 1602 )
1599 1603
1600 repo.status = overridestatus 1604 repo.status = overridestatus
1607 with repo.wlock(): 1611 with repo.wlock():
1608 before = repo.dirstate.parents() 1612 before = repo.dirstate.parents()
1609 orphans = { 1613 orphans = {
1610 f 1614 f
1611 for f in repo.dirstate 1615 for f in repo.dirstate
1612 if lfutil.isstandin(f) and repo.dirstate[f] != b'r' 1616 if lfutil.isstandin(f) and not repo.dirstate.get_entry(f).removed
1613 } 1617 }
1614 result = orig(ui, repo, **opts) 1618 result = orig(ui, repo, **opts)
1615 after = repo.dirstate.parents() 1619 after = repo.dirstate.parents()
1616 if before == after: 1620 if before == after:
1617 return result # no need to restore standins 1621 return result # no need to restore standins
1618 1622
1619 pctx = repo[b'.'] 1623 pctx = repo[b'.']
1620 for f in repo.dirstate: 1624 for f in repo.dirstate:
1621 if lfutil.isstandin(f): 1625 if lfutil.isstandin(f):
1622 orphans.discard(f) 1626 orphans.discard(f)
1623 if repo.dirstate[f] == b'r': 1627 if repo.dirstate.get_entry(f).removed:
1624 repo.wvfs.unlinkpath(f, ignoremissing=True) 1628 repo.wvfs.unlinkpath(f, ignoremissing=True)
1625 elif f in pctx: 1629 elif f in pctx:
1626 fctx = pctx[f] 1630 fctx = pctx[f]
1627 repo.wwrite(f, fctx.data(), fctx.flags()) 1631 repo.wwrite(f, fctx.data(), fctx.flags())
1628 else: 1632 else: