mirror of
https://github.com/google/styleguide.git
synced 2024-03-22 13:11:43 +08:00
Check for mercurial checkouts in addition to svn and git.
Patch by Florian Loitsch <floitsch@google.com>
This commit is contained in:
parent
9ec7bd6269
commit
5e1696994b
10
cpplint/cpplint.py
vendored
10
cpplint/cpplint.py
vendored
|
@ -655,13 +655,15 @@ class FileInfo:
|
||||||
prefix = os.path.commonprefix([root_dir, project_dir])
|
prefix = os.path.commonprefix([root_dir, project_dir])
|
||||||
return fullname[len(prefix) + 1:]
|
return fullname[len(prefix) + 1:]
|
||||||
|
|
||||||
# Not SVN? Try to find a git top level directory by searching up from the
|
# Not SVN? Try to find a git or hg top level directory by searching up
|
||||||
# current path.
|
# from the current path.
|
||||||
root_dir = os.path.dirname(fullname)
|
root_dir = os.path.dirname(fullname)
|
||||||
while (root_dir != os.path.dirname(root_dir) and
|
while (root_dir != os.path.dirname(root_dir) and
|
||||||
not os.path.exists(os.path.join(root_dir, ".git"))):
|
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)
|
root_dir = os.path.dirname(root_dir)
|
||||||
if os.path.exists(os.path.join(root_dir, ".git")):
|
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])
|
prefix = os.path.commonprefix([root_dir, project_dir])
|
||||||
return fullname[len(prefix) + 1:]
|
return fullname[len(prefix) + 1:]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user