Section 5. The repeal of a law by this act shall not affect any punishment, penalty or forfeiture incurred under such law, except that any provision of the General Laws by which a punishment, penalty or forfeiture is mitigated may be extended and applied to any judgment pronounced after said repeal.