comparison mercurial/context.py @ 21397:38743c59f3f8

context: add private _dirstatestatus method This patch is a step forward in getting rid of needing to check 'parentworking' throughout the status method. Eventually, we will use the power of inheritance to do the correct thing when comparing the working directory with its parent. This method is mostly a copy from localrepo.status. The custom status method of workingctx will eventually be absorbed by the refactoring of localrepo.status to context.status but unfortunately we can't do it in one step.
author Sean Farley <sean.michael.farley@gmail.com>
date Tue, 22 Apr 2014 13:14:51 -0500
parents 3925d9460d27
children ed608a544719
comparison
equal deleted inserted replaced
21396:3925d9460d27 21397:38743c59f3f8
1211 wlock.release() 1211 wlock.release()
1212 except error.LockError: 1212 except error.LockError:
1213 pass 1213 pass
1214 return modified, fixup 1214 return modified, fixup
1215 1215
1216 def _dirstatestatus(self, match=None, ignored=False, clean=False,
1217 unknown=False):
1218 '''Gets the status from the dirstate -- internal use only.'''
1219 listignored, listclean, listunknown = ignored, clean, unknown
1220 match = match or matchmod.always(self._repo.root, self._repo.getcwd())
1221 subrepos = []
1222 if '.hgsub' in self:
1223 subrepos = sorted(self.substate)
1224 s = self._repo.dirstate.status(match, subrepos, listignored,
1225 listclean, listunknown)
1226 cmp, modified, added, removed, deleted, unknown, ignored, clean = s
1227
1228 # check for any possibly clean files
1229 if cmp:
1230 modified2, fixup = self._checklookup(cmp)
1231 modified += modified2
1232
1233 # update dirstate for files that are actually clean
1234 if fixup and listclean:
1235 clean += fixup
1236
1237 return [modified, added, removed, deleted, unknown, ignored, clean]
1238
1216 def status(self, ignored=False, clean=False, unknown=False): 1239 def status(self, ignored=False, clean=False, unknown=False):
1217 """Explicit status query 1240 """Explicit status query
1218 Unless this method is used to query the working copy status, the 1241 Unless this method is used to query the working copy status, the
1219 _status property will implicitly read the status using its default 1242 _status property will implicitly read the status using its default
1220 arguments.""" 1243 arguments."""