Simplify visual diff code

Remove the unnecessary per-target hasDiff flag.

Extract the code for calculating the hasDiff/showDiff flags
into a separate method.