parameters: (self, in_directory)
return_statement: return ''
docstring: Returns the git/svn revision for the given directory.
  
      Args:
        in_directory: The directory relative to src.
docstring_summary: Returns the git/svn revision for the given directory.
docstring_tokens: Returns the git / svn revision for the given directory .
function: def _get_svn_revision(self, in_directory):
      """Returns the git/svn revision for the given directory.
  
      Args:
        in_directory: The directory relative to src.
      """
      def _is_git_directory(in_directory):
        """Returns true if the given directory is in a git repository.
  
        Args:
          in_directory: The directory path to be tested.
        """
        if os.path.exists(os.path.join(in_directory, '.git')):
          return True
        parent = os.path.dirname(in_directory)
        if parent == constants.DIR_SOURCE_ROOT or parent == in_directory:
          return False
        return _is_git_directory(parent)
  
      in_directory = os.path.join(constants.DIR_SOURCE_ROOT, in_directory)
  
      if not os.path.exists(os.path.join(in_directory, '.svn')):
        if _is_git_directory(in_directory):
          return repo_utils.GetGitHeadSHA1(in_directory)
        else:
          return ''
  
      output = cmd_helper.GetCmdOutput(['svn', 'info', '--xml'], cwd=in_directory)
      try:
        dom = xml.dom.minidom.parseString(output)
        return dom.getElementsByTagName('entry')[0].getAttribute('revision')
      except xml.parsers.expat.ExpatError:
        return ''
      return ''
function_tokens: def _get_svn_revision ( self , in_directory ) : def _is_git_directory ( in_directory ) : """Returns true if the given directory is in a git repository.
  
        Args:
          in_directory: The directory path to be tested.
        """ if os . path . exists ( os . path . join ( in_directory , '.git' ) ) : return True parent = os . path . dirname ( in_directory ) if parent == constants . DIR_SOURCE_ROOT or parent == in_directory : return False return _is_git_directory ( parent ) in_directory = os . path . join ( constants . DIR_SOURCE_ROOT , in_directory ) if not os . path . exists ( os . path . join ( in_directory , '.svn' ) ) : if _is_git_directory ( in_directory ) : return repo_utils . GetGitHeadSHA1 ( in_directory ) else : return '' output = cmd_helper . GetCmdOutput ( [ 'svn' , 'info' , '--xml' ] , cwd = in_directory ) try : dom = xml . dom . minidom . parseString ( output ) return dom . getElementsByTagName ( 'entry' ) [ 0 ] . getAttribute ( 'revision' ) except xml . parsers . expat . ExpatError : return '' return ''