A man who admitted fatally shooting a woman he mistook for a rival gang member has been sentenced to 25 years to life in prison.