From 3dc7426aedd4ce43ada8907bb0899300633b20e8 Mon Sep 17 00:00:00 2001 From: "erg@google.com" Date: Wed, 30 Nov 2011 01:12:00 +0000 Subject: [PATCH] Support svn 1.7 directory structure. Committing on behalf of Reid Kleckner . BUG=chromium:102890 --- cpplint/cpplint.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cpplint/cpplint.py b/cpplint/cpplint.py index 19308c1..016116b 100755 --- a/cpplint/cpplint.py +++ b/cpplint/cpplint.py @@ -713,16 +713,18 @@ class FileInfo: prefix = os.path.commonprefix([root_dir, project_dir]) return fullname[len(prefix) + 1:] - # Not SVN? Try to find a git or hg top level directory by searching up - # from the current path. + # Not SVN <= 1.6? Try to find a git, hg, or svn top level directory by + # searching up from the current path. root_dir = os.path.dirname(fullname) while (root_dir != os.path.dirname(root_dir) and not os.path.exists(os.path.join(root_dir, ".git")) and - not os.path.exists(os.path.join(root_dir, ".hg"))): + not os.path.exists(os.path.join(root_dir, ".hg")) and + not os.path.exists(os.path.join(root_dir, ".svn"))): root_dir = os.path.dirname(root_dir) if (os.path.exists(os.path.join(root_dir, ".git")) or - os.path.exists(os.path.join(root_dir, ".hg"))): + os.path.exists(os.path.join(root_dir, ".hg")) or + os.path.exists(os.path.join(root_dir, ".svn"))): prefix = os.path.commonprefix([root_dir, project_dir]) return fullname[len(prefix) + 1:]