Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.py @ 23302:24f67ad49da7
context.status: make _dirstatestatus() return an status tuple
Letting _dirstatestatus() return an scmutil.status instance also means
that _buildstatus() will always return such an instance, so we can
remove the conversion from the call sites.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 12 Nov 2014 16:51:11 -0800 |
parents | c10dc5568069 |
children | 3f269bd4826c |
comparison
equal
deleted
inserted
replaced
23301:c10dc5568069 | 23302:24f67ad49da7 |
---|---|
127 if removed: | 127 if removed: |
128 # need to filter files if they are already reported as removed | 128 # need to filter files if they are already reported as removed |
129 unknown = [fn for fn in unknown if fn not in mf1] | 129 unknown = [fn for fn in unknown if fn not in mf1] |
130 ignored = [fn for fn in ignored if fn not in mf1] | 130 ignored = [fn for fn in ignored if fn not in mf1] |
131 | 131 |
132 return [modified, added, removed, deleted, unknown, ignored, clean] | 132 return scmutil.status(modified, added, removed, deleted, unknown, |
133 ignored, clean) | |
133 | 134 |
134 @propertycache | 135 @propertycache |
135 def substate(self): | 136 def substate(self): |
136 return subrepo.state(self, self._repo.ui) | 137 return subrepo.state(self, self._repo.ui) |
137 | 138 |
302 match = ctx2._matchstatus(ctx1, match) | 303 match = ctx2._matchstatus(ctx1, match) |
303 r = [[], [], [], [], [], [], []] | 304 r = [[], [], [], [], [], [], []] |
304 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean, | 305 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean, |
305 listunknown) | 306 listunknown) |
306 | 307 |
307 r = scmutil.status(*r) | |
308 if reversed: | 308 if reversed: |
309 # Reverse added and removed. Clear deleted, unknown and ignored as | 309 # Reverse added and removed. Clear deleted, unknown and ignored as |
310 # these make no sense to reverse. | 310 # these make no sense to reverse. |
311 r = scmutil.status(r.modified, r.removed, r.added, [], [], [], | 311 r = scmutil.status(r.modified, r.removed, r.added, [], [], [], |
312 r.clean) | 312 r.clean) |
1417 | 1417 |
1418 # update dirstate for files that are actually clean | 1418 # update dirstate for files that are actually clean |
1419 if fixup and listclean: | 1419 if fixup and listclean: |
1420 clean += fixup | 1420 clean += fixup |
1421 | 1421 |
1422 return [modified, added, removed, deleted, unknown, ignored, clean] | 1422 return scmutil.status(modified, added, removed, deleted, unknown, |
1423 ignored, clean) | |
1423 | 1424 |
1424 def _buildstatus(self, other, s, match, listignored, listclean, | 1425 def _buildstatus(self, other, s, match, listignored, listclean, |
1425 listunknown): | 1426 listunknown): |
1426 """build a status with respect to another context | 1427 """build a status with respect to another context |
1427 | 1428 |
1432 """ | 1433 """ |
1433 s = self._dirstatestatus(match, listignored, listclean, listunknown) | 1434 s = self._dirstatestatus(match, listignored, listclean, listunknown) |
1434 # Filter out symlinks that, in the case of FAT32 and NTFS filesytems, | 1435 # Filter out symlinks that, in the case of FAT32 and NTFS filesytems, |
1435 # might have accidentally ended up with the entire contents of the file | 1436 # might have accidentally ended up with the entire contents of the file |
1436 # they are susposed to be linking to. | 1437 # they are susposed to be linking to. |
1437 s[0] = self._filtersuspectsymlink(s[0]) | 1438 s.modified[:] = self._filtersuspectsymlink(s.modified) |
1438 if other != self._repo['.']: | 1439 if other != self._repo['.']: |
1439 s = super(workingctx, self)._buildstatus(other, s, match, | 1440 s = super(workingctx, self)._buildstatus(other, s, match, |
1440 listignored, listclean, | 1441 listignored, listclean, |
1441 listunknown) | 1442 listunknown) |
1442 self._status = scmutil.status(*s) | 1443 self._status = s |
1443 return s | 1444 return s |
1444 | 1445 |
1445 def _matchstatus(self, other, match): | 1446 def _matchstatus(self, other, match): |
1446 """override the match method with a filter for directory patterns | 1447 """override the match method with a filter for directory patterns |
1447 | 1448 |