https://code.launchpad.net/~mbp/bzr/trivial/+merge/60735 merges something a lot like this. Thanks! Martin