Project prefix directory should work with Hg.
Patch based on one by tomic80.
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 @@
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