As reported in bug #144627 (and again recently on IRC) this can have the unfortunate effect of masking other exceptions. If an exception is raised within a method decorated by "@needs_write_lock", such as a KeyboardInterrupt or network error in branch.push, then when the decorator tries to unlock it will cause this error.
Possibly the needs_write_lock decorator should take care to always re-raise the original exception, and if another occurred during an unlock, to just emit a warning that bzr could not automatically unlock the object without discarding the original exception?
As reported in bug #144627 (and again recently on IRC) this can have the unfortunate effect of masking other exceptions. If an exception is raised within a method decorated by "@needs_ write_lock" , such as a KeyboardInterrupt or network error in branch.push, then when the decorator tries to unlock it will cause this error.
Possibly the needs_write_lock decorator should take care to always re-raise the original exception, and if another occurred during an unlock, to just emit a warning that bzr could not automatically unlock the object without discarding the original exception?