Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: tools/release/mergeinfo.py

Issue 2733923002: [mergeinfo.py] Use remotes/origin/master instead of master (Closed)
Patch Set: Update tests Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/release/test_mergeinfo.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 11
12 GIT_OPTION_HASH_ONLY = '--pretty=format:%H' 12 GIT_OPTION_HASH_ONLY = '--pretty=format:%H'
13 GIT_OPTION_NO_DIFF = '--quiet' 13 GIT_OPTION_NO_DIFF = '--quiet'
14 GIT_OPTION_ONELINE = '--oneline' 14 GIT_OPTION_ONELINE = '--oneline'
15 15
16 def describe_commit(git_working_dir, hash_to_search, one_line=False): 16 def describe_commit(git_working_dir, hash_to_search, one_line=False):
17 if one_line: 17 if one_line:
18 return git_execute(git_working_dir, ['show', 18 return git_execute(git_working_dir, ['show',
19 GIT_OPTION_NO_DIFF, 19 GIT_OPTION_NO_DIFF,
20 GIT_OPTION_ONELINE, 20 GIT_OPTION_ONELINE,
21 hash_to_search]).strip() 21 hash_to_search]).strip()
22 return git_execute(git_working_dir, ['show', 22 return git_execute(git_working_dir, ['show',
23 GIT_OPTION_NO_DIFF, 23 GIT_OPTION_NO_DIFF,
24 hash_to_search]).strip() 24 hash_to_search]).strip()
25 25
26 26
27 def get_followup_commits(git_working_dir, hash_to_search): 27 def get_followup_commits(git_working_dir, hash_to_search):
28 return git_execute(git_working_dir, ['log', 28 cmd = ['log', '--grep=' + hash_to_search, GIT_OPTION_HASH_ONLY,
29 '--grep=' + hash_to_search, 29 'remotes/origin/master'];
30 GIT_OPTION_HASH_ONLY, 30 return git_execute(git_working_dir, cmd).strip().splitlines()
31 'master']).strip().splitlines()
32 31
33 def get_merge_commits(git_working_dir, hash_to_search): 32 def get_merge_commits(git_working_dir, hash_to_search):
34 merges = get_related_commits_not_on_master(git_working_dir, hash_to_search) 33 merges = get_related_commits_not_on_master(git_working_dir, hash_to_search)
35 false_merges = get_related_commits_not_on_master( 34 false_merges = get_related_commits_not_on_master(
36 git_working_dir, 'Cr-Branched-From: ' + hash_to_search) 35 git_working_dir, 'Cr-Branched-From: ' + hash_to_search)
37 false_merges = set(false_merges) 36 false_merges = set(false_merges)
38 return ([merge_commit for merge_commit in merges 37 return ([merge_commit for merge_commit in merges
39 if merge_commit not in false_merges]) 38 if merge_commit not in false_merges])
40 39
41 def get_related_commits_not_on_master(git_working_dir, grep_command): 40 def get_related_commits_not_on_master(git_working_dir, grep_command):
42 commits = git_execute(git_working_dir, ['log', 41 commits = git_execute(git_working_dir, ['log',
43 '--all', 42 '--all',
44 '--grep=' + grep_command, 43 '--grep=' + grep_command,
45 GIT_OPTION_ONELINE, 44 GIT_OPTION_ONELINE,
46 '--decorate', 45 '--decorate',
47 '--not', 46 '--not',
48 'master', 47 'remotes/origin/master',
49 GIT_OPTION_HASH_ONLY]) 48 GIT_OPTION_HASH_ONLY])
50 return commits.splitlines() 49 return commits.splitlines()
51 50
52 def get_branches_for_commit(git_working_dir, hash_to_search): 51 def get_branches_for_commit(git_working_dir, hash_to_search):
53 branches = git_execute(git_working_dir, ['branch', 52 branches = git_execute(git_working_dir, ['branch',
54 '--contains', 53 '--contains',
55 hash_to_search, 54 hash_to_search,
56 '-a']).strip() 55 '-a']).strip()
57 branches = branches.splitlines() 56 branches = branches.splitlines()
58 return map(str.strip, branches) 57 return map(str.strip, branches)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 help='The path to your git working directory.') 103 help='The path to your git working directory.')
105 104
106 parser.add_argument('hash', 105 parser.add_argument('hash',
107 nargs=1, 106 nargs=1,
108 help='Hash of the commit to be searched.') 107 help='Hash of the commit to be searched.')
109 108
110 args = sys.argv[1:] 109 args = sys.argv[1:]
111 options = parser.parse_args(args) 110 options = parser.parse_args(args)
112 111
113 sys.exit(print_analysis(options.git_dir, options.hash[0])) 112 sys.exit(print_analysis(options.git_dir, options.hash[0]))
OLDNEW
« no previous file with comments | « no previous file | tools/release/test_mergeinfo.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698