/**
  * Checks Hg version and updates the myVersion variable. In the case of nullable or unsupported
  * version reports the problem.
  */
 public void checkVersion() {
   final String executable = getGlobalSettings().getHgExecutable();
   HgCommandResultNotifier errorNotification = new HgCommandResultNotifier(myProject);
   final String SETTINGS_LINK = "settings";
   final String UPDATE_LINK = "update";
   NotificationListener linkAdapter =
       new NotificationListener.Adapter() {
         @Override
         protected void hyperlinkActivated(
             @NotNull Notification notification, @NotNull HyperlinkEvent e) {
           if (SETTINGS_LINK.equals(e.getDescription())) {
             ShowSettingsUtil.getInstance()
                 .showSettingsDialog(myProject, getConfigurable().getDisplayName());
           } else if (UPDATE_LINK.equals(e.getDescription())) {
             BrowserUtil.browse("http://mercurial.selenic.com");
           }
         }
       };
   try {
     myVersion = HgVersion.identifyVersion(executable);
     // if version is not supported, but have valid hg executable
     if (!myVersion.isSupported()) {
       LOG.info("Unsupported Hg version: " + myVersion);
       String message =
           String.format(
               "The <a href='"
                   + SETTINGS_LINK
                   + "'>configured</a> version of Hg is not supported: %s.<br/> "
                   + "The minimal supported version is %s. Please <a href='"
                   + UPDATE_LINK
                   + "'>update</a>.",
               myVersion,
               HgVersion.MIN);
       errorNotification.notifyError(null, "Unsupported Hg version", message, linkAdapter);
     } else if (myVersion.hasUnsupportedExtensions()) {
       String unsupportedExtensionsAsString = myVersion.getUnsupportedExtensions().toString();
       LOG.warn("Unsupported Hg extensions: " + unsupportedExtensionsAsString);
       String message =
           String.format(
               "Some hg extensions %s are not found or not supported by your hg version and will be ignored.\n"
                   + "Please, update your hgrc or Mercurial.ini file",
               unsupportedExtensionsAsString);
       errorNotification.notifyWarning("Unsupported Hg version", message);
     }
   } catch (Exception e) {
     if (getExecutableValidator().checkExecutableAndNotifyIfNeeded()) {
       // sometimes not hg application has version command, but we couldn't parse an answer as
       // valid hg,
       // so parse(output) throw ParseException, but hg and git executable seems to be valid in
       // this case
       final String reason = (e.getCause() != null ? e.getCause() : e).getMessage();
       String message = HgVcsMessages.message("hg4idea.unable.to.run.hg", executable);
       errorNotification.notifyError(
           null,
           message,
           String.format(
               reason
                   + "<br/> Please check your hg executable path in <a href='"
                   + SETTINGS_LINK
                   + "'> settings </a>"),
           linkAdapter);
     }
   }
 }
 public String getDisplayName() {
   return HgVcsMessages.message("hg4idea.mercurial");
 }