If the dir doesn't exist, something is wrong - we really shouldn't have gotten this far without it, should we?
Docstrings!!!
I'll review the tests after the core is good.
Uh, you raise NoLockDir, but use it to mean 'A config directory that is not locked' which is very odd. Please consider something that means what you need. Also see my ordering suggestion which may help you not to need this at all.
Ok, actual review stuff:
the docstring layout is wrong, please nuke the \.
We should check for branches first, not config files, because branch locks are the common case and break-lock doesn't need to be slow.
This change is suspicous:
152 def _write_ config_ file(self) : _get_filename( ), "wb") filename( ) dirname( fname) config_ dir_exists( conf_dir) copy_ownership_ from_path( f.name) copy_ownership_ from_path( fname) parser( ).write( f)
153 - f = file(self.
154 + fname = self._get_
155 + conf_dir = os.path.
156 + ensure_
157 + f = file(fname, "wb")
158 try:
159 - osutils.
160 + osutils.
161 self._get_
162 finally:
163 f.close()
164
It appears to be adding a new stat/mkdir check, at the wrong layer.
missing VWS:
172 + """
173 + lock_name = 'lock'
Ditto here:
181 + def lock_write(self, token=None): config_ dir_exists( self.dir) LockDir( self.transport, self.lock_name) lock_write( token) kResult( self.unlock)
182 + if self.lock is None:
183 + ensure_
184 + self._lock = lockdir.
185 + self._lock.
186 + return lock.LogicalLoc
If the dir doesn't exist, something is wrong - we really shouldn't have gotten this far without it, should we?
Docstrings!!!
I'll review the tests after the core is good.
Uh, you raise NoLockDir, but use it to mean 'A config directory that is not locked' which is very odd. Please consider something that means what you need. Also see my ordering suggestion which may help you not to need this at all.