def _get_version_info(blade_root_dir, svn_roots):
 svn_info_map = {}
 if os.path.exists(('%s/.git' % blade_root_dir)):
  cmd = 'git log -n 1'
  dirname = os.path.dirname(blade_root_dir)
  version_info = _exec_get_version_info(cmd, None)
  if version_info:
   svn_info_map[dirname] = version_info
  return svn_info_map
 for root_dir in svn_roots:
  root_dir_realpath = os.path.realpath(root_dir)
  svn_working_dir = os.path.dirname(root_dir_realpath)
  svn_dir = os.path.basename(root_dir_realpath)
  cmd = ('svn info %s' % svn_dir)
  version_info = _exec_get_version_info(cmd, svn_working_dir)
  if (not version_info):
   cmd = 'git ls-remote --get-url && git branch | grep "*" && git log -n 1'
   version_info = _exec_get_version_info(cmd, root_dir_realpath)
   if (not version_info):
    console.warning(('Failed to get version control info in %s' % root_dir))
  if version_info:
   svn_info_map[root_dir] = version_info
 return svn_info_map

def _get_version_info ( blade_root_dir , svn_roots ) : svn_info_map = { } if os . path . exists ( ( '%s/.git' % blade_root_dir ) ) : cmd = 'git log -n 1' dirname = os . path . dirname ( blade_root_dir ) version_info = _exec_get_version_info ( cmd , None ) if version_info : svn_info_map [ dirname ] = version_info return svn_info_map for root_dir in svn_roots : root_dir_realpath = os . path . realpath ( root_dir ) svn_working_dir = os . path . dirname ( root_dir_realpath ) svn_dir = os . path . basename ( root_dir_realpath ) cmd = ( 'svn info %s' % svn_dir ) version_info = _exec_get_version_info ( cmd , svn_working_dir ) if ( not version_info ) : cmd = 'git ls-remote --get-url && git branch | grep "*" && git log -n 1' version_info = _exec_get_version_info ( cmd , root_dir_realpath ) if ( not version_info ) : console . warning ( ( 'Failed to get version control info in %s' % root_dir ) ) if version_info : svn_info_map [ root_dir ] = version_info return svn_info_map
gets svn root dir info .