dirstate-item: use item's property instead of `state` in largefile
Differential Revision: https://phab.mercurial-scm.org/D11543
--- a/hgext/largefiles/lfcommands.py Wed Sep 29 18:37:54 2021 +0200
+++ b/hgext/largefiles/lfcommands.py Wed Sep 29 18:39:02 2021 +0200
@@ -540,7 +540,7 @@
expecthash = lfutil.readasstandin(wctx[standin])
if expecthash != b'':
if lfile not in wctx: # not switched to normal file
- if repo.dirstate[standin] != b'?':
+ if repo.dirstate.get_entry(standin).any_tracked:
wvfs.unlinkpath(lfile, ignoremissing=True)
else:
dropped.add(lfile)
--- a/hgext/largefiles/lfutil.py Wed Sep 29 18:37:54 2021 +0200
+++ b/hgext/largefiles/lfutil.py Wed Sep 29 18:39:02 2021 +0200
@@ -269,7 +269,7 @@
return [
splitstandin(f)
for f in repo[rev].walk(matcher)
- if rev is not None or repo.dirstate[f] != b'?'
+ if rev is not None or repo.dirstate.get_entry(f).any_tracked
]
@@ -558,7 +558,7 @@
if lfstandin not in repo.dirstate:
lfdirstate.update_file(lfile, p1_tracked=False, wc_tracked=False)
else:
- stat = repo.dirstate._map[lfstandin]
+ stat = repo.dirstate.get_entry(lfstandin)
state, mtime = stat.state, stat.mtime
if state == b'n':
if normallookup or mtime < 0 or not repo.wvfs.exists(lfile):
@@ -713,7 +713,7 @@
lfdirstate = openlfdirstate(ui, repo)
for fstandin in standins:
lfile = splitstandin(fstandin)
- if lfdirstate[lfile] != b'r':
+ if lfdirstate.get_entry(lfile).tracked:
updatestandin(repo, lfile, fstandin)
# Cook up a new matcher that only matches regular files or
@@ -737,10 +737,10 @@
# standin removal, drop the normal file if it is unknown to dirstate.
# Thus, skip plain largefile names but keep the standin.
if f in lfiles or fstandin in standins:
- if repo.dirstate[fstandin] != b'r':
- if repo.dirstate[f] != b'r':
+ if not repo.dirstate.get_entry(fstandin).removed:
+ if not repo.dirstate.get_entry(f).removed:
continue
- elif repo.dirstate[f] == b'?':
+ elif not repo.dirstate.get_entry(f).any_tracked:
continue
actualfiles.append(f)
--- a/hgext/largefiles/overrides.py Wed Sep 29 18:37:54 2021 +0200
+++ b/hgext/largefiles/overrides.py Wed Sep 29 18:39:02 2021 +0200
@@ -934,7 +934,7 @@
standin = lfutil.standin(f)
if standin in ctx or standin in mctx:
matchfiles.append(standin)
- elif standin in wctx or lfdirstate[f] == b'r':
+ elif standin in wctx or lfdirstate.get_entry(f).removed:
continue
else:
matchfiles.append(f)
@@ -1591,8 +1591,12 @@
node1, node2, match, ignored, clean, unknown, listsubrepos
)
lfdirstate = lfutil.openlfdirstate(ui, repo)
- unknown = [f for f in r.unknown if lfdirstate[f] == b'?']
- ignored = [f for f in r.ignored if lfdirstate[f] == b'?']
+ unknown = [
+ f for f in r.unknown if not lfdirstate.get_entry(f).any_tracked
+ ]
+ ignored = [
+ f for f in r.ignored if not lfdirstate.get_entry(f).any_tracked
+ ]
return scmutil.status(
r.modified, r.added, r.removed, r.deleted, unknown, ignored, r.clean
)
@@ -1609,7 +1613,7 @@
orphans = {
f
for f in repo.dirstate
- if lfutil.isstandin(f) and repo.dirstate[f] != b'r'
+ if lfutil.isstandin(f) and not repo.dirstate.get_entry(f).removed
}
result = orig(ui, repo, **opts)
after = repo.dirstate.parents()
@@ -1620,7 +1624,7 @@
for f in repo.dirstate:
if lfutil.isstandin(f):
orphans.discard(f)
- if repo.dirstate[f] == b'r':
+ if repo.dirstate.get_entry(f).removed:
repo.wvfs.unlinkpath(f, ignoremissing=True)
elif f in pctx:
fctx = pctx[f]