The only project I know that does something similar (successfully) is subversion and it's by social convention.
Social conventions would be the preferred way to handle this. But that requires some education for all committers to understand and support those conventions. That can be difficult with new people coming on board.