def get_svn_revision(path=None):
 rev = None
 if (path is None):
  path = django.__path__[0]
 entries_path = ('%s/.svn/entries' % path)
 try:
  entries = open(entries_path, 'r').read()
 except IOError:
  pass
 else:
  if re.match('(\\d+)', entries):
   rev_match = re.search('\\d+\\s+dir\\s+(\\d+)', entries)
   if rev_match:
    rev = rev_match.groups()[0]
  else:
   from xml.dom import minidom
   dom = minidom.parse(entries_path)
   rev = dom.getElementsByTagName('entry')[0].getAttribute('revision')
 if rev:
  return (u'SVN-%s' % rev)
 return u'SVN-unknown'

def get_svn_revision ( path = None ) : rev = None if ( path is None ) : path = django . __path__ [ 0 ] entries_path = ( '%s/.svn/entries' % path ) try : entries = open ( entries_path , 'r' ) . read ( ) except IOError : pass else : if re . match ( '(\\d+)' , entries ) : rev_match = re . search ( '\\d+\\s+dir\\s+(\\d+)' , entries ) if rev_match : rev = rev_match . groups ( ) [ 0 ] else : from xml . dom import minidom dom = minidom . parse ( entries_path ) rev = dom . getElementsByTagName ( 'entry' ) [ 0 ] . getAttribute ( 'revision' ) if rev : return ( u'SVN-%s' % rev ) return u'SVN-unknown'
returns the svn revision in the form svn-xxxx .