Use distutils LooseVersion to compare mercurial version
ported from http://code.google.com/p/mercurial-reviewboard/source/detail?r=75c6151e89eae5f8e4227de536149c529f5b7dc5
Make it compatible for mercurial >= 2.3

Fix the problem showing "abort: repository ... is not local"
force to use apiver 2.0