Project prefix directory should work with Hg.

Patch based on one by tomic80.
This commit is contained in:
erg@google.com 2010-10-04 22:18:07 +00:00
parent 7ead64485b
commit 42e59b0ce7

9
cpplint/cpplint.py vendored
View File

@ -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, ".git")) and
not os.path.exists(os.path.join(root_dir, ".hg"))): not os.path.exists(os.path.join(root_dir, ".hg"))):
root_dir = os.path.dirname(root_dir) 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"))): if (os.path.exists(os.path.join(root_dir, ".git")) or
prefix = os.path.commonprefix([root_dir, project_dir]) os.path.exists(os.path.join(root_dir, ".hg"))):
return fullname[len(prefix) + 1:] 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... # Don't know what to do; header guard warnings may be wrong...
return fullname return fullname