Mercurial > hg
comparison mercurial/context.py @ 21477:466964bdf4c1
workingctx: add _poststatus method to call _filtersuspectsymlink
With this patch, we are one step closer to removing 'if ... else' logic in
localrepo.status for testing if the context is the working directory or
not. Future patches will replace those blocks of code with a call to the
context's _poststatus hook so that each context object will do the right thing
depending on the situation.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Tue, 22 Apr 2014 12:59:22 -0500 |
parents | 168283c8dedf |
children | d19f491e5d5b |
comparison
equal
deleted
inserted
replaced
21476:168283c8dedf | 21477:466964bdf4c1 |
---|---|
1292 We use this prestatus hook to populate the status with information from | 1292 We use this prestatus hook to populate the status with information from |
1293 the dirstate. | 1293 the dirstate. |
1294 """ | 1294 """ |
1295 return self._dirstatestatus(match, listignored, listclean, listunknown) | 1295 return self._dirstatestatus(match, listignored, listclean, listunknown) |
1296 | 1296 |
1297 def _poststatus(self, other, s, match, listignored, listclean, listunknown): | |
1298 """override the parent hook with a filter for suspect symlinks | |
1299 | |
1300 We use this poststatus hook to filter out symlinks that might have | |
1301 accidentally ended up with the entire contents of the file they are | |
1302 susposed to be linking to. | |
1303 """ | |
1304 s[0] = self._filtersuspectsymlink(s[0]) | |
1305 return s | |
1306 | |
1297 def _dirstatestatus(self, match=None, ignored=False, clean=False, | 1307 def _dirstatestatus(self, match=None, ignored=False, clean=False, |
1298 unknown=False): | 1308 unknown=False): |
1299 '''Gets the status from the dirstate -- internal use only.''' | 1309 '''Gets the status from the dirstate -- internal use only.''' |
1300 listignored, listclean, listunknown = ignored, clean, unknown | 1310 listignored, listclean, listunknown = ignored, clean, unknown |
1301 match = match or matchmod.always(self._repo.root, self._repo.getcwd()) | 1311 match = match or matchmod.always(self._repo.root, self._repo.getcwd()) |