comparison mercurial/context.py @ 23239:9fbb50444d55

context.status: call _dirstatestatus() from within _buildstatus() By making the call to _dirstatestatus() within _buildstatus(), it becomes clearer that it's called only for the workingctx.
author Martin von Zweigbergk <martinvonz@gmail.com>
date Sat, 11 Oct 2014 23:30:08 -0700
parents 39eb9f78f968
children c26073dfbbe6
comparison
equal deleted inserted replaced
23238:39eb9f78f968 23239:9fbb50444d55
91 This internal method provides a way for child objects to override the 91 This internal method provides a way for child objects to override the
92 match operator. 92 match operator.
93 """ 93 """
94 return match or matchmod.always(self._repo.root, self._repo.getcwd()) 94 return match or matchmod.always(self._repo.root, self._repo.getcwd())
95 95
96 def _prestatus(self, other, s, match, listignored, listclean, listunknown): 96 def _prestatus(self, other):
97 """provide a hook to allow child objects to preprocess status results 97 """provide a hook to allow child objects to preprocess status results
98 98
99 For example, this allows other contexts, such as workingctx, to query 99 For example, this allows other contexts, such as workingctx, to query
100 the dirstate before comparing the manifests. 100 the dirstate before comparing the manifests.
101 """ 101 """
102 return s 102 pass
103 103
104 def _poststatus(self, other, s, match, listignored, listclean, listunknown): 104 def _poststatus(self, other, s, match, listignored, listclean, listunknown):
105 """provide a hook to allow child objects to postprocess status results 105 """provide a hook to allow child objects to postprocess status results
106 106
107 For example, this allows other contexts, such as workingctx, to filter 107 For example, this allows other contexts, such as workingctx, to filter
309 and isinstance(ctx2, changectx)): 309 and isinstance(ctx2, changectx)):
310 reversed = True 310 reversed = True
311 ctx1, ctx2 = ctx2, ctx1 311 ctx1, ctx2 = ctx2, ctx1
312 312
313 match = ctx2._matchstatus(ctx1, match) 313 match = ctx2._matchstatus(ctx1, match)
314 ctx2._prestatus(ctx1)
314 r = [[], [], [], [], [], [], []] 315 r = [[], [], [], [], [], [], []]
315 r = ctx2._prestatus(ctx1, r, match, listignored, listclean, listunknown)
316 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean, 316 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean,
317 listunknown) 317 listunknown)
318 r = ctx2._poststatus(ctx1, r, match, listignored, listclean, 318 r = ctx2._poststatus(ctx1, r, match, listignored, listclean,
319 listunknown) 319 listunknown)
320 320
1408 for f in removed: 1408 for f in removed:
1409 if f in mf: 1409 if f in mf:
1410 del mf[f] 1410 del mf[f]
1411 return mf 1411 return mf
1412 1412
1413 def _prestatus(self, other, s, match, listignored, listclean, listunknown): 1413 def _prestatus(self, other):
1414 """override the parent hook with a dirstate query 1414 """override the parent hook with a dirstate query
1415 1415
1416 We use this _prestatus hook to populate the status with information from 1416 We use this _prestatus hook to populate the status with information from
1417 the dirstate. 1417 the dirstate.
1418 """ 1418 """
1419 # doesn't need to call super 1419 # doesn't need to call super
1420 return self._dirstatestatus(match, listignored, listclean, listunknown) 1420 pass
1421 1421
1422 def _poststatus(self, other, s, match, listignored, listclean, listunknown): 1422 def _poststatus(self, other, s, match, listignored, listclean, listunknown):
1423 """override the parent hook with a filter for suspect symlinks 1423 """override the parent hook with a filter for suspect symlinks
1424 1424
1425 We use this _poststatus hook to filter out symlinks that might have 1425 We use this _poststatus hook to filter out symlinks that might have
1460 This includes logic for maintaining the fast path of status when 1460 This includes logic for maintaining the fast path of status when
1461 comparing the working directory against its parent, which is to skip 1461 comparing the working directory against its parent, which is to skip
1462 building a new manifest if self (working directory) is not comparing 1462 building a new manifest if self (working directory) is not comparing
1463 against its parent (repo['.']). 1463 against its parent (repo['.']).
1464 """ 1464 """
1465 s = self._dirstatestatus(match, listignored, listclean, listunknown)
1465 if other != self._repo['.']: 1466 if other != self._repo['.']:
1466 s = super(workingctx, self)._buildstatus(other, s, match, 1467 s = super(workingctx, self)._buildstatus(other, s, match,
1467 listignored, listclean, 1468 listignored, listclean,
1468 listunknown) 1469 listunknown)
1469 return s 1470 return s