OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 the V8 project authors. All rights reserved. | 2 # Copyright 2015 the V8 project 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 argparse | 6 import argparse |
7 import os | 7 import os |
8 import sys | 8 import sys |
9 | 9 |
10 from search_related_commits import git_execute | 10 from search_related_commits import git_execute |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return commits.splitlines() | 50 return commits.splitlines() |
51 | 51 |
52 def get_branches_for_commit(git_working_dir, hash_to_search): | 52 def get_branches_for_commit(git_working_dir, hash_to_search): |
53 branches = git_execute(git_working_dir, ['branch', | 53 branches = git_execute(git_working_dir, ['branch', |
54 '--contains', | 54 '--contains', |
55 hash_to_search, | 55 hash_to_search, |
56 '-a']).strip() | 56 '-a']).strip() |
57 branches = branches.splitlines() | 57 branches = branches.splitlines() |
58 return map(str.strip, branches) | 58 return map(str.strip, branches) |
59 | 59 |
60 def is_rolling(git_working_dir, hash_to_search): | |
61 branches = get_branches_for_commit(git_working_dir, hash_to_search) | |
62 return 'remotes/origin/roll' in branches | |
63 | |
64 def is_lkgr(git_working_dir, hash_to_search): | 60 def is_lkgr(git_working_dir, hash_to_search): |
65 branches = get_branches_for_commit(git_working_dir, hash_to_search) | 61 branches = get_branches_for_commit(git_working_dir, hash_to_search) |
66 return 'remotes/origin/lkgr' in branches | 62 return 'remotes/origin/lkgr' in branches |
67 | 63 |
68 def get_first_canary(git_working_dir, hash_to_search): | 64 def get_first_canary(git_working_dir, hash_to_search): |
69 branches = get_branches_for_commit(git_working_dir, hash_to_search) | 65 branches = get_branches_for_commit(git_working_dir, hash_to_search) |
70 canaries = ([currentBranch for currentBranch in branches if | 66 canaries = ([currentBranch for currentBranch in branches if |
71 currentBranch.startswith('remotes/origin/chromium/')]) | 67 currentBranch.startswith('remotes/origin/chromium/')]) |
72 canaries.sort() | 68 canaries.sort() |
73 if len(canaries) == 0: | 69 if len(canaries) == 0: |
74 return 'No Canary coverage' | 70 return 'No Canary coverage' |
75 return canaries[0].split('/')[-1] | 71 return canaries[0].split('/')[-1] |
76 | 72 |
77 def print_analysis(git_working_dir, hash_to_search): | 73 def print_analysis(git_working_dir, hash_to_search): |
78 print '1.) Searching for "' + hash_to_search + '"' | 74 print '1.) Searching for "' + hash_to_search + '"' |
79 print '=====================ORIGINAL COMMIT START===================' | 75 print '=====================ORIGINAL COMMIT START===================' |
80 print describe_commit(git_working_dir, hash_to_search) | 76 print describe_commit(git_working_dir, hash_to_search) |
81 print '=====================ORIGINAL COMMIT END=====================' | 77 print '=====================ORIGINAL COMMIT END=====================' |
82 | |
83 print '2.) General information:' | 78 print '2.) General information:' |
84 print 'Is rolling: ' + str(is_rolling(git_working_dir, hash_to_search)) | |
85 print 'Is LKGR: ' + str(is_lkgr(git_working_dir, hash_to_search)) | 79 print 'Is LKGR: ' + str(is_lkgr(git_working_dir, hash_to_search)) |
86 print 'Is on Canary: ' + ( | 80 print 'Is on Canary: ' + ( |
87 str(get_first_canary(git_working_dir, hash_to_search))) | 81 str(get_first_canary(git_working_dir, hash_to_search))) |
88 print '3.) Found follow-up commits, reverts and ports:' | 82 print '3.) Found follow-up commits, reverts and ports:' |
89 followups = get_followup_commits(git_working_dir, hash_to_search) | 83 followups = get_followup_commits(git_working_dir, hash_to_search) |
90 for followup in followups: | 84 for followup in followups: |
91 print describe_commit(git_working_dir, followup, True) | 85 print describe_commit(git_working_dir, followup, True) |
92 | 86 |
93 print '4.) Found merges:' | 87 print '4.) Found merges:' |
94 merges = get_merge_commits(git_working_dir, hash_to_search) | 88 merges = get_merge_commits(git_working_dir, hash_to_search) |
(...skipping 15 matching lines...) Expand all Loading... |
110 help='The path to your git working directory.') | 104 help='The path to your git working directory.') |
111 | 105 |
112 parser.add_argument('hash', | 106 parser.add_argument('hash', |
113 nargs=1, | 107 nargs=1, |
114 help='Hash of the commit to be searched.') | 108 help='Hash of the commit to be searched.') |
115 | 109 |
116 args = sys.argv[1:] | 110 args = sys.argv[1:] |
117 options = parser.parse_args(args) | 111 options = parser.parse_args(args) |
118 | 112 |
119 sys.exit(print_analysis(options.git_dir, options.hash[0])) | 113 sys.exit(print_analysis(options.git_dir, options.hash[0])) |
OLD | NEW |