I think this is a great idea and I have wanted to implement something similar for some time. My idea so far is to use our CI server to do the merge and then run the build and tests before checking in the result. Fail the CI job if the merge can't be done automatically (which should then notify someone to go do it manually).
With reasonable test coverage, I suspect that the benefits of automating this will outweigh the occasional issue caused by semantically incorrect merging that isn't caught by unit tests. Even that could probably be eliminated by a combination of reviews and failing the job if the portions of code that were merged are not adequately covered by tests.