Commit 51c6b19a authored by thestig's avatar thestig Committed by Commit bot

Remove svn code in checkperms.py after the git migration.

Review URL: https://codereview.chromium.org/503853002

Cr-Commit-Position: refs/heads/master@{#292001}
parent ea8fe7d4
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"""Makes sure files have the right permissions. """Makes sure files have the right permissions.
Some developers have broken SCM configurations that flip the svn:executable Some developers have broken SCM configurations that flip the executable
permission on for no good reason. Unix developers who run ls --color will then permission on for no good reason. Unix developers who run ls --color will then
see .cc files in green and get confused. see .cc files in green and get confused.
...@@ -230,34 +230,6 @@ def capture(cmd, cwd): ...@@ -230,34 +230,6 @@ def capture(cmd, cwd):
return p.communicate()[0] return p.communicate()[0]
def get_svn_info(dir_path):
"""Returns svn meta-data for a svn checkout."""
if not os.path.isdir(dir_path):
return {}
out = capture(['svn', 'info', '.', '--non-interactive'], dir_path)
return dict(l.split(': ', 1) for l in out.splitlines() if l)
def get_svn_url(dir_path):
return get_svn_info(dir_path).get('URL')
def get_svn_root(dir_path):
"""Returns the svn checkout root or None."""
svn_url = get_svn_url(dir_path)
if not svn_url:
return None
logging.info('svn url: %s' % svn_url)
while True:
parent = os.path.dirname(dir_path)
if parent == dir_path:
return None
svn_url = svn_url.rsplit('/', 1)[0]
if svn_url != get_svn_url(parent):
return dir_path
dir_path = parent
def get_git_root(dir_path): def get_git_root(dir_path):
"""Returns the git checkout root or None.""" """Returns the git checkout root or None."""
root = capture(['git', 'rev-parse', '--show-toplevel'], dir_path).strip() root = capture(['git', 'rev-parse', '--show-toplevel'], dir_path).strip()
...@@ -402,24 +374,6 @@ class ApiBase(object): ...@@ -402,24 +374,6 @@ class ApiBase(object):
) )
class ApiSvnQuick(ApiBase):
"""Returns all files in svn-versioned directories, independent of the fact if
they are versionned.
Uses svn info in each directory to determine which directories should be
crawled.
"""
def __init__(self, *args):
super(ApiSvnQuick, self).__init__(*args)
self.url = get_svn_url(self.root_dir)
def check_dir(self, rel_path):
url = self.url + '/' + rel_path
if get_svn_url(os.path.join(self.root_dir, rel_path)) != url:
return []
return super(ApiSvnQuick, self).check_dir(rel_path)
class ApiAllFilesAtOnceBase(ApiBase): class ApiAllFilesAtOnceBase(ApiBase):
_files = None _files = None
...@@ -439,18 +393,6 @@ class ApiAllFilesAtOnceBase(ApiBase): ...@@ -439,18 +393,6 @@ class ApiAllFilesAtOnceBase(ApiBase):
raise NotImplementedError() raise NotImplementedError()
class ApiSvn(ApiAllFilesAtOnceBase):
"""Returns all the subversion controlled files.
Warning: svn ls is abnormally slow.
"""
def _get_all_files(self):
cmd = ['svn', 'ls', '--non-interactive', '--recursive']
return (
x for x in capture(cmd, self.root_dir).splitlines()
if not x.endswith(os.path.sep))
class ApiGit(ApiAllFilesAtOnceBase): class ApiGit(ApiAllFilesAtOnceBase):
def _get_all_files(self): def _get_all_files(self):
return capture(['git', 'ls-files'], cwd=self.root_dir).splitlines() return capture(['git', 'ls-files'], cwd=self.root_dir).splitlines()
...@@ -459,11 +401,6 @@ class ApiGit(ApiAllFilesAtOnceBase): ...@@ -459,11 +401,6 @@ class ApiGit(ApiAllFilesAtOnceBase):
def get_scm(dir_path, bare): def get_scm(dir_path, bare):
"""Returns a properly configured ApiBase instance.""" """Returns a properly configured ApiBase instance."""
cwd = os.getcwd() cwd = os.getcwd()
root = get_svn_root(dir_path or cwd)
if root:
if not bare:
print('Found subversion checkout at %s' % root)
return ApiSvnQuick(dir_path or root, bare)
root = get_git_root(dir_path or cwd) root = get_git_root(dir_path or cwd)
if root: if root:
if not bare: if not bare:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment