OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import optparse | 6 import optparse |
7 import os | 7 import os |
8 import re | 8 import re |
9 import string | 9 import string |
10 import sys | 10 import sys |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 # Branch number is the third value in the quad. | 397 # Branch number is the third value in the quad. |
398 branch_dict[version[2]] = major | 398 branch_dict[version[2]] = major |
399 | 399 |
400 if not branch_dict: | 400 if not branch_dict: |
401 # |milestone| not found. | 401 # |milestone| not found. |
402 print "Milestone provided is invalid" | 402 print "Milestone provided is invalid" |
403 return None | 403 return None |
404 | 404 |
405 # The following returns a sorted list of the keys of |branch_dict|. | 405 # The following returns a sorted list of the keys of |branch_dict|. |
406 sorted_branches = sorted(branch_dict) | 406 sorted_branches = sorted(branch_dict) |
407 branch = sorted_branches[len(sorted_branches) - 1] | 407 branch = sorted_branches[-1] |
408 | 408 |
409 # If all keys match, the branch is the same for all platforms given | 409 # If all keys match, the branch is the same for all platforms given |
410 # |milestone|. This is the safe case, so return the branch. | 410 # |milestone|. This is the safe case, so return the branch. |
411 if len(sorted_branches) == 1: | 411 if len(sorted_branches) == 1: |
412 return branch | 412 return branch |
413 | 413 |
414 # Not all of the platforms have the same branch. Prompt the user and return | 414 # Not all of the platforms have the same branch. Prompt the user and return |
415 # the greatest (by value) branch on success. | 415 # the greatest (by value) branch on success. |
416 if prompt("Not all platforms have the same branch number, " | 416 if prompt("Not all platforms have the same branch number, " |
417 "continue with branch %s?" % branch): | 417 "continue with branch %s?" % branch): |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 | 628 |
629 if options.branch and options.milestone: | 629 if options.branch and options.milestone: |
630 option_parser.error("--branch cannot be used with --milestone") | 630 option_parser.error("--branch cannot be used with --milestone") |
631 return 1 | 631 return 1 |
632 | 632 |
633 return drover(options, args) | 633 return drover(options, args) |
634 | 634 |
635 | 635 |
636 if __name__ == "__main__": | 636 if __name__ == "__main__": |
637 sys.exit(main()) | 637 sys.exit(main()) |
OLD | NEW |