| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * This file contains functionality for getting dart version numbers using | 6 * This file contains functionality for getting dart version numbers using |
| 7 * our standard version construction method. Systems that does not include this | 7 * our standard version construction method. Systems that does not include this |
| 8 * file should emulate the structure for revision numbers that we have here. | 8 * file should emulate the structure for revision numbers that we have here. |
| 9 * | 9 * |
| 10 * The version number of a dart build is constructed as follows: | 10 * The version number of a dart build is constructed as follows: |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } catch(e) { | 142 } catch(e) { |
| 143 return 0; | 143 return 0; |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 return 0; | 147 return 0; |
| 148 } | 148 } |
| 149 | 149 |
| 150 Future<int> getRevision() { | 150 Future<int> getRevision() { |
| 151 if (repositoryType == RepositoryType.UNKNOWN) { | 151 if (repositoryType == RepositoryType.UNKNOWN) { |
| 152 return new Future.immediate(0); | 152 return new Future.value(0); |
| 153 } | 153 } |
| 154 var isSvn = repositoryType == RepositoryType.SVN; | 154 var isSvn = repositoryType == RepositoryType.SVN; |
| 155 var command = isSvn ? "svn" : "git"; | 155 var command = isSvn ? "svn" : "git"; |
| 156 command = "$command${getExecutableSuffix()}"; | 156 command = "$command${getExecutableSuffix()}"; |
| 157 var arguments = isSvn ? ["info"] : ["svn", "info"]; | 157 var arguments = isSvn ? ["info"] : ["svn", "info"]; |
| 158 ProcessOptions options = new ProcessOptions(); | 158 ProcessOptions options = new ProcessOptions(); |
| 159 // Run the command from the root to get the last changed revision for this | 159 // Run the command from the root to get the last changed revision for this |
| 160 // "branch". Since we have both trunk and bleeding edge in the same | 160 // "branch". Since we have both trunk and bleeding edge in the same |
| 161 // repository and since we always build TOT we need this to get the | 161 // repository and since we always build TOT we need this to get the |
| 162 // right version number. | 162 // right version number. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 static RepositoryType guessType() { | 217 static RepositoryType guessType() { |
| 218 if (new Directory(".svn").existsSync()) return RepositoryType.SVN; | 218 if (new Directory(".svn").existsSync()) return RepositoryType.SVN; |
| 219 if (new Directory(".git").existsSync()) return RepositoryType.GIT; | 219 if (new Directory(".git").existsSync()) return RepositoryType.GIT; |
| 220 return RepositoryType.UNKNOWN; | 220 return RepositoryType.UNKNOWN; |
| 221 } | 221 } |
| 222 | 222 |
| 223 String toString() => name; | 223 String toString() => name; |
| 224 | 224 |
| 225 final String name; | 225 final String name; |
| 226 } | 226 } |
| OLD | NEW |