def create_release_vcs(path, vcs_name=None):
from rez.plugin_managers import plugin_manager<EOL>vcs_types = get_release_vcs_types()<EOL>if vcs_name:<EOL><INDENT>if vcs_name not in vcs_types:<EOL><INDENT>raise ReleaseVCSError("<STR_LIT>" % vcs_name)<EOL><DEDENT>cls = plugin_manager.get_plugin_class('<STR_LIT>', vcs_name)<EOL>return cls(path)<EOL><DEDENT>classes_by_level = {}<EOL>for vcs_name in vcs_types:<EOL><INDENT>cls = plugin_manager.get_plugin_class('<STR_LIT>', vcs_name)<EOL>result = cls.find_vcs_root(path)<EOL>if not result:<EOL><INDENT>continue<EOL><DEDENT>vcs_path, levels_up = result<EOL>classes_by_level.setdefault(levels_up, []).append((cls, vcs_path))<EOL><DEDENT>if not classes_by_level:<EOL><INDENT>raise ReleaseVCSError("<STR_LIT>"<EOL>"<STR_LIT>" % path)<EOL><DEDENT>lowest_level = sorted(classes_by_level)[<NUM_LIT:0>]<EOL>clss = classes_by_level[lowest_level]<EOL>if len(clss) > <NUM_LIT:1>:<EOL><INDENT>clss_str = "<STR_LIT:U+002CU+0020>".join(x[<NUM_LIT:0>].name() for x in clss)<EOL>raise ReleaseVCSError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % (path, clss_str))<EOL><DEDENT>else:<EOL><INDENT>cls, vcs_root = clss[<NUM_LIT:0>]<EOL>return cls(pkg_root=path, vcs_root=vcs_root)<EOL><DEDENT>
Return a new release VCS that can release from this source path.