Homological aspects of branching laws