Commit 7956a87b authored by erg@chromium.org's avatar erg@chromium.org

Commit cpplint.py r77 to depot_tools.

Committing on behalf of Reid Kleckner <rnk@google.com>.

BUG=102890

Review URL: http://codereview.chromium.org/8676053

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@112099 0039d316-1c4b-4281-b951-d872f2087c98
parent 53790118
......@@ -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:]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment