private static @NotNull List<VcsFileStatusInfo> convertHgChanges(@NotNull Set<HgChange> changes) {
    Set<String> deleted = new HashSet<>();
    Set<String> copied = new HashSet<>();

    for (HgChange change : changes) {
      Change.Type type = getType(change.getStatus());
      if (Change.Type.DELETED.equals(type)) {
        deleted.add(change.beforeFile().getRelativePath());
      }
      else if (Change.Type.MOVED.equals(type)) {
        copied.add(change.beforeFile().getRelativePath());
      }
    }

    List<VcsFileStatusInfo> result = new ArrayList<>();
    for (HgChange change : changes) {
      Change.Type type = getType(change.getStatus());
      LOG.assertTrue(type != null, "Unsupported status for change " + change);

      String firstPath;
      String secondPath;
      switch (type) {
        case DELETED -> {
          firstPath = change.beforeFile().getRelativePath();
          secondPath = null;
          if (copied.contains(firstPath)) continue; // file was renamed
        }
        case MOVED -> {
          firstPath = change.beforeFile().getRelativePath();
          secondPath = change.afterFile().getRelativePath();
          if (!deleted.contains(firstPath)) {
            type = Change.Type.NEW; // file was copied, treating it like an addition
            firstPath = change.afterFile().getRelativePath();
            secondPath = null;
          }
        }
        //case MODIFICATION, NEW ->
        default -> {
          firstPath = change.afterFile().getRelativePath();
          secondPath = null;
        }
      }
      result.add(new VcsFileStatusInfo(type, Objects.requireNonNull(firstPath), secondPath));
    }
    return result;
  }
private static @NotNull List<VcsFileStatusInfo> convertHgChanges(@NotNull Set<HgChange> changes)