OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:io'; | 5 import 'dart:io'; |
6 | 6 |
7 import 'package:path/path.dart' as p; | 7 import 'package:path/path.dart' as p; |
8 | 8 |
9 import 'io.dart'; | 9 import 'io.dart'; |
10 import 'log.dart'; | 10 import 'log.dart'; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 String _strongSource; | 107 String _strongSource; |
108 | 108 |
109 Fork(this.twoPath); | 109 Fork(this.twoPath); |
110 | 110 |
111 List<String> migrate() { | 111 List<String> migrate() { |
112 print("- ${bold(twoPath)}:"); | 112 print("- ${bold(twoPath)}:"); |
113 | 113 |
114 var todos = <String>[]; | 114 var todos = <String>[]; |
115 | 115 |
116 if (!oneExists && !twoExists) { | 116 if (!oneExists && !strongExists) { |
117 // It's already been migrated, so there's nothing to move. | 117 // It's already been migrated, so there's nothing to move. |
118 note("Is already migrated."); | 118 note("Is already migrated."); |
119 } else if (twoExists) { | 119 } else if (twoExists) { |
120 // If there is a migrated version and it's the same as an unmigrated one, | 120 // If there is a migrated version and it's the same as an unmigrated one, |
121 // delete the unmigrated one. | 121 // delete the unmigrated one. |
122 if (oneExists) { | 122 if (oneExists) { |
123 if (oneSource == twoSource) { | 123 if (oneSource == twoSource) { |
124 deleteFile(onePath); | 124 deleteFile(onePath); |
125 done("Deleted already-migrated $onePath."); | 125 done("Deleted already-migrated $onePath."); |
126 } else { | 126 } else { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 165 } |
166 | 166 |
167 // See what work is left to be done in the migrated file. | 167 // See what work is left to be done in the migrated file. |
168 if (twoExists) { | 168 if (twoExists) { |
169 validateFile(twoPath, twoSource, todos); | 169 validateFile(twoPath, twoSource, todos); |
170 } | 170 } |
171 | 171 |
172 return todos; | 172 return todos; |
173 } | 173 } |
174 } | 174 } |
OLD | NEW |