parameters: (directory, svn_url_regex)
return_statement: return VersionInfo(url, revision)
docstring: Fetch the Subversion branch and revision for a given directory.
  
    Errors are swallowed.
  
    Returns:
      A VersionInfo object or None on error.
docstring_summary: Fetch the Subversion branch and revision for a given directory.
docstring_tokens: Fetch the Subversion branch and revision for a given directory .
function: def FetchSVNRevision(directory, svn_url_regex):
    """
    Fetch the Subversion branch and revision for a given directory.
  
    Errors are swallowed.
  
    Returns:
      A VersionInfo object or None on error.
    """
    try:
      proc = subprocess.Popen(['svn', 'info'],
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE,
                              cwd=directory,
                              shell=(sys.platform=='win32'))
    except OSError:
      # command is apparently either not installed or not executable.
      return None
    if not proc:
      return None
  
    attrs = {}
    for line in proc.stdout:
      line = line.strip()
      if not line:
        continue
      key, val = line.split(': ', 1)
      attrs[key] = val
  
    try:
      match = svn_url_regex.search(attrs['URL'])
      if match:
        url = match.group(2)
      else:
        url = ''
      revision = attrs['Revision']
    except KeyError:
      return None
  
    return VersionInfo(url, revision)
function_tokens: def FetchSVNRevision ( directory , svn_url_regex ) : try : proc = subprocess . Popen ( [ 'svn' , 'info' ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE , cwd = directory , shell = ( sys . platform == 'win32' ) ) except OSError : # command is apparently either not installed or not executable. return None if not proc : return None attrs = { } for line in proc . stdout : line = line . strip ( ) if not line : continue key , val = line . split ( ': ' , 1 ) attrs [ key ] = val try : match = svn_url_regex . search ( attrs [ 'URL' ] ) if match : url = match . group ( 2 ) else : url = '' revision = attrs [ 'Revision' ] except KeyError : return None return VersionInfo ( url , revision )