SmartList<HgRevisionNumber> (@NotNull String parentsString, @NotNull String currentRevisionString) { SmartList<HgRevisionNumber> parents = new SmartList<>(); if (StringUtil.isEmptyOrSpaces(parentsString)) { // parents shouldn't be empty only if not supported long revision = Long.parseLong(currentRevisionString); HgRevisionNumber parentRevision = HgRevisionNumber.getLocalInstance(String.valueOf(revision - 1)); parents.add(parentRevision); return parents; } //hg returns parents in the format 'rev:node rev:node ' (note the trailing space) List<String> parentStrings = StringUtil.split(parentsString.trim(), " "); for (String parentString : parentStrings) { List<String> parentParts = StringUtil.split(parentString, ":"); //if revision has only 1 parent and "--debug" argument were added or if appropriate parent template were used, // its second parent has revision number -1 if (Integer.parseInt(parentParts.get(0)) >= 0) { parents.add(HgRevisionNumber.getInstance(parentParts.get(0), parentParts.get(1))); } } return parents; }