public static PatchFileHeaderInfo parseHeader(Iterator<String> iterator) {
    String lineSeparator = "\n";
    StringBuilder message = new StringBuilder();
    VcsUser author = null;
    String revision = null;
    boolean treatAllAsMessageLine = false;

    while (iterator.hasNext()) {
      String curLine = iterator.next();
      Matcher revisionMatcher = ourBaseRevisionPattern.matcher(curLine);
      Matcher authorMatcher = ourAuthorPattern.matcher(curLine);
      Matcher subjectMatcher = ourSubjectPattern.matcher(curLine);
      Matcher endHeaderMatcher = ourHeaderEndMarker.matcher(curLine);
      if (endHeaderMatcher.matches()) {
        break;
      }
      else if (treatAllAsMessageLine) {
        message.append(lineSeparator).append(curLine);
      }
      else if (revisionMatcher.matches()) {
        revision = revisionMatcher.group(1);
      }
      else if (authorMatcher.matches()) {
        author = new VcsUserImpl(authorMatcher.group(1), ObjectUtils.chooseNotNull(authorMatcher.group(2), ""));
      }
      else if (subjectMatcher.matches()) {
        message.append(subjectMatcher.group(1));
        treatAllAsMessageLine = true;
      }
    }

    return new PatchFileHeaderInfo(message.toString().trim(), author, revision);
  }
public static PatchFileHeaderInfo parseHeader(Iterator<String> iterator)