Chromium Code Reviews| Index: tools/release/version.dart |
| diff --git a/tools/release/version.dart b/tools/release/version.dart |
| index 74e1e66363d0dde9d2c933a661e1926ce3ab97be..e9f0111f7351e3e01e4dfb845c7ac71c8adcd690 100644 |
| --- a/tools/release/version.dart |
| +++ b/tools/release/version.dart |
| @@ -189,20 +189,23 @@ class Version { |
| return username; |
| } |
| - bool isGitRepository() { |
| + RepositoryType get repositoryType { |
| + bool hasDirectory(path, name) { |
| + return new Directory.fromPath(path.append(name)).existsSync(); |
| + } |
| + |
| var currentPath = new Path(new Directory.current().path); |
|
Bill Hesse
2013/04/29 11:58:56
This is changing to Directory.current, so if versi
kustermann
2013/04/30 09:38:44
Thanks for the hint.
|
| - while (!new Directory.fromPath(currentPath.append(".git")).existsSync()) { |
| - currentPath = currentPath.directoryPath; |
| + while (true) { |
| + if (hasDirectory(currentPath, '.svn')) { |
| + return RepositoryType.SVN; |
| + } else if (hasDirectory(currentPath, '.git')) { |
| + return RepositoryType.GIT; |
| + } |
| if (currentPath.toString() == "/") { |
|
Bill Hesse
2013/04/29 11:58:56
I'm not sure this will work on Windows - paths wil
ricow1
2013/04/30 07:21:28
I think we can fix this by doing:
do {
} while (
kustermann
2013/04/30 09:38:44
I think this is not doing what we want. It allows
|
| break; |
| } |
| + currentPath = currentPath.directoryPath; |
| } |
| - return new Directory.fromPath(currentPath.append(".git")).existsSync(); |
| - } |
| - |
| - RepositoryType get repositoryType { |
| - if (new Directory(".svn").existsSync()) return RepositoryType.SVN; |
| - if (isGitRepository()) return RepositoryType.GIT; |
| return RepositoryType.UNKNOWN; |
| } |
| } |