It shall be the duty of the prosecuting attorney when he has knowledge of former sentence or sentences to the penitentiary of any person convicted of an offense punishable by confinement in the penitentiary to give information thereof to the court immediately upon conviction and before sentence. Said court shall, before expiration of the term at which such person was convicted, cause such person or prisoner to be brought before it, and upon an information filed by the prosecuting attorney, setting forth the records of conviction and sentence, or convictions and sentences, as the case may be, and alleging the identity of the prisoner with the person named in each, shall require the prisoner to say whether he is the same person or not. If he says he is not, or remains silent, his plea, or the fact of his silence, shall be entered of record, and a jury shall be impanelled to inquire whether the prisoner is the same person mentioned in the several records. If the jury finds that he is not the same person, he shall be sentenced upon the charge of which he was convicted as provided by law; but if they find that he is the same, or after being duly cautioned if he acknowledged in open court that he is the same person, the court shall sentence him to such further confinement as is prescribed by section eighteen of this article on a second or third conviction as the case may be.
The clerk of such court shall transmit a copy of said information to the warden of the penitentiary, together with the other papers required by the provisions of section ten, article eight (seven), chapter sixty-two of the Code of West Virginia, 1931.
Nothing contained herein shall be construed as repealing the provisions of section four, article eight, chapter sixty-two of the Code of West Virginia, 1931, but no proceeding shall be instituted by the warden, as provided therein, if the trial court has determined the fact of former conviction or convictions as provided herein.