D847: dirstate: use keyword arguments to clarify status()'s callers
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Sep 29 21:53:27 UTC 2017
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
The arguments are especially non-obvious because the order is
different from dirstate.walk().
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D847
AFFECTED FILES
hgext/largefiles/lfutil.py
hgext/largefiles/overrides.py
hgext/largefiles/reposetup.py
mercurial/context.py
CHANGE DETAILS
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1756,21 +1756,20 @@
def _dirstatestatus(self, match, ignored=False, clean=False, unknown=False):
'''Gets the status from the dirstate -- internal use only.'''
- listignored, listclean, listunknown = ignored, clean, unknown
subrepos = []
if '.hgsub' in self:
subrepos = sorted(self.substate)
- cmp, s = self._repo.dirstate.status(match, subrepos, listignored,
- listclean, listunknown)
+ cmp, s = self._repo.dirstate.status(match, subrepos, ignored=ignored,
+ clean=clean, unknown=unknown)
# check for any possibly clean files
fixup = []
if cmp:
modified2, deleted2, fixup = self._checklookup(cmp)
s.modified.extend(modified2)
s.deleted.extend(deleted2)
- if fixup and listclean:
+ if fixup and clean:
s.clean.extend(fixup)
self._poststatusfixup(s, fixup)
diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -162,8 +162,10 @@
if sfindirstate(f)]
# Don't waste time getting the ignored and unknown
# files from lfdirstate
- unsure, s = lfdirstate.status(match, [], False, listclean,
- False)
+ unsure, s = lfdirstate.status(match, subrepos=[],
+ ignored=False,
+ clean=listclean,
+ unknown=False)
(modified, added, removed, deleted, clean) = (
s.modified, s.added, s.removed, s.deleted, s.clean)
if parentworking:
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -1218,8 +1218,9 @@
return orig(repo, matcher, prefix, opts, dry_run, similarity)
# Get the list of missing largefiles so we can remove them
lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
- unsure, s = lfdirstate.status(matchmod.always(repo.root, repo.getcwd()), [],
- False, False, False)
+ unsure, s = lfdirstate.status(matchmod.always(repo.root, repo.getcwd()),
+ subrepos=[], ignores=False, clean=False,
+ unknown=False)
# Call into the normal remove code, but the removing of the standin, we want
# to have handled by original addremove. Monkey patching here makes sure
@@ -1403,7 +1404,8 @@
lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
unsure, s = lfdirstate.status(matchmod.always(repo.root,
repo.getcwd()),
- [], False, True, False)
+ subrepos=[], ignored=False,
+ clean=True, unknown=False)
oldclean = set(s.clean)
pctx = repo['.']
dctx = repo[node]
diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -169,7 +169,8 @@
def lfdirstatestatus(lfdirstate, repo):
pctx = repo['.']
match = matchmod.always(repo.root, repo.getcwd())
- unsure, s = lfdirstate.status(match, [], False, False, False)
+ unsure, s = lfdirstate.status(match, subrepos=[], ignored=False,
+ clean=False, unknown=False)
modified, clean = s.modified, s.clean
for lfile in unsure:
try:
@@ -551,8 +552,8 @@
# large.
lfdirstate = openlfdirstate(ui, repo)
dirtymatch = matchmod.always(repo.root, repo.getcwd())
- unsure, s = lfdirstate.status(dirtymatch, [], False, False,
- False)
+ unsure, s = lfdirstate.status(dirtymatch, subrepos=[], ignored=False,
+ clean=False, unknown=False)
modifiedfiles = unsure + s.modified + s.added + s.removed
lfiles = listlfiles(repo)
# this only loops through largefiles that exist (not
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list