This rule could even make productivity go down. Imagine you're working on something and you just finished a chunk that works and you're happy for that to be checked in (it won't break the build, etc.).
You then could start working on the next bit, but it's almost 5:30PM and you know that you won't be able to get the new code working before 6PM when you leave and would have to check in your unfinished code (which breaks the build, and you don't want to do that).
So you stop coding and go and do something else. It could be something useful, or maybe you're just browsing the web, checking email, etc. Therefore you could see that half hour as 'lost'. There is a good chance it happens multiple times a week, and among other developers in the office as well. So you could potentially lose hours of coding time a week, and surely the management wouldn't be too happy with that either...