def get_svn_revision(self):
        revision = 0
        urlre = re.compile('url="([^"]+)"')
        revre = re.compile('committed-rev="(\d+)"')

        for base,dirs,files in os.walk(os.curdir):
            if '.svn' not in dirs:
                dirs[:] = []
                continue    # no sense walking uncontrolled subdirs
            dirs.remove('.svn')
            f = open(os.path.join(base,'.svn','entries'))
            data = f.read()
            f.close()

            if data.startswith('<?xml'):
                dirurl = urlre.search(data).group(1)    # get repository URL
                localrev = max([int(m.group(1)) for m in revre.finditer(data)]+[0])
            else:
                try: svnver = int(data.splitlines()[0])
                except: svnver=-1
                if data<8:
                    log.warn("unrecognized .svn/entries format; skipping %s", base)
                    dirs[:] = []
                    continue
                   
                data = map(str.splitlines,data.split('\n\x0c\n'))
                del data[0][0]  # get rid of the '8' or '9'
                dirurl = data[0][3]
                localrev = max([int(d[9]) for d in data if len(d)>9 and d[9]]+[0])
            if base==os.curdir:
                base_url = dirurl+'/'   # save the root url
            elif not dirurl.startswith(base_url):
                dirs[:] = []
                continue    # not part of the same svn tree, skip it
            revision = max(revision, localrev)

        return str(revision or get_pkg_info_revision())
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/setuptools-0.6c11/setuptools/command/egg_info.py/egg_info.get_svn_revision/original