Couple<HgRevisionNumber> (@NotNull VirtualFile repo) { HgCommandExecutor commandExecutor = new HgCommandExecutor(myProject); commandExecutor.setSilent(true); HgCommandResult result = commandExecutor.executeInCurrentThread(repo, "identify", Arrays.asList("--num", "--id")); if (result == null) { return Couple.of(HgRevisionNumber.NULL_REVISION_NUMBER, null); } final List<String> lines = result.getOutputLines(); if (!lines.isEmpty()) { List<String> parts = StringUtil.split(lines.get(0), " "); if (parts.size() >= 2) { String changesets = parts.get(0); String revisions = parts.get(1); if (changesets.indexOf('+') != changesets.lastIndexOf('+')) { // in the case of unresolved merge we have 2 revisions at once, both current, so with "+" // 9f2e6c02913c+b311eb4eb004+ 186+183+ List<String> chsets = StringUtil.split(changesets, "+"); List<String> revs = StringUtil.split(revisions, "+"); return Couple.of(HgRevisionNumber.getInstance(revs.get(0) + "+", chsets.get(0) + "+"), HgRevisionNumber.getInstance(revs.get(1) + "+", chsets.get(1) + "+")); } else { return Couple.of(HgRevisionNumber.getInstance(revisions, changesets), null); } } } return Couple.of(HgRevisionNumber.NULL_REVISION_NUMBER, null); }