Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
"Roll your own" options seem unlikely, but I'm pretty sure this not-terribly-expensive app will do what you want:
http://supersync.com/

I've tried it for very minor duplicate stuff, and it seemed to work fine, but I haven't actually tried any merging personally.

It's also possible that one of the many iTunes AppleScripts on this page might work for you, although it probably won't be as easy or tidy as the paid option:
http://dougscripts.com/itunes/
...or this related option:
http://dougscripts.com/itunes/itinfo/ituneslibrarymanager.php
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.