Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 23303:3f269bd4826c
context.status: avoid de- and reconstructing status tuple
We can just modify the status tuple we got from dirstate.status()
instead of deconstructing it and constructing a new instance, thereby
simplifying the code a little.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 12 Nov 2014 22:07:31 -0800 |
parents | 24f67ad49da7 |
children | dd3f857598a0 |
comparison
equal
deleted
inserted
replaced
23302:24f67ad49da7 | 23303:3f269bd4826c |
---|---|
1406 subrepos = [] | 1406 subrepos = [] |
1407 if '.hgsub' in self: | 1407 if '.hgsub' in self: |
1408 subrepos = sorted(self.substate) | 1408 subrepos = sorted(self.substate) |
1409 cmp, s = self._repo.dirstate.status(match, subrepos, listignored, | 1409 cmp, s = self._repo.dirstate.status(match, subrepos, listignored, |
1410 listclean, listunknown) | 1410 listclean, listunknown) |
1411 modified, added, removed, deleted, unknown, ignored, clean = s | |
1412 | 1411 |
1413 # check for any possibly clean files | 1412 # check for any possibly clean files |
1414 if cmp: | 1413 if cmp: |
1415 modified2, fixup = self._checklookup(cmp) | 1414 modified2, fixup = self._checklookup(cmp) |
1416 modified += modified2 | 1415 s.modified.extend(modified2) |
1417 | 1416 |
1418 # update dirstate for files that are actually clean | 1417 # update dirstate for files that are actually clean |
1419 if fixup and listclean: | 1418 if fixup and listclean: |
1420 clean += fixup | 1419 s.clean.extend(fixup) |
1421 | 1420 |
1422 return scmutil.status(modified, added, removed, deleted, unknown, | 1421 return s |
1423 ignored, clean) | |
1424 | 1422 |
1425 def _buildstatus(self, other, s, match, listignored, listclean, | 1423 def _buildstatus(self, other, s, match, listignored, listclean, |
1426 listunknown): | 1424 listunknown): |
1427 """build a status with respect to another context | 1425 """build a status with respect to another context |
1428 | 1426 |