added support for rev branch when using deepth parameter

improvement of previous PR for #16920