Comments
Patch
@@ -132,5 +132,5 @@ def _confighash(ui):
return sectionhash[:6] + envhash[:6]
-def _getmtimepaths(ui):
+def _getmtimepaths():
"""get a list of paths that should be checked to detect change
@@ -182,17 +182,8 @@ def _mtimehash(paths):
class hashstate(object):
"""a structure storing confighash, mtimehash, paths used for mtimehash"""
- def __init__(self, confighash, mtimehash, mtimepaths):
- self.confighash = confighash
- self.mtimehash = mtimehash
- self.mtimepaths = mtimepaths
-
- @staticmethod
- def fromui(ui, mtimepaths=None):
- if mtimepaths is None:
- mtimepaths = _getmtimepaths(ui)
- confighash = _confighash(ui)
- mtimehash = _mtimehash(mtimepaths)
- _log('confighash = %s mtimehash = %s\n' % (confighash, mtimehash))
- return hashstate(confighash, mtimehash, mtimepaths)
+ def __init__(self, ui, confighash=None, mtimehash=None, mtimepaths=None):
+ self.confighash = confighash or _confighash(ui)
+ self.mtimehash = mtimehash or _getmtimepaths()
+ self.mtimepaths = mtimepaths or _mtimehash(self.mtimepaths)
def _newchgui(srcui, csystem):
@@ -427,5 +418,5 @@ class chgcmdserver(commandserver.server)
self.cresult.write('exit 255')
return
- newhash = hashstate.fromui(lui, self.hashstate.mtimepaths)
+ newhash = hashstate(ui=lui, mtimepaths=self.hashstate.mtimepaths)
insts = []
if newhash.mtimehash != self.hashstate.mtimehash:
@@ -508,5 +499,5 @@ class chgunixservicehandler(object):
self._realaddress = address
return
- self._hashstate = hashstate.fromui(self.ui)
+ self._hashstate = hashstate(ui=self.ui)
self._realaddress = _hashaddress(address, self._hashstate.confighash)