import from mercurial as of changeset:   9626:3b51f4defa0d