def _svn_revision(filename):
 p = subprocess.Popen([u'svn', u'status', u'-v', filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 (stdout, stderr) = p.communicate()
 if ((p.returncode != 0) or stderr or (not stdout)):
  raise ValueError((u'Error determining svn_revision for %s: %s' % (os.path.split(filename)[1], textwrap.fill(stderr))))
 return stdout.split()[2]

def _svn_revision ( filename ) : p = subprocess . Popen ( [ u'svn' , u'status' , u'-v' , filename ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) ( stdout , stderr ) = p . communicate ( ) if ( ( p . returncode != 0 ) or stderr or ( not stdout ) ) : raise ValueError ( ( u'Error determining svn_revision for %s: %s' % ( os . path . split ( filename ) [ 1 ] , textwrap . fill ( stderr ) ) ) ) return stdout . split ( ) [ 2 ]
helper for build_index(): calculate the subversion revision number for a given file .