Summarizing the comments:
* add assertions that 'dir' and 'dir/file' are versioned
* get rid of the re-raise if it's not needed anymore
And I'll add: avoid importing os and use the osutils equivalents. While not strictly necessary yet, we plan to make working trees fully testable in-memory via transports and 'os' calls won't work there. Limiting such calls to the minimum needed will help.
Summarizing the comments:
* add assertions that 'dir' and 'dir/file' are versioned
* get rid of the re-raise if it's not needed anymore
And I'll add: avoid importing os and use the osutils equivalents. While not strictly necessary yet, we plan to make working trees fully testable in-memory via transports and 'os' calls won't work there. Limiting such calls to the minimum needed will help.