The Melbourne man was ordered to spend more than two years behind bars after attacking police at two separate protests.