@classmethod
def from_idx_branch_revision(cls, idx, branch=None, revision=None):
    """Factory method from idx, (branch and revision)."""
    if idx is None:
        return None
    id_ = cls(id_text=idx)
    if not branch:
        branch = cls.BRANCH_TRUNK
    if not revision:
        revision = cls.REV_HEAD
    id_.branch = branch
    id_.revision = revision
    if id_.revision == cls.REV_HEAD:
        id_.to_string_with_version()
    return id_
