int (@NotNull HgCommandResult result) { int numberOfCommitsInAllSubrepos = 0; final List<String> outputLines = result.getOutputLines(); for (String outputLine : outputLines) { outputLine = outputLine.trim(); final Matcher matcher = PUSH_COMMITS_PATTERN.matcher(outputLine); if (matcher.matches()) { try { String numberOfCommits = matcher.group(1); numberOfCommitsInAllSubrepos += ONE.equals(numberOfCommits) ? 1 : Integer.parseInt(numberOfCommits); } catch (NumberFormatException e) { LOG.error("getNumberOfPushedCommits ", e); return -1; } } } return numberOfCommitsInAllSubrepos; }