From 42e59b0ce76c36b15b051d1932d0f599b1e5d469 Mon Sep 17 00:00:00 2001 From: "erg@google.com" Date: Mon, 4 Oct 2010 22:18:07 +0000 Subject: [PATCH] Project prefix directory should work with Hg. Patch based on one by tomic80. --- cpplint/cpplint.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cpplint/cpplint.py b/cpplint/cpplint.py index a2d5bea..be10764 100755 --- a/cpplint/cpplint.py +++ b/cpplint/cpplint.py @@ -719,10 +719,11 @@ class FileInfo: not os.path.exists(os.path.join(root_dir, ".git")) and not os.path.exists(os.path.join(root_dir, ".hg"))): 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"))): - prefix = os.path.commonprefix([root_dir, project_dir]) - return fullname[len(prefix) + 1:] + + if (os.path.exists(os.path.join(root_dir, ".git")) or + os.path.exists(os.path.join(root_dir, ".hg"))): + prefix = os.path.commonprefix([root_dir, project_dir]) + return fullname[len(prefix) + 1:] # Don't know what to do; header guard warnings may be wrong... return fullname