[log] IDEA-120178 Check if branch exists before querying Git or Hg

Otherwise both Git and Hg fail with an error "such branch doesn't exist"
'commonjs' and 'webpark' added
move utility method to it's only usage and add test
cleanup and test
don't highlight the entire expression
webpack