| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 01b7b9a commit 9d0641e
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1073,40 +1073,10 @@ def RepositoryName(self): | |||
| 1073 | 1073 | locations won't see bogus errors. | |
| 1074 | 1074 | """ | |
| 1075 | 1075 | fullname = self.FullName() | |
| 1076 | - | ||
| 1077 | - if os.path.exists(fullname): | ||
| 1078 | - project_dir = os.path.dirname(fullname) | ||
| 1079 | - | ||
| 1080 | - if os.path.exists(os.path.join(project_dir, ".svn")): | ||
| 1081 | - # If there's a .svn file in the current directory, we recursively look | ||
| 1082 | - # up the directory tree for the top of the SVN checkout | ||
| 1083 | - root_dir = project_dir | ||
| 1084 | - one_up_dir = os.path.dirname(root_dir) | ||
| 1085 | - while os.path.exists(os.path.join(one_up_dir, ".svn")): | ||
| 1086 | - root_dir = os.path.dirname(root_dir) | ||
| 1087 | - one_up_dir = os.path.dirname(one_up_dir) | ||
| 1088 | - | ||
| 1089 | - prefix = os.path.commonprefix([root_dir, project_dir]) | ||
| 1090 | - return fullname[len(prefix) + 1:] | ||
| 1091 | - | ||
| 1092 | - # Not SVN <= 1.6? Try to find a git, hg, or svn top level directory by | ||
| 1093 | - # searching up from the current path. | ||
| 1094 | - root_dir = current_dir = os.path.dirname(fullname) | ||
| 1095 | - while current_dir != os.path.dirname(current_dir): | ||
| 1096 | - if (os.path.exists(os.path.join(current_dir, ".git")) or | ||
| 1097 | - os.path.exists(os.path.join(current_dir, ".hg")) or | ||
| 1098 | - os.path.exists(os.path.join(current_dir, ".svn"))): | ||
| 1099 | - root_dir = current_dir | ||
| 1100 | - current_dir = os.path.dirname(current_dir) | ||
| 1101 | - | ||
| 1102 | - if (os.path.exists(os.path.join(root_dir, ".git")) or | ||
| 1103 | - os.path.exists(os.path.join(root_dir, ".hg")) or | ||
| 1104 | - os.path.exists(os.path.join(root_dir, ".svn"))): | ||
| 1105 | - prefix = os.path.commonprefix([root_dir, project_dir]) | ||
| 1106 | - return fullname[len(prefix) + 1:] | ||
| 1107 | - | ||
| 1108 | - # Don't know what to do; header guard warnings may be wrong... | ||
| 1109 | - return fullname | ||
| 1076 | + # XXX(bnoordhuis) Expects that cpplint.py lives in the tools/ directory. | ||
| 1077 | + toplevel = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | ||
| 1078 | + prefix = os.path.commonprefix([fullname, toplevel]) | ||
| 1079 | + return fullname[len(prefix) + 1:] | ||
| 1110 | 1080 | ||
| 1111 | 1081 | def Split(self): | |
| 1112 | 1082 | """Splits the file into the directory, basename, and extension. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments