Using community and population approaches to understand how contemporary and historical factors have shaped species distribution in river ecosystems